The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): finish the whole source-update tail when a startup completes it
ethernet225fd5bcd63a
diff --git a/hermes_cli/source_completion.py b/hermes_cli/source_completion.pyindex 9847c1cae73..faae6580a32 100644--- a/hermes_cli/source_completion.py+++ b/hermes_cli/source_completion.py@@ -79,6 +79,9 @@ def main(argv: list[str] | None = None) -> int:help="Also build the packaged desktop app.")parser.add_argument("--interactive", action="store_true",help="Allow prompts; installers pass no flag and stay unattended.")+ parser.add_argument("--finish-update", action="store_true",+ help="Complete a source UPDATE tail instead of an install: the "+ "same launchers/products/maintenance with update wording.")args = parser.parse_args([argument for argument in argv if argument != _PREPARED])root = args.source.resolve()if not (root / "hermes_cli/source_completion.py").is_file():@@ -91,10 +94,21 @@ def main(argv: list[str] | None = None) -> int:from hermes_cli.runtime_paths import activate_dependenciesactivate_dependencies(root)- ok = complete_source_checkout(- root, desktop=args.desktop, assume_yes=not args.interactive,- completion_message="✓ Install complete!",- )+ if args.finish_update:+ # A source update that never reached its own completion -- a+ # pre-handoff release cannot flip during `hermes update`, so its+ # update ends with the tree at HEAD and nothing built -- lands here+ # on the next ordinary startup. Same tail as an install, so the two+ # states cannot drift apart.+ ok = complete_source_checkout(+ root, desktop=args.desktop, assume_yes=True,+ completion_message=None, announce="\n✓ Code updated!",+ )+ else:+ ok = complete_source_checkout(+ root, desktop=args.desktop, assume_yes=not args.interactive,+ completion_message="✓ Install complete!",+ )return 0 if ok else 1from hermes_cli.runtime_paths import activation_environmentdiff --git a/hermes_cli/venv_sync.py b/hermes_cli/venv_sync.pyindex de88da3dcfb..2abd12349d3 100644--- a/hermes_cli/venv_sync.py+++ b/hermes_cli/venv_sync.py@@ -8,6 +8,7 @@ from __future__ import annotationsimport argparseimport json+import subprocessfrom pathlib import Pathfrom hermes_cli.steward import UPDATE_MECHANISMS@@ -155,7 +156,7 @@ def prepare_launch(project_root: Path, argv: list[str]) -> Path | None:import pmfrom hermes_cli._launchers import resolve_store_python- from hermes_cli.runtime_paths import runtime_facts_path+ from hermes_cli.runtime_paths import activation_environment, runtime_facts_pathcurrent = pm.venv_is_current(project_root=root)if not current:@@ -173,6 +174,26 @@ def prepare_launch(project_root: Path, argv: list[str]) -> Path | None:# must not make early recovery immediately rebuild it a second time.for name in (".update-incomplete", ".lazy-refresh-incomplete"):(root / name).unlink(missing_ok=True)+ # Sync commits the dependency generation, but a source update also owes+ # the product builds and the post-build maintenance -- the tail every+ # install and finished update shares (hermes_cli/source_completion.py).+ # Those builds need PM's selected interpreter with its dependencies+ # activated, so hand that file THIS interpreter and let it re-exec+ # itself, exactly as the installers do.+ desktop_app = root / "apps/desktop"+ desktop = ((desktop_app / "dist/index.html").is_file()+ or any((desktop_app / "release").glob("*")))+ code = subprocess.call(+ [sys.executable, "-I", "-B", "-u",+ str(root / "hermes_cli/source_completion.py"),+ "--source", str(root), "--finish-update",+ *(("--desktop",) if desktop else ())],+ cwd=root, env=activation_environment(root),+ )+ if code != 0:+ raise RuntimeError(+ "source update completion failed; run `hermes update` to finish it"+ )python = resolve_store_python(root)if python is None:raise RuntimeError("source update has no managed Python; run `hermes pm install`")