The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): CP0 owes the restart for the commit its checkout lands on (review N16)
Tekniumd5618647a76d
diff --git a/hermes_cli/update_cmd.py b/hermes_cli/update_cmd.pyindex c989d0bef26..8610af87647 100644--- a/hermes_cli/update_cmd.py+++ b/hermes_cli/update_cmd.py@@ -1128,8 +1128,9 @@ def _switch_branch_at_commit_point(git_cmd, branch, target_ref, *, pre, stash):if args is attempts[0][0]:continue # no local branch: only the -B form can land on itreturn _git_run(git_cmd, args) # unresolvable: git fails before touching the tree- refused = _commit.arm_commit_point(git_cmd, root, resolve(target_ref) or target, pre=pre, target=target,- stash=stash)+ # Owe what this attempt lands on: a stop before CP1 must be dischargeable at *target*+ # (CP1 retargets the obligation before its own move).+ refused = _commit.arm_commit_point(git_cmd, root, target, pre=pre, target=target, stash=stash)if refused: # nothing moved: the caller restores the autostash and exitsreturn subprocess.CompletedProcess(args, 1, "", refused)try:diff --git a/tests/hermes_cli/test_update_interrupted_pull.py b/tests/hermes_cli/test_update_interrupted_pull.pyindex aa75ec49327..2c109f62422 100644--- a/tests/hermes_cli/test_update_interrupted_pull.py+++ b/tests/hermes_cli/test_update_interrupted_pull.py@@ -684,6 +684,22 @@ def test_a_branch_switch_whose_marker_cannot_be_written_never_starts(checkout, cassert _git(root, "rev-parse", "--abbrev-ref", "HEAD") == "feat"+def test_a_branch_switch_owes_the_restart_for_the_commit_it_lands_on(checkout, commit_point):+ """Local main (A) trails origin/main (B): CP0 lands on A, so a stop before CP1 must leave debt+ a checkout at A can discharge, never B's (N16)."""+ from hermes_cli.update_host_obligation import read_host_obligation++ root, a, b = checkout+ _git(root, "checkout", "-q", "-b", "feat")+ _git(root, "-c", "user.name=t", "-c", "[email protected]", "commit", "-q", "--allow-empty", "-m", "parked")+ parked = _git(root, "rev-parse", "HEAD")++ result = update_cmd._switch_branch_at_commit_point(["git"], "main", "origin/main", pre=parked, stash=None)++ assert result.returncode == 0 and _git(root, "rev-parse", "HEAD") == a+ assert (read_host_obligation() or {}).get("expected_sha") == a != b++def test_an_unmarked_rollback_that_fails_never_reports_the_install_unchanged(checkout, commit_point, monkeypatch, capsys):"""The syntax rollback cannot refuse (the tree is already broken), but without a marker only atree verified whole at pre may be reported restored (F25)."""