Repository navigation
Conversation
There was a problem hiding this comment.
Review mode: initial
Requirement — Pass
A discoverable CLI/MCP archive operation fills an existing peer-lifecycle gap. Standing down finished workers while retaining history fits HAPI and addresses the reported memory use.
Evidence
- Issue #2020 identifies memory reclamation as the primary goal and explicitly excludes hard deletion.
- Base cli/src/commands/registry.ts and cli/src/claude/utils/startHappyServer.ts expose peer discovery, inspection and messaging, but no archive operation.
Approach — Pass
Reusing namespace-scoped authentication and the existing archive endpoint is viable. Hub-authored archive metadata already triggers CLI shutdown on delivery or reconnect, so the fallback can stand down reachable idle workers.
Evidence
- cli/src/modules/archivePeer/archivePeer.ts:219 exchanges credentials, resolves the peer and calls the archive endpoint.
- hub/src/sync/syncEngine.ts:1825 introduces the idle-worker fallback and reuses the existing metadata broadcast.
- cli/src/api/apiSession.ts:861 detects hub-authored archives; cli/src/claude/registerKillSessionHandler.ts:44 invokes cleanup on that signal.
Code — Reviewed
Reviewed the entire fixed-head merge-base diff. One material defect allows stale work state to bypass the intended protection for working peers.
- [Major] Do not treat expired thinking state as proof that a peer is idle —
hub/src/sync/syncEngine.ts:1833
Testing
Not run (automation; PR code execution is prohibited).
- Observed CI: drift-gate, integration and windows-codex-mcp passed; the main test job was still running.
- Added archive tests use fixed thinking flags and do not cover heartbeat expiry or cache restoration before the fallback decision.
- The PR snapshot reports local unit tests and CLI/hub typechecks passed; the three-worker MCP memory-reclamation exercise remains unchecked.
- No PR code, tests, builds or scripts were executed during this read-only review.
HAPI Bot
Do not treat expireInactive-cleared thinking as Peer Done. Soft stand-down past still_alive/unknown only when keepalive-idle or still connected without live work (tiann#2021 bot Major / tiann#2020). Co-authored-by: Cursor <[email protected]>
Soft stand-down now requires positive idle evidence (tiann#2021 bot Major). Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Review mode: follow-up after new commits
Requirement — Pass
A discoverable CLI/MCP archive operation fills a peer-lifecycle gap: reclaim finished workers' memory while retaining session history.
Evidence
- Issue #2020 identifies memory reclamation as the primary goal and excludes hard deletion.
- Base cli/src/commands/registry.ts and cli/src/claude/utils/startHappyServer.ts expose peer inspection and messaging but no archive operation.
Approach — Pass
Reusing namespace-scoped authentication, the archive endpoint, and existing hub-authored shutdown metadata is viable. The remaining work-state guard defect can be fixed within this approach.
Evidence
- cli/src/modules/archivePeer/archivePeer.ts:208 resolves the peer using configured credentials and calls the existing archive endpoint.
- hub/src/sync/syncEngine.ts:1833 gates the fallback before broadcasting versioned archive metadata.
- cli/src/api/apiSession.ts:861 and cli/src/claude/registerKillSessionHandler.ts:44 already turn hub-authored archives into CLI shutdown.
Code — Reviewed
Reviewed the entire fixed-head merge-base diff. The follow-up fixes heartbeat expiry for running rows, but a stale idle lifecycle still bypasses protection for working peers.
- [Major] Require fresh evidence before trusting an idle lifecycle —
hub/src/sync/sessionIdle.ts:63
Testing
Not run (automation; PR code execution is prohibited).
- Fixed-head CI: drift-gate, integration, and windows-codex-mcp passed; the main test job remained in progress.
- Added coverage verifies running-row heartbeat expiry, but not stale idle lifecycle evidence after disconnection or cache restoration.
- The PR snapshot reports local unit tests and CLI/hub typechecks passed; the three-worker MCP memory-reclamation exercise remains unchecked.
- No PR code, tests, builds, or scripts were executed during this read-only review.
HAPI Bot
Only still-connected Peer Done rows may bypass unconfirmed StopSession; lifecycleState=idle after transport expiry is unknown work state (tiann#2021). Co-authored-by: Cursor <[email protected]>
Second tiann#2021 Major: refuse stale idle lifecycle after disconnect. Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Review mode: follow-up after new commits
Requirement — Pass
A discoverable CLI/MCP archive operation fills a peer-lifecycle gap: stand down finished workers to reclaim memory while retaining session history.
Evidence
- Issue #2020 identifies memory reclamation as the primary goal and explicitly excludes hard deletion.
- Base cli/src/commands/registry.ts and cli/src/claude/utils/startHappyServer.ts expose peer discovery, inspection, and messaging without an archive operation.
Approach — Pass
Reusing namespace-scoped authentication and the existing archive endpoint is viable. The unconfirmed-stop fallback requires an active row without visible work and uses existing versioned archive metadata to trigger CLI shutdown.
Evidence
- cli/src/modules/archivePeer/archivePeer.ts:208 resolves the peer and calls the existing archive endpoint using configured credentials.
- hub/src/sync/sessionIdle.ts:61 requires active transport and rejects thinking, background tasks, or pending requests.
- hub/src/sync/syncEngine.ts:1831 gates the fallback before broadcasting archive metadata; cli/src/api/apiSession.ts:861 and cli/src/claude/registerKillSessionHandler.ts:44 handle the resulting shutdown.
- cli/src/claude/utils/startHappyServer.ts:49 and cli/src/modules/common/permission/BasePermissionHandler.ts:49 preserve permission gating for archive_peer.
Code — Reviewed
Reviewed the entire fixed-head merge-base diff. No actionable defects identified. The previous stale-idle finding is addressed by rejecting disconnected rows regardless of lifecycle state. Actual worker termination and memory reclamation remain unverified end to end.
No reportable code issues found.
Testing
Not run (automation; PR code execution is prohibited).
- Fixed-head CI: integration and drift-gate passed; test and windows-codex-mcp remained in progress when inspected.
- Added coverage exercises connected idle fallback, working-peer refusal, heartbeat expiry, stale idle lifecycle rejection, HTTP 409 mapping, CLI resolution, MCP registration, and permission gates.
- The PR snapshot reports local CLI/hub tests and typechecks passed; the three-worker MCP memory-reclamation exercise remains unchecked.
- No PR code, tests, builds, or scripts were executed during this read-only review.
HAPI Bot
…iann#2406/tiann#2407 via HAPI Co-Authored-By: HAPI <[email protected]> Co-authored-by: Cursor <[email protected]>
via HAPI Co-Authored-By: HAPI <[email protected]> Co-authored-by: Cursor <[email protected]>
via HAPI Co-Authored-By: HAPI <[email protected]> Co-authored-by: Cursor <[email protected]>
via HAPI Co-Authored-By: HAPI <[email protected]> Co-authored-by: Cursor <[email protected]>
Two bugs in the atomic remat, both found by running the 0.35.0 absorb through
it. Each one alone is survivable; together they made a promote that touches a
new dependency unrecoverable.
1. Dependencies were installed after the build that needed them.
The install exists, and its comment names this exact hazard: tip-forward may
land workspace deps the remat worktree already has while live
driver/node_modules stays stale. But it sat inside the --verify block, which
runs after --build-web. vite resolves against driver/node_modules, so a tip
adding a direct dep died at build:
Missing "./parseOnly" specifier in "remark-cjk-friendly" package
upstream 0.35.0 promotes remark-cjk-friendly to a direct ^2.3.4 dependency;
the driver had only 1.2.3 and 2.0.1 transitively, and ./parseOnly first
exists in 2.3.x. Moved the install to just after the promote, before the
build. The later one now runs only when the pre-build install did not (the
verify-without-promote path).
2. Resume treated a dirty working tree as an unusable branch.
driver_remat_prepare refused to resume unless the tree was pristine, falling
through to a hard reset to the live tip. A post-promote rollback reliably
leaves dirt behind, so any failure after the promote point made the NEXT run
unresumable by construction — and the reset is silent about what it costs.
Here it discarded a 72-file upstream absorb, the migration-ladder
resolution, and three layer merges. The commits survived only because they
were still in the reflog; the repo is carrying 6947 unreachable objects and
gc warnings, so one prune would have ended them. They are now tagged
soup-absorb-0.35.0-round2.
Resumability is a property of the branch, not the working tree. Tree state
is regenerable — layers re-merge, heals re-apply, rerere replays. Committed
history is not. So a dirty or mid-merge tree now discards the tree and keeps
the commits. HAPI_REMAT_RESUME=0 still hard-resets, unchanged.
Tests: two cases in driver-remat-atomic.test.sh covering dirty-tree and
mid-merge resume. Both fail against the unfixed library with
"dirty tree wiped committed WIP" and pass with it — checked in that order, so
they are not passing vacuously. 13 cases green.
via [HAPI](https://hapi.run)
Co-Authored-By: HAPI <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Nothing in the gate could see this class. The merge takes an upstream import
line without conflict, a resolution elsewhere in the file drops the call site,
and the result is silent three ways: the symbol is still present so
`hapi-sentinel-check --auto` reports nothing missing, an unused import is legal
TypeScript so typecheck passes, and the only visible symptom is a feature that
is never invoked.
That is how upstream 0.35.0's model-catalog args stopped reaching the Codex
app-server. `launch.ts` kept `import { resolveModelCatalogArgs }` and lost
`serverArgs.push(...resolveModelCatalogArgs(serverArgs))`. One line, no
conflict, no gate.
Flags a name only when the composed tree mentions it exactly once (the import)
AND upstream calls it. That second condition is what makes the output usable: a
fork may carry a dead import it never wired up, which is not this bug. On the
0.35.0 absorb it found 15, of which 4 were real losses and the rest were
pre-existing fork dead imports — verified by checking each against the live tip
rather than trusting the count.
Report-only, because a rename is textually identical to a deletion.
via [HAPI](https://hapi.run)
Co-Authored-By: HAPI <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Every PreToolUse guard matched on Bash only, and the sub-guards read .tool_input.command. context-mode executes arbitrary code in a subprocess, so ctx_execute / ctx_execute_file / ctx_batch_execute were an unguarded path to exactly the mutations these guards exist to stop. A tiann#987 peer ran a raw gradle build through it, past the estate lock, before catching it. The sharper half: this is not only "an agent could route around the guard". The Bash guard *redirects* curl/wget to ctx_execute, so an agent following the instruction it is handed lands outside the checks without ever intending to. I did exactly that several times today probing hub endpoints. A guard that steers traffic into its own blind spot is worse than one that merely has a blind spot. Two places had to change, and missing either leaves most of the estate open: - .claude/settings.json — manually launched sessions in this repo. - generateHookSettings.ts — the per-session settings runner-spawned sessions get, which was `matcher: 'Bash'`. That is most agents on this box. Rather than teach every sub-guard a second payload shape, the adapter normalises the executable text into the Bash shape they already understand, so every existing pattern — and every pattern added later — covers both paths for free. It also appends a punctuation-stripped copy of the payload, because the patterns are contiguous phrases: subprocess.run(["sudo", "systemctl", "restart", ...]) never contains "systemctl restart" until the quotes and commas are flattened. I only found that because the first version of the test caught it; the obvious implementation passes four of five cases and silently misses argv lists. Deliberately over-inclusive — a guard should err toward blocking, and the operator TTY override already exists. Tests cover all four shapes plus a harmless payload that must stay allowed, and lead with a Bash control so the suite cannot read green if the base path breaks. Verified in the failing direction: against the unfixed guard 5 cases fail and the control still passes. Not yet live for runner sessions — generateHookSettings ships in the CLI, so it needs a promote and restart to take effect. Repo-scoped sessions pick it up on next launch. Unrelated pre-existing failure on main: claude.test.ts resume identity, which fails in isolation and references nothing here — same file 2ec10899 cut upstream as tiann#2396. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Review mode: follow-up after new commits
Requirement — Pass
Peer orchestrators need a CLI and MCP command that reclaims idle Runner workers while preserving session history. Every Archive caller should receive a 409 before any stop RPC when work is live, and Runner-owned sessions should still require verified cleanup.
Evidence
- Issue #2020 documents the memory cost of idle peers and establishes a shared Archive guard. #2020 (comment)
- The base command registry has peer commands but lacks Archive at cli/src/commands/registry.ts:46. The existing verified-cleanup contract is documented at hub/README.md:147.
Approach — Needs changes
Reusing the Archive endpoint and adding a read-only Runner probe fit the requirement. The guard still loses track of work across worker replacement. A replacement’s idle heartbeat can erase the previous worker’s only live-work record and let Archive issue stop RPCs. A retained background record can also keep returning 409 after both workers have exited because Archive cannot verify the original owner directly.
Evidence
- The replacement path preserves durable work at hub/src/sync/syncEngine.ts:1038. The next idle heartbeat clears the session’s single unresolvedTurn record without matching its owner at hub/src/sync/sessionCache.ts:759 and hub/src/sync/sessionCache.ts:1032. This leaves a turn with no tool or background record unprotected.
- Archive probes the current machine by session ID at hub/src/sync/syncEngine.ts:3940 and hub/src/sync/syncEngine.ts:3973. The marker check at hub/src/sync/syncEngine.ts:4007 retains prior-generation work, while the Runner returns a session-level exit result at cli/src/runner/run.ts:1934.
Suggestions
- Store unresolved work by owning machine and worker generation. Apply idle and completion updates only to the reporting generation, and let Archive use the read-only Runner probe to verify the recorded owner’s process containment before clearing its work.
Code — Not reviewed
Code review stopped at the approach stage because the Archive guard needs generation-scoped work settlement and exit verification.
Testing
Not run (automation; PR code execution is prohibited).
- Static review only. On 8ad2f70, core and fixture drift passed. CLI and web unit tests, integration, browser, wrapper parity, Windows Codex MCP, and advisory review were still in progress when checked. https://github.com/tiann/hapi/actions/runs/46146966201 https://github.com/tiann/hapi/actions/runs/46146966178 https://github.com/tiann/hapi/actions/runs/46146963885
- The replacement test at hub/src/sync/steerDeliveryLifecycle.test.ts:116 ends before the replacement’s first idle heartbeat. The Archive test at hub/src/sync/syncEngineArchiveSession.test.ts:1078 covers refusal for prior-generation work. The transition to successful Archive after verifying the original owner’s exit remains untested.
HAPI Bot
Tip follow-up (
|
There was a problem hiding this comment.
Review mode: follow-up after new commits
Requirement — Pass
Peer orchestrators need CLI and MCP commands that reclaim idle Runner processes while preserving session history. Every Archive caller should receive a 409 before any stop RPC when work is live, and Runner-owned sessions should still require verified cleanup.
Evidence
- Issue #2020 documents idle peers retaining memory and establishes a shared Archive guard. #2020 (comment)
- The base CLI registry has peer commands but lacks Archive at cli/src/commands/registry.ts:46. The existing verified-cleanup contract is documented at hub/README.md:147.
Approach — Needs changes
Reusing the Archive endpoint and adding a read-only Runner probe fit the requirement. The latest commit preserves a prior worker’s durable work across the replacement’s idle heartbeat, but Archive has no way to verify and clear that record for its original owner. If worker A exits with a recorded turn or background task and idle worker B takes over, Archive keeps returning 409 even after both workers and their child processes have exited.
Evidence
- hub/src/sync/sessionCache.ts:975 and hub/src/sync/sessionCache.ts:1057 preserve records from the prior worker. hub/src/sync/syncEngine.ts:3930 rejects an active idle replacement with those records before reaching the probe.
- For inactive rows, hub/src/sync/syncEngine.ts:3940 and hub/src/sync/syncEngine.ts:3973 probe the current Runner by session ID. The Runner reports a session-level result at cli/src/runner/run.ts:1934, and the marker check at hub/src/sync/syncEngine.ts:4007 prevents that result from clearing the prior worker’s record.
Suggestions
- Track unresolved work by owning Runner and worker generation. Let Archive verify the original owner’s process and child-process exit through a read-only probe, including when an idle replacement is connected. Clear only the records covered by that proof, then recheck the Archive guard before sending stop RPCs.
Code — Not reviewed
Code review stopped at the approach stage because Archive cannot resolve retained work after its original owner exits.
Testing
Not run (automation; PR code execution is prohibited).
- Static review only. On 4a783e0, core, fixture drift, and Windows Codex MCP passed. CLI and web unit tests, integration, browser, wrapper parity, and advisory review were still in progress when checked. https://github.com/tiann/hapi/actions/runs/46147704293 https://github.com/tiann/hapi/actions/runs/46147704286 https://github.com/tiann/hapi/actions/runs/46147701855
- The replacement test at hub/src/sync/steerDeliveryLifecycle.test.ts:154 covers the first idle heartbeat, and hub/src/sync/syncEngineArchiveSession.test.ts:1078 covers refusal when the current Runner reports exit. Neither test covers successful Archive after verifying the original owner’s exit.
HAPI Bot
Tip follow-up (
|
There was a problem hiding this comment.
Review mode: follow-up after new commits
Requirement — Pass
Peer orchestrators need CLI and MCP commands that reclaim idle Runner processes while preserving session history. Every Archive caller should get a 409 before any stop RPC when the hub has evidence of live work, and Runner-owned sessions should still require verified cleanup.
Evidence
- Issue #2020 documents idle peers retaining memory and defines a shared Archive precondition. #2020 (comment)
- The base CLI registers peer commands without Archive at cli/src/commands/registry.ts:46. The existing verified-cleanup contract is documented at hub/README.md:147.
Approach — Needs changes
Reusing the Archive endpoint and verifying Runner cleanup fit the requirement. The work records cannot represent both a prior worker and its replacement. If worker A leaves a background record and worker B reports its own background task, Archive can ignore B’s reported task and send stop RPCs while B is still working. This violates even the PR’s current-generation guarantee.
Evidence
- hub/src/sync/sessionCache.ts:960 updates B’s task count, but the check at line 975 preserves A’s durable record and skips persisting B’s tasks. hub/src/sync/sessionIdle.ts:77 then ignores the count because the durable record belongs to A. If B has finished its foreground turn and has no other work signals, hub/src/sync/syncEngine.ts:3930 lets Archive reach KillSession at line 4041.
- The same single-record design prevents B from recording an unresolved turn while A’s record exists at hub/src/sync/sessionCache.ts:1026. Heartbeat expiry then clears B’s thinking flag at line 1409, leaving only A’s record, which the guard ignores.
- A marker mismatch also provides no evidence that A exited. Archive sends StopSession by session ID at hub/src/sync/syncEngine.ts:4064, and the Runner can terminate another process matching that session ID during its orphan sweep at cli/src/runner/run.ts:1369. Issue #2657 documents this remaining gap. #2657
Suggestions
- Track live-work records independently by owning Runner and worker generation so a replacement can record and settle its own work. Keep prior-owner evidence blocking until a read-only probe verifies that owner’s process and containment have exited, then recheck the guard before sending stop RPCs.
Code — Not reviewed
Code review stopped at the approach stage because the work record model cannot enforce the Archive precondition across worker replacement.
Testing
Not run (automation; PR code execution is prohibited).
- Static review only. On 20494c5, core and fixture drift passed. CLI and web unit tests, integration, browser, wrapper parity, Windows Codex MCP, and advisory review were in progress when checked.
- The replacement case at hub/src/sync/syncEngineArchiveSession.test.ts:1078 covers A’s retained record alone. Add cases that verify zero stop RPCs while B reports background work or A is still running, and successful Archive after A’s exit is verified and B is idle.
HAPI Bot
Tip follow-up (
|
There was a problem hiding this comment.
Review mode: follow-up after new commits
Requirement — Pass
Peer orchestrators need CLI and MCP Archive commands to reclaim memory from idle workers while preserving session history. The shared Archive endpoint should return 409 before sending any stop RPC when the hub has evidence of live work, and success for Runner-owned sessions should still require verified cleanup.
Evidence
- Issue #2020 documents idle peer processes retaining memory and specifies the shared refusal-before-stop precondition. #2020 (comment)
- The base CLI registers peer commands without Archive at cli/src/commands/registry.ts:46. The base Archive path calls KillSession without a live-work check at hub/src/sync/syncEngine.ts:3857, and hub/README.md:148 documents the verified-cleanup contract.
Approach — Needs changes
Reusing the Archive endpoint and allowing the replacement worker to record its own work are sound. The guard still drops known work from its decision as soon as that work belongs to a prior generation. If the prior worker is still running on the same Runner and the replacement is idle, Archive can terminate the prior worker despite the hub having recorded its unfinished work.
Evidence
- At the reviewed head, hub/src/sync/sessionCache.ts:998 and hub/src/sync/sessionCache.ts:1051 allow the replacement to record its own work. hub/src/sync/sessionIdle.ts:70 and hub/src/sync/sessionIdle.ts:81 exclude retained work when its generation differs from the current worker. Issue #2657 documents the remaining overlap. #2657
- hub/src/sync/syncEngine.ts:3932 can let Archive through without an exit probe for the prior owner, then sends StopSession by session ID at line 4066. cli/src/runner/run.ts:1557 selects tracked processes by that ID and can terminate the matching process tree at line 1613. The orphan sweep at line 1369 can reach other processes with the same session ID.
Suggestions
- Keep unresolved work separately for each owning Runner and worker generation. Return 409 while an owner with recorded work is alive or its exit is uncertain. Use a read-only probe for that owner's process and containment, then recheck the guard before sending stop RPCs.
Code — Not reviewed
Code review stopped at the approach stage because the guard can authorize a stop while recorded work still belongs to a live prior worker.
Testing
Not run (automation; PR code execution is prohibited).
- On 04c4c3f, the fixture drift gate passed. Core, CLI and web unit tests, integration, browser, wrapper parity, Windows Codex MCP, and advisory review were still in progress when checked. The review used static inspection only.
- The test at hub/src/sync/syncEngineArchiveSession.test.ts:1143 covers the replacement reporting background work. Add coverage that verifies zero KillSession and StopSession calls while the prior owner is alive, followed by a successful Archive once that owner's exit is verified and the replacement is idle.
HAPI Bot
…#2147) Operator directive: dogfood the real upstream Boards branch instead of the fork-only first-shippable-slice version. feat/boards is a strict superset in correctness, confirmed by diff: issueTemplateParser.ts is 246 lines on #238 vs 802 on feat/boards, the extra ~550 being the GitHub-form-validation hardening (forbidden words, Boolean coercion, duplicate-id collisions, name-length minimum, blank-issue-policy correctness) #238 never received. Retires five layers: driver/235-todo-board-view (the Boards view itself) and four #238 externalRefs follow-on patches, all superseded by feat/boards's own (already upstream-absorbed) externalRefs handling. Also retires driver/247-board-spawn-rename — confirmed feat/boards already calls api.renameSession natively in router.tsx. All five kept commented for history/rollback reference, not deleted. via HAPI Co-Authored-By: HAPI <[email protected]>
…s, two unions
Required before the feat/boards compose: the rebuild refuses to compose on a
base that trails upstream, and fork main was 23 commits behind.
THREE CONFLICTS, none of which were a real disagreement:
cli/src/codex/happyMcpStdioBridge.test.ts — UNION. Ours listed
'search_content', upstream listed 'session_waiting'. Two DIFFERENT tools in
one list, not competing edits: taking either side alone silently drops a
real tool. session_waiting is a genuine new upstream tool (present in
apiSession.ts and startHappyServer.ts on upstream/main), and search_content
is fork-only. Kept both.
cli/src/codex/utils/buildHapiMcpBridge.test.ts — ONE side, then three unions.
Hunk 1: took THEIRS. Ours hardcoded the expected tool arrays with a comment
explaining they were a fork/upstream union; upstream refactored to
`toolNames,`, computed from options.enabledTools at line 17. The computed
form achieves that union automatically and cannot drift, which is exactly
what our comment was trying to protect by hand — verified `toolNames` is
genuinely in scope before taking it.
Hunks 2-4: UNION on the comma lists and the approval-mode object. Set
difference was precisely ours-only ['search_content'] vs theirs-only
['session_waiting'] in both string hunks, so either side alone loses one
tool. Verified after: search_content 3 refs, session_waiting 6 refs.
hub/src/store/index.ts — KEPT OURS. Theirs is EMPTY: upstream has no
HAPI_STORE_ALLOW_NEWER_SCHEMA tolerance block. An upstream ABSENCE is not an
upstream addition, and that block is a deliberate fork feature (tolerate a
DB schema ahead of source rather than refusing to boot). Kept, 2 refs.
VERIFICATION, and the honest shape of it: typecheck:cli 0 errors. typecheck:hub
reports 6 — ALL of them TS2307 "cannot find module", confined to
src/web/routes/passkey.ts and src/web/testHelpers/passkeyAuthenticator.ts, and
NONE in any file this merge touched. Those are the new @simplewebauthn/server
and reflect-metadata deps that arrived with upstream's `feat: sign in to the web
app with passkeys` (809967b): declared in hub/package.json, not present in this
mirror's node_modules.
NOT INSTALLED HERE, deliberately. `bun install` on the primary mirror is blocked
by soup hygiene (incident 2026-07-18 tiann#1084: dirtying package.json/bun.lock
blocks rematerialize for every agent) and I did not override it. The install is
not needed for this commit either — the repo content is correct, only this
checkout's node_modules is stale, and the rebuild runs its own install in the
driver tree before the gates, which is where it actually matters.
Co-Authored-By: Claude Opus 5 <[email protected]>
…ay delete/modify
Three consecutive composes failed on ONE path while all 35 genuine content
conflicts staged cleanly from rerere ("Staged '<file>' using previous
resolution" down the list). The path was
web/src/hooks/useShowActiveSessionsOnly.ts, which upstream deleted in tiann#2622
("remove duplicate active-only settings switch") once combined session-list
filters landed, and which the live tip still carried.
WHY IT DEADLOCKED, rather than merely failed. rerere records CONTENT conflicts
only. A delete/modify ("UD") has no resolution to record, and tip-forward resets
the WIP to PREV_TIP before merging — so resolving it by hand and committing
cannot survive the next run. Resolve, re-run, same single conflict, forever. The
fast path at the bottom of this block is explicitly designed to commit when
rerere has handled everything; one unrecordable conflict was defeating it.
THE RULE, and why it is the right default here: in tip-forward the manifest base
is authoritative for BASE content, and any layer that genuinely owns a file
re-adds it when that layer replays. So taking the base's deletion is what the
architecture already implies. The one loss case is a fork-only file that no
layer owns, and that is exactly what config/soup-required-surface.yaml exists to
catch — a HARD gate later in this same run, which is why this can be a default
rather than a prompt.
DELIBERATELY NARROW: only paths with stage 2 present and stage 3 ABSENT (ours
modified, base deleted). Each acceptance is logged loudly, never silent. A real
content conflict has all three stages and is untouched.
VERIFIED BOTH DIRECTIONS on a synthetic repo, because an accept-deletion path
that cannot discriminate is how fork files vanish quietly:
base deletes src/doomed.ts + tip modifies it -> stages "1 2" -> ACCEPTED
both sides modify src/keep.ts -> stages "1 2 3" -> left for a human
Also confirmed against the live conflicted worktree: web/src/router.tsx reports
stages 1 2 3 and so would NOT be auto-deleted. bash -n clean.
Note the sibling lesson already recorded three lines below this change: the
marker scan excludes docs/ because a plan write-up quoting real conflict markers
once disabled this same fast path. Same failure shape — a fast path defeated by
one unexpected input, with every layer re-conflicting and no progress
accumulating.
Co-Authored-By: Claude Opus 5 <[email protected]>
…markers into the promoted tip
Consequences now proven, where this morning they were only suspected. I reported
this defect and explicitly did not fix it ("unproven consequences, so reported
rather than bundled"). Tonight it shipped conflict markers into a promoted soup
tip.
WHAT HAPPENED. Heals 111 (garden-xr-chip-toolbar) and 113
(native-app-promo-sheet-render) both passed `git apply --check -3` and then
FAILED `git apply -3`, leaving a 3-way conflict with `<<<<<<< ours` markers in
web/src/router.tsx. The skip path's "revert" ran `git checkout -- .`, which
restores the worktree FROM THE INDEX — and an earlier heal in the same loop had
already run `git add -A`, so the partial application was staged. The revert
therefore preserved precisely what it was meant to discard. A later heal's own
`git add -A` + commit then baked the markers into the WIP, the tip promoted, and
vite died on `Unexpected "<<"` at router.tsx:337. The atomic remat rolled the
live tip back, so nothing broken served — but the promote gate passed a tree
containing conflict markers, which is the part that should never happen.
THE FIX: restore from HEAD, not the index, at both skip sites —
`git restore --source=HEAD --staged --worktree -- .` discards a partial
application for real.
MY OWN INSTRUMENTATION CAUGHT THE CAUSE, which is the one cheerful part.
`Heal summary: applied=3 no-op=1 unappliable=6 anomalous=2` — the anomalous
counter added earlier today exists to mean exactly "a heal passed --check and was
then skipped", and its commit message says any non-zero value is a heal-loop
defect rather than a stale heal. It was 2, and it named 111 and 113 before I had
looked at a single diff. Without it this would have read as an ordinary web build
failure.
STILL OUTSTANDING, not fixed here: heals 111 and 113 are STALE against the new
base — that is why `apply -3` failed at all. They need re-cutting against the
composed tip or parking. The marker leak and the stale heals are separate bugs
and only the leak is fixed by this commit; a stale heal should degrade to a
loud skip, never to committed debris.
bash -n clean; both former `checkout -- .` sites now restore from HEAD and none
remain.
Co-Authored-By: Claude Opus 5 <[email protected]>
Estate gh-app-identity defaults unresolved-host gh api to Lockhouse GHE, so the local CI bridge silently 404'd against lhs.ghe.com. Co-authored-by: Cursor <[email protected]>
… did not land
The required-surface gate correctly refused to promote a reduced estate
tonight (10 of 32 surfaces missing: search_peers, archive_peer, link_issue,
display_links, set_voice_mode, github_issue, <GardenXrEntryChip), but it
reported only "absent from <path>". Working out WHY cost a long manual hunt
across a 77-entry manifest, and the gate already had everything needed to
say it.
Root cause that hunt found, for the record: the fat-tip gate refused
feat/archive-peer-2020 ("88 non-merge commits, max 20"), so the sole supplier
of those MCP tool registrations never replayed, and the composed copies of
startHappyServer.ts / happyMcpStdioBridge.ts / schemas.ts came out
byte-identical to origin/main (1087 vs the live tip's 1336 lines).
Two things this deliberately does NOT do, both learned by getting them wrong
in the same sitting:
1. It does not report every layer whose tree CONTAINS the symbol. The first
cut did, and it was worthless — most layer branches are cut from a soup tip
that already carried the surface, so ~40 of them "contain" it. It
confidently blamed driver/1931-spawn-machine-delta for a loss caused by
feat/archive-peer-2020. Containment is not authorship.
2. It does not assert a cause from a bare ancestor test. Filtering to layers
that are not ancestors of the composed tree still named
driver/hub-upstream-seal-url, which the rebuild had logged as "already
ancestor" — a concurrent push had advanced that layer by exactly 1 commit
after the rebuild checked it.
So it prints candidates WITH the number of commits not in the composed tree,
and claims only candidacy. 1 commit outside reads as a layer that landed and
then moved; 89 and 279 read as real suspects. The reader can tell those apart;
a blunt ancestor test cannot.
When every carrier fully landed it says so, which correctly points at the base
merge or a heal instead — the true story for <GardenXrEntryChip, whose heal
111 failed to apply against the new base.
Runs only on the GONE path, which already means a rollback, so the per-layer
git reads are never in the hot path.
Verified against the real reduced tree in worktrees/driver-remat: exit 1, and
the two refused layers are named with 89 and 279 commits outside.
Co-Authored-By: Claude Opus 5 <[email protected]>
Fat SKIP blocked tip-forward absorb; layer re-tipped for soup 10d4dd8. Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Review mode: follow-up after new commits
Requirement — Pass
Peer orchestrators need CLI and MCP commands to stop idle workers, reclaim memory, and preserve session history. All Archive callers should get a 409 before any stop RPC when the hub has evidence of live work. Runner-owned sessions should require verified cleanup before Archive reports success.
Evidence
- Issue #2020 documents idle peers retaining memory and specifies the shared refusal-before-stop behavior. #2020 (comment)
- At the fixed base, cli/src/commands/registry.ts:46 lists peer commands without Archive, hub/src/sync/syncEngine.ts:3857 calls KillSession without a live-work guard, and hub/README.md:148 documents verified Runner cleanup.
Approach — Needs changes
Reusing the shared Archive endpoint is sound. The fixed head sends KillSession before checking for live work and allows Archive to succeed for a connected session even when the Runner reports the process is still alive. That can interrupt working sessions and report success while an idle worker still consumes memory.
Evidence
- At 1003b6c, hub/src/sync/syncEngine.ts:4829 sends KillSession before checking work. At line 4909 it uses canSoftStandDownUnconfirmedStop after the stop attempts, and line 4944 can then mark the session archived.
- hub/src/sync/sessionIdle.ts:61 allows soft stand-down for a connected row with no thinking, background task count, or pending operator request. The fixed-head test at hub/src/sync/syncEngineArchiveSession.test.ts:540 explicitly expects Archive to succeed when StopSession returns still_alive.
- The fixed merge-base diff spans 940 files and adds unrelated workflows, including .github/workflows/soup-redeploy.yml.
Suggestions
- Base the PR on the target branch and carry over only the peer Archive entry points, the shared guard, and the related UI and tests.
- Check live-work evidence in the shared hub path before either stop RPC. Retain the base cleanup contract by returning an error when Runner exit is still unconfirmed.
Code — Not reviewed
The review stopped at the approach stage because the fixed head lacks the pre-stop guard and weakens the verified-cleanup contract.
Testing
Not run (automation; PR code execution is prohibited).
- At 1003b6c, GitHub reported only the advisory pr-review check, which was in progress. No tests were run locally.
- Once the approach is corrected, add coverage that live work returns 409 with zero KillSession and StopSession calls, and that still_alive or unknown cannot produce Archive success.
HAPI Bot
The PR watcher reported hapi-pr-merge-gate.sh as fetching review threads with
an un-paginated `reviewThreads(first:100)`, fail-open past 100 threads. The
repo script does not have that bug — it was refactored onto
lib/pr-review-threads.sh, which pages with `after: $cursor` +
`pageInfo { hasNextPage endCursor }`. The bug was real, but it lived in the
INSTALLED copy: ~/.local/bin/hapi-pr-merge-gate.sh is a 268-line plain file,
215 lines behind this one, still carrying the old inline query. Anyone running
the gate from PATH got that version.
Measured on tiann#2659, which has 218 review threads (3 pages):
repo version (all 218, isOutdated != true): 37 blocking
installed copy (first 100, == false predicate): 0 blocking -> step PASSES
So the stale copy did not merely undercount, it reported a clean sheet on a PR
with 37 blocking threads.
Why a copy rather than a symlink like hapi-kitchen-status: two lib paths were
built from a bare `dirname "${BASH_SOURCE[0]}"`. That is the path as INVOKED,
so under a PATH symlink it resolves to the bin directory and the lib is never
found. Verified with a control: invoked directly the lib resolves, invoked via
a symlink it does not. Copying the script sidestepped that and then froze it at
an old vintage — the copy IS the bug.
Fixed both sites (BOT_STEP_LIB, _GATE_DIR) to resolve through readlink -f, so
the installed entry point can be a symlink and stay current. Verified by
invoking via a symlink against tiann#2659: previously
"BLOCK cannot read lib/pr-emoji-core.sh", now it reaches the real
tip-matched bot verdict.
hapi-runner-watchdog.sh carried the same idiom and is swept here too. It is not
installed today, so nothing is broken yet, but its source line ends in
`|| return 0` — under a symlink it would have swallowed the miss and skipped
the staleness check entirely, failing OPEN and silently.
Co-Authored-By: Claude Opus 5 <[email protected]>
Both heals went anomalous on the 2026-11-28 compose ("apply -3 failed;
tip-forward does not heal_fail"), and they failed for opposite reasons.
heal 111 — re-cut, still load-bearing.
The previous cut added only the toolbarExtras entry, because the
GardenXrEntryChip import survived the merge at router.tsx:109. The newer
upstream router restructure drops BOTH, so an entry alone could not compile and
the patch failed outright. Measured on composed tip 9473ba733: router.tsx had 0
references to GardenXrEntryChip and 0 to garden-xr, against the live soup tip's
import at 109 and render at 1163. The component file itself is present in the
composed tree — only its wiring was lost. This cut restores the import next to
the other @/lib imports and the toolbar entry immediately before the settings
entry, matching the live tip's placement. Verified: `git apply --check` clean
against 9473ba733, and the applied result has exactly 2 references (import at
94, render at 367).
Correcting my own earlier reasoning: I had concluded 111 was load-bearing
because feat/boards' router.tsx has 0 references to the chip. That probe was
too narrow — driver/blocked-list-ux carries 2 (import AND render), so other
layers still render it. The gate's own attribution agrees with the corrected
story: "every layer carrying it fully landed", i.e. the loss came from the base
merge, not from a skipped layer. 111 is needed because of the base merge, which
happens to be the same conclusion by a sound route.
heal 113 — retired, genuinely obsolete.
The composed tree now renders the promo itself: import at router.tsx:2,
<NativeAppPromoButton /> at 385, and <NativeAppPromoSheet enabled={isSessionsIndex} />
at 399 — which is verbatim the line this heal existed to add. Upstream's render
site (f288d85) now reaches the composed tip, so applying 113 would create a
DUPLICATE render rather than restore a missing one. Parked rather than deleted,
per convention, so it is recoverable if a future base drops the render again.
Heals 112 and 114 are left armed deliberately. Both reported "no-op on WIP"
this run — their content arrived upstream via tiann#2592 and tiann#2616 — but a no-op
3-way apply costs nothing, and 114 restores RPC handlers whose supplier layer
was re-thinned tonight, so I am not retiring that insurance on one green run.
Co-Authored-By: Claude Opus 5 <[email protected]>
Keep upstream tool-description refactor + enableLinkPr/SESSION_WAITING; add ARCHIVE_PEER_TOOL_DESCRIPTION, MCP tools (archive/search/link/display/voice), github_issue ExternalRef, /sessions/search, and soft stand-down for tiann#2020. Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Review mode: follow-up after new commits
Requirement — Pass
Peer orchestrators need a CLI and MCP action that stops finished workers, frees their memory, and preserves session history. Archive should refuse active sessions with known live work before sending a stop request and require verified cleanup for Runner-owned workers.
Evidence
- Issue #2020 documents finished peers retaining memory and specifies a shared refusal before either stop RPC. #2020 (comment)
- The base CLI registers peer messaging, inspection, and spawning without an Archive command (cli/src/commands/registry.ts:46). The existing hub contract requires verified Runner cleanup (hub/README.md:147).
Approach — Needs changes
Reusing the shared Archive endpoint is sound. The fixed head still sends KillSession for active sessions with known live work and can report success while the Runner reports that the process is alive. The merge-base diff also includes unrelated deployment and review automation.
Evidence
- The peer helper posts to the ordinary Archive endpoint (cli/src/modules/archivePeer/archivePeer.ts:184). The route reaches the shared engine without a live-work check (hub/src/web/routes/sessions.ts:1217), and the engine calls KillSession at hub/src/sync/syncEngine.ts:3858.
- After the stop attempts, the engine allows a connected session with no visible work to fall through on still_alive or unknown and write archived metadata (hub/src/sync/syncEngine.ts:3923 and hub/src/sync/syncEngine.ts:3950).
- The fixed merge-base diff spans 957 files, adds .github/workflows/soup-redeploy.yml and .github/workflows/claude-codex-fallback-review.yml, and contains no web/src changes for the described Archive controls.
Suggestions
- Check live work in the shared hub path before either stop RPC and return a structured 409. Restore the unconfirmed-cleanup error for Runner-owned sessions and align the web Archive and Archive-all controls with the hub guard.
- Build the PR branch from the target tip and carry over only the peer Archive entry points, shared Archive behavior, related UI changes, and regression tests. Split fork deployment and review automation into separate changes.
Code — Not reviewed
Line-by-line review stopped at the approach stage because the fixed head lacks the pre-stop guard and weakens verified cleanup.
Testing
Not run (automation; PR code execution is prohibited).
- No PR code or tests were run locally. At 7327d45, GitHub's core job failed in the bun typecheck step. The CLI and web unit jobs and the integration and browser jobs were still in progress when checked. https://github.com/tiann/hapi/actions/runs/46206097726/job/141169024525
- Add hub regression coverage for a working session returning 409 with zero KillSession or StopSession calls, and for a connected idle Runner-owned session remaining unarchived when cleanup returns still_alive or unknown.
HAPI Bot
Superseded by clean tipDo not rebase this tip — it was contaminated by Successor (cut from Please close this PR in favour of #2740 after that one is ready (operator close). |
Safety property (current-marker-only / #2657)
This tip’s Archive live-work guard is current-generation only.
What it covers: current-worker thinking, background tasks,
unresolvedTurn,metadata.waiting, operator requests, andidleReconcileExempt— Archive returns 409 before any stop RPC when those are set. That is strictly more thanmain(which firesKillSessionwith no working-state guard).Residual hole (named, tracked): a prior-generation worker that is still running is not detected once a replacement has registered, because foreign-generation durable latches no longer count as live work. Archive can therefore stop that prior process. See #2657. Do not read this guard as a complete process-liveness proof.
Foreign-generation latches are still retained in metadata (replacement idle heartbeats do not erase them) for debugging; they simply do not block Archive.
Summary
We removed the soft stand-down exception we'd spent five review rounds defending — in response to the bot's Approach objection. Archive is now stricter than the contract we were accused of weakening: every caller faces the same precondition and the same verified Runner cleanup. There is no peer-specific success path anymore.
thinking/derivedToolWork/ background / pending requests) get 409archive-session-workingbefore anyKillSession/StopSession. Disconnected rows with stale requests after heartbeat expiry still take Runner-verified cleanup (so archive+abort cannot deadlock). Soft stand-down /softStandDownPendingdeleted from this PR.archive_peeris ordinary archive. CLI/MCP post{}and share the verified-cleanup path.metadata.spawnedBySessionId(separate commit) records the parent session UUID at peer spawn for tree walking. Telemetry only — archive never reads it.Design crux (read this first)
Runner-verified cleanup proves the process died, not that it was idle — so it cannot serve as a safety net against archiving a busy agent. That is why the live-work guard must be authoritative: prefer stranding a finished-but-flagged session over archiving a busy one.
Open tool work resolves only three ways — completion, worker exit, or explicit termination. This PR covers all three. There is no fourth.
Fence truncating operations, not all history operations. Rewind can delete markers; fork copies and leaves the source intact. The live-tool fence lives on the rewind path only. Verified OpenCode child completion also dual-writes to hub-owned
metadata.childToolWorkso a rewind that drops a terminal marker cannot orphan Archive.Coverage axis 1 — tool-call representations
tool-call/tool-call-result(+ OpenCode child registry)opencode,cursor(ACP),agy(ACP),grok,kimi,copilot,dsh,pi,codex(projects to ACP)tool_use/tool_resultclauderunning/createdmarkersopencoderetiredChildSessionIds+ durablechildToolWork)cursor(legacy)geminiWorker-generation replacement retires for every flavor (hostPid / startMarker change); steer-uncertain marking remains OpenCode/Claude only.
Coverage axis 2 — explicit termination paths
Every path that can tear down in-flight work must publish settlement for what it tore down:
cancelPrompt/ prompt reject on StopAcpSdkBackend(shared by opencode, cursor ACP, agy prompt turns, grok, kimi, copilot, dsh, pi, codex)turn_complete.settledCallIdsviasettleCancelledagyAcpRemoteLauncher.discardStoppedWakeupsettledCallIds(not only the prompt finalizer)agyAcpRemoteLauncherrunTurn finallycursorLegacyRemoteLauncherturn_completeuntil closeclaudeRemoteLauncherabort → SDK result row and/or worker exittool_usealso retired on worker-exitchildToolWorkretireOpenChildToolWorktool_useids + running childrenNo harness has a named follow-up hole on either axis.
Why tool-call settlement is in this PR (not a split)
running/createdchild markers, with durablechildToolWorkoutside the rewindable transcript.turn-complete.settledCallIdsfrom every termination path above, plus worker-exit / worker-replacement retirement.getLiveToolWorkis true; durable child settlement clears verified orphans after a successful rewind.Test plan
Issues
Fixes #2020