Repository navigation
Mark Claude child-session assistant output as commentary at ingress - #401
Merged
Merged
Conversation
j-asefa
force-pushed
the
loop/child-commentary
branch
2 times, most recently
from
November 19, 2026 21:31
5c554e9 to
abe4e12
Compare
Task tool (subagent) assistant messages and stream deltas arrived with no item phase, so when one was the last assistant text before the parent's result the projector selected it as the run's answer and it was sealed as an immutable Result. Mark such items phase=commentary so the projector keeps excluding them from answer selection while their text stays visible as progress on the run.
The first delta of a child stream establishes an empty commentary item so the projector merges deltas into it, but the projector replaces an item by id. If the full child assistant message arrived first (or the id was known from an earlier emit), re-establishing an empty item discarded the child's saved text. Remember every emitted child item id so a later delta merges into the existing item, establish only while a user turn is open so post-result deltas cannot clobber saved native history, and drop the eviction cap that could recreate the overwrite for resumed streams. Fixes the review finding on the first revision.
A child message received between turns added its id to the adapter's child id set, and the next turn cleared the projector's item window, so a delayed child delta for that id skipped the establishing emit and left a phase-less assistant fragment that could be selected as the new run's answer. Clear the child id set at the start of a new user turn (mid-turn steering prompt keeps it), so a delayed delta re-establishes its commentary item. The stored-history fallback in projectOutput already excludes commentary through assistantHistory's SQL; add a comment recording that invariant.
The supervisor attaches the next run before prompt(); a delayed full child message arriving in that recall window records its id, and prompt() then clears the id set so a later delta re-establishes the commentary item. The empty re-established item replaced the retained text before the delta appended, so progress showed only the trailing fragment. Keep the last-known text per child id across prompt() (cleared with the id set at the result) and seed the re-established item with it, so the replacement is content-identical and the delta appends to the full text.
A full child message and a delta both arriving before the next prompt left the cached seed stale at the full text, so the post-dispatch re-established item replaced the projector's merged text and the first delta was lost. Accumulate no-turn (recall/between-turns) deltas into the seed so a later delta appends to everything seen so far. Write the seed only while no turn is open (mid-turn entries are never read back) and byte-cap it, so a long turn with many child messages cannot grow adapter memory with copies of full child output; the projector truncates its own display at a similar scale.
A single long-lived child stream could grow its recall cache entry without bound (the eviction loop keeps one entry even past the budget), and eviction could erase retained progress: a post-prompt delta for an evicted id re-established an empty item over the projector's retained text. Cap each entry at the projector's display-preview limit (keeping the tail), and keep a never-evicting set of ids whose commentary item was emitted while no turn was open, so a delta for an evicted id merges into the retained item instead of replacing it.
Skipping the establishing item for an id whose recall seed was evicted let a between-turns delta reach the projector alone: the next turn clears the item window, the fallback finds nothing for the current run, and a phase-less assistant item was created that completion could select as the answer. Establish the commentary item unconditionally (phase is always safe) and never evict the recall seed (its text then never degrades to empty); each entry stays capped at the projector's display-preview limit, so one long-lived stream cannot grow it without bound.
A full child message received during an active turn was not cached and the result handler cleared the cache, so a delayed delta for that id in the next turn re-established with an empty seed and the projector's upsert replaced the stored child text with the fragment. Cache every child assistant message's text (whether a turn is open or not) and keep it across the result and prompt, so a re-established item carries the earlier text and the delta appends to it. Entries stay capped at the projector's display-preview limit; the entry count tracks the session's distinct child message ids.
Child deltas updated the recall seed only while no turn was open, so an active turn's delta-only stream was projected but never cached: a delayed delta for that id in the next turn re-established from an incomplete seed and the earlier streamed text was dropped (A plus B became A plus C). Keep the seed current with every child delta, open turn or not, so a later re-established item carries everything the stream has said so far.
The child text cache was never cleared, so a long session that repeatedly uses subagents retained an entry per distinct child message id and could grow server memory until the adapter was disposed. Byte-cap the cache at the projector's own display-window scale (4 MiB), evicting the oldest ids. Eviction only ever drops the oldest ids, the least likely to still receive a delayed delta; a re-established item for an evicted id starts from the fragment while its earlier text stays in its own run's progress rows.
Distinct child ids carrying empty-text deltas added cache entries without moving the byte counter, so a long-lived session could grow the map's entry overhead without triggering byte-based eviction. Skip empty deltas (they contribute nothing to the seed) and evict by entry count too (bound at 512), so both byte volume and entry count stay bounded.
The adapter established the commentary item only while a user turn was open, but a child delta arriving during recall (the next run already attached, active still false) was emitted alone, and the projector created a phase-less assistant item that could be selected as the parent run's answer. Establish the commentary item for every child delta when its id has not been seen, active or not: during recall it reaches the run path as commentary, and when no run is attached the projector drops the delta and only upserts the seeded commentary item, which cannot be selected.
Two between-run deltas could still leave a phase-less, answer-eligible item: the first established the id (recording it in childItems), the next window reset cleared the projector items, and a pre-prompt delta skipped the establishment and was emitted alone. While no turn is open, fold each child delta into a single commentary item carrying the accumulated seed instead of emitting a bare delta: the item is never phase-less (so it cannot be selected as the answer) and it carries the stream text (so an evicted id's item holds the fragment, not an empty seed). Root-stream deltas and the active-turn establish-and-merge path are unchanged.
The tests emit items and deltas, which schedule a one-second output flush timer; when the file's afterAll closed the database first, a pending timer fired on the closed connection and surfaced as an intermittent unhandled error (exit 1 despite all tests passing). Close each session so its flush timer is cancelled before the database shuts down.
A delayed delta or assistant message for a child stream whose turn already completed was re-established in the next run with the cached text. The projector recorded it as the next run's progress and its native_items upsert moved the row from the earlier run (misattributing the output and removing it from that run's stored history), and an idle delta could overwrite the saved preview after cache eviction. Ids are harvested at each turn's result into a bounded prior-ids set; any later child event for them is ignored entirely, so a completed stream's native history stays as it was and no child output is ever re-attributed to a later run. New ids in the recall or between-turn window still fold or establish commentary items, so a child fragment can never become a phase-less, answer-eligible item.
…ates Three review findings: the prior-ids set's 4,096 cap let an old id's late event be treated as new and overwrite its completed history (the set is now ids-only and never evicted); a post-prompt delta after recall-window cache eviction re-established an empty item over the retained text (childItems is now kept across prompt so the delta merges into the retained commentary item instead); and a frozen mixed assistant frame dropped its tool update alongside the intended text suppression (only the text item is suppressed; tool_use blocks still emit).
j-asefa
force-pushed
the
loop/child-commentary
branch
from
November 20, 2026 21:13
e155881 to
6978124
Compare
Review of 6978124 found that keeping childItems across prompt() let a child stream folded between runs skip its commentary item after the next dispatch: attaching the run resets the projector window and the folded item has no run, so the post-dispatch delta created a phase-less fragment that was eligible as the answer. prompt() again clears the ids when no turn is open, so the delta re-establishes its seeded commentary item. Trade-off, documented in the adapter: when a stream's seed was evicted (over 512 streams or 4 MiB in one turn cycle) the re-established item carries only the new fragment, so that progress preview loses earlier text. It is never phase-less. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Defect
In
src/adapters/claude.ts, the adapter only filtered child-session output at the turn-endingresultmessage (foreignResultrejects a result carryingparent_tool_use_id). Theassistantbranch emitted{ type: "item", item: { id, kind: "assistant", text } }for any message with text, including Task tool (subagent) session messages; thestream_eventbranch emitteddeltaevents for child streams, usingparent_tool_use_idonly to keep per-stream message ids apart. The Claude adapter never setphaseon an item, so on acompletedstatusprojectOutput(src/server/native/projector.ts) picks the last assistant item with non-empty text whose phase is not"commentary", writes it as the run's answer, andpublishCompletedRunResult(src/server/result-publication.ts) seals it as an immutable Result. A subagent assistant message that is the last text before the parent'sresult(subagent speaks after the parent's final text, or a parent final message with no text) was therefore sealed as the Result body.Fix
In the Claude adapter only:
parent_tool_use_idare emitted withphase: "commentary", so the projector's existing selection rule (i.phase !== "commentary") excludes them. Codex and Muse already use this field the same way.deltaevent carries no phase, and the projector creates a phase-less assistant item from an unknown delta id (projector.ts, theevent.type === "delta"block); if the turn ends before the full childassistantmessage arrives, that phase-less item could be selected. Emitting the commentary item first (keyed by item id, because a stream's id can switch beforemessage_start) makes the projector merge the deltas into a commentary item. This keeps the child's text visible as progress on the run exactly as today — dropping child deltas would hide the child's partial text precisely in the turn-ending case this fix targets.foreignResult, the projector's selection rule and the other adapters are unchanged.Review follow-up (revision 2, commit
62cb94efe)The review team found that the first revision could overwrite saved child text: the projector replaces an item by id, so when a delta's establishing empty commentary item was emitted for an id the projector already held (full child assistant message arrived first, or the id was evicted after 128 others and the stream resumed), the earlier text was lost. Fix:
assistantbranch for child messages remembers the emitted id inchildItems, so a later delta merges into the existing item instead of re-establishing an empty one over it.this.active), so a childmessage_start/delta arriving after the parentresultcannot emit an empty item that clobbers saved native history (the projector drops post-result deltas).childItemsis removed, so a resumed stream cannot hit the overwrite through eviction. The set is bounded per turn and cleared at the turn's result.Added regression
merges a child delta into an earlier child assistant message instead of replacing its text(test/native-activity-ingress.test.ts). Against revision 1 it fails with the finding's symptom — retained text" and more"instead of"Full child text and more"— and passes on revision 2.Review follow-up (revision 3, commit
400ca71ae)The second review found two more concerns:
projectOutput's fallback (projector.ts) readsassistantHistory, whose SQL already excludesphase = 'commentary'(json_extract(item,'$.phase') IS NOT 'commentary'), and the in-memory pass already excluded anything still in the window, so an evicted child item cannot be selected. The JS fallback itself only re-checks "not in memory and nonblank" because the SQL carries the commentary exclusion; I added a comment in the projector recording that invariant. No behavior change.prompt()when no turn is active; mid-turn steering follow-ups keep the set), so a delayed delta re-establishes its commentary item in the fresh window.Added regression
keeps a delayed child stream delta commentary across turn boundaries(test/native-activity-ingress.test.ts). Against revision 2 it fails with the finding's symptom — the retainedchild-crossitem has nophase— and passes on revision 3.Review follow-up (revision 4, commit
ead8891c4)The third review found one confirmed P2 finding:
Child progress can be overwritten across turns. The supervisor attaches the next run before
prompt(); a delayed full child message arriving in that recall window is retained by the projector and its id recorded by the adapter, thenprompt()clears the id set (the revision-3 fix), so a later delta re-established an empty commentary item that replaced the retained text before appending the fragment — progress showed only the trailing fragment. Fixed by keeping the last-known text per child id acrossprompt()(cleared together with the id set at the turn's result, so it stays bounded per turn) and seeding the re-established item with it: the replacement becomes content-identical and the delta appends to the full text.Updated
keeps a delayed child stream delta commentary across turn boundariesto assert the carried-over between-turns text ("Child text two late"instead of" late"), and addeddoes not overwrite a recall-window child message with a later delta's empty item. Both fail on revision 3 with the finding's symptom (retained text" and more"/" late") and pass on revision 4.The recall-window delta (as opposed to full message) while the adapter is still inactive remains an unresolved concern (a phase-less item if the new run has no saved item for that id); the review classified it as a pre-existing gap rather than a regression, and whether a live Claude CLI emits that sequence is unverified.
childItems/childTextgrowth is bounded per turn (cleared at the turn's result).Review follow-up (revision 5, commit
0d9149b5b)The fourth review found two findings:
Full text+A+BbecameFull text B). Fixed by accumulating no-turn (recall/between-turns) deltas into the seed, so a later delta appends to everything seen so far (Full recall text A B).childItemsand their deltas merge), and its total size is byte-capped at 4 MiB (evicting oldest; the projector truncates its own display at a similar scale). Beyond the cap an evicted id's re-establishment degrades to the fragment.The recall-window test now also sends a delta before the prompt; against revision 4 it fails with the finding's symptom (retained text
"Full recall text B") and passes on revision 5. The pre-existing unresolved concerns (recall-window delta while inactive creating a phase-less item — not an introduced regression; attribution of between-runs text to the next run) are unchanged and unverified against a live Claude CLI.Review follow-up (revision 6, commit
85e93651d)The fifth review found two P2 findings:
prompt()clears the id set, a delta for an evicted id re-established with an empty seed, replacing the projector's retained text. A never-evictingchildSeenset now records ids whose commentary item was emitted while no turn was open; a post-prompt delta for an evicted-but-seen id emits only the delta, so the projector merges it into the retained commentary item instead of replacing it.Added
caps a single recall stream's cached seed at the display limitandmerges a post-prompt delta for an evicted recall id instead of re-establishing over it; both fail on revision 5 (200,000-byte cached entry; an establishing item emitted for the evicted id) and pass on revision 6. The unresolved concerns (recall-window delta while inactive — a pre-existing path; between-runs text attribution) are unchanged and unverified against a live Claude CLI.Review follow-up (revision 7, commit
17a21579e)The sixth review found one P2 finding:
Evicted child-stream seeds can be published as the next run's answer. Skipping the establishing item for an id whose recall seed was evicted let a between-turns delta reach the projector alone: the next turn clears the item window, the projector's fallback looks up only the current run's saved item and otherwise creates a phase-less assistant item, and completion could select that child fragment as the answer.
The skip and the seed eviction are mutually incompatible (skip → phase-less selectable; eviction → empty seed erases retained text). Resolved by removing both: the commentary item is now established unconditionally for any active post-prompt child delta (phase is always safe), and the recall seed is never evicted (its text never degrades to empty). Each seed entry stays capped at the projector's display-preview limit (64,000 bytes, tail-kept), so a single long-lived stream cannot grow the cache without bound; memory is bounded per entry and only grows with the distinct child ids seen between turns (the same class the review previously listed as an unresolved concern).
Rewrote the eviction regression as
still establishes a commentary item when a post-prompt delta's recall seed was lost; against revision 6 it fails with the finding's symptom (only the delta emitted — no commentary item, so the fresh window's item would be phase-less) and passes on revision 7. The unresolved concerns (recall-window first delta while the adapter is inactive — a pre-existing path; between-runs text attribution) are unchanged and unverified against a live Claude CLI.Review follow-up (revision 8, commit
d166196ae)The seventh review found one P2 finding:
A delayed child delta can overwrite previously retained child text. Full child messages received during an active turn were not cached, and the result handler cleared the cache, so a delayed delta for that id in the next turn re-established with an empty seed and the projector's run-item upsert replaced the stored child text with the fragment. Now every child assistant message's text is cached (whether a turn is open or not) and kept across the result and prompt, so a re-established item carries the earlier text and the delta appends to it. Entries stay capped at the projector's display-preview limit (64,000 bytes, tail-kept); the entry count tracks the session's distinct child message ids, which the review team already listed as an unresolved concern (live volume unverified).
Added
keeps an active-turn child message's text when a delayed delta arrives in the next turn(no between-turn message, unlike the earlier cross-turn test); against revision 7 it fails with the finding's symptom (retained text" more"— the earlier"Full active text"overwritten) and passes on revision 8. The unresolved concerns (recall-window first delta while the adapter is inactive — a pre-existing path; between-runs text attribution; aggregate cache count) are unchanged and unverified against a live Claude CLI.Review follow-up (revision 9, commit
9c7a961e9)The eighth review found two P2 findings:
AplusBbecameAplusC). The seed is now kept current with every child delta, open turn or not, so a later re-established item carries everything the stream has said so far. Addedkeeps an active-turn child stream's text when a delayed delta arrives in the next turn; against revision 8 it fails with the finding's symptom (retained text"B"— the streamed"A"dropped) and passes on revision 9.native_itemsupsert re-points the row to the current run. This is the direct counterpart of the confirmed revision-7 requirement: preserving the earlier streamed text across a turn boundary requires the next run's item to carry it (reverting to an empty seed re-introduces the review-7 text loss and finding 1 above). Two facts keep the earlier attribution intact: conversation history stores per-run progress rows keyed by(owner_id, run_id, update_key)(messages), so run N's earlier child text remains attributed to run N, andnative_itemsis by design the single latest-state projection per native id. Routing a post-prompt delta back to a prior run's projection would require changing the projector's cross-run storage behavior, which is out of scope per the task constraint.The unresolved concerns (recall-window first delta while the adapter is inactive — a pre-existing path; the session-lifetime aggregate cache count) are unchanged and unverified against a live Claude CLI.
Review follow-up (revision 10, commit
4ed1f5333)The ninth review confirmed one P2 finding:
Child output accumulates for the lifetime of a Claude adapter. The child text cache was never cleared, so a long session that repeatedly uses subagents retained an entry per distinct child message id and could grow server memory until the adapter was disposed. The cache is now byte-capped at the projector's own display-window scale (4 MiB), evicting the oldest ids — which also bounds the entry count (~65 entries at the per-entry cap). Eviction only ever drops the oldest ids, the least likely to still receive a delayed delta; a re-established item for an evicted id starts from the fragment, while its earlier text stays in that id's own run's progress rows (the same reasoning as the revision-9 note on finding 2). Added
bounds the child text cache so a long session cannot accumulate child output; against revision 9 it fails with the finding's symptom (the oldest id still cached, cache unbound) and passes on revision 10.The unresolved concern (recall-window first delta while the adapter is inactive — a pre-existing path, unverified live ordering) is unchanged.
Review follow-up (revision 11, commit
5dfdbdeb9)The tenth review confirmed one P2 finding:
Child text cache can grow without a bound on entries. Eviction relied only on the text-byte counter, so distinct child ids carrying empty-text deltas added entries without moving that counter and a long-lived session could grow the map's entry overhead without eviction. Empty deltas now contribute nothing and do not add a cache entry, and the map is also evicted by entry count (bound at 512 entries, oldest first) alongside the 4 MiB byte bound. Added
bounds the child text cache by entry count even for empty-text streams; against revision 10 it fails with the finding's symptom (600 entries retained, unbounded) and passes on revision 11.The unresolved concerns (recall-window first delta while the adapter is inactive — a pre-existing path; cross-run native-item run_id reassignment by the baseline delta path — unverified as an introduced regression; live ordering) are unchanged.
Review follow-up (revision 12, commit
afafd3e43)The eleventh review surfaced a P1:
A child delta during recall can become the parent run's answer. The adapter established the commentary item only while a user turn was open, but a child delta arriving during recall — the next run already attached,
activestill false — was emitted alone, and the projector created a phase-less assistant item that could be selected as the parent run's answer. The commentary item is now established for every child delta whose id has not been seen this window, active or not: during recall it reaches the run path as commentary, and when no run is attached the projector drops the delta and only upserts the seeded commentary item, which cannot be selected. Addedmarks a delta-only child stream commentary when it arrives during recall; against revision 11 it fails with the finding's symptom (the retained item has nophase) and passes on revision 12.Remaining concerns are documented as unresolved (cross-run native-item run_id reassignment, seed eviction before a late delta, live ordering), not confirmed findings.
Review follow-up (revision 13, commits
b6b0a0e23,5c216b8a7)The twelfth review surfaced a P1 and a P2:
keeps between-run child deltas commentary even across a window reset(and the existingmarks a delta-only child stream commentary when it arrives during recallstill passes); the new test fails on the prior revision with the finding's symptom (phase-less"B"— the first fragment also lost) and passes on revision 13.5c216b8a7closes the native sessions in the new ingress regressions so their one-second output-flush timers are cancelled before the file's database shut down (an intermittent unhandled teardown error — exit 1 despite all tests passing — is gone).Remaining concerns are documented as unresolved (cross-run native-item run_id reassignment, live ordering), not confirmed findings.
Review follow-up (revision 14, commit
e1558818f)The thirteenth review confirmed two P2 findings:
native_itemsupsert changed the row'srun_id, misattributing the output and removing it from the earlier run's stored history.Both are resolved by the same model: a child stream whose turn has completed is frozen. Every child id seen in a turn is harvested into a bounded prior-ids set at that turn's result, and any later delta or assistant message for a prior id is ignored entirely — nothing is emitted, so nothing can be re-attributed to a later run, moved, or overwritten. New ids in the recall or between-turn window still fold or establish commentary items, so a child fragment can never become a phase-less, answer-eligible item.
The three cross-turn regressions now assert the frozen behavior (
ignores late child events for a stream whose turn already completed, plus the two active-turn tests) — each fails on the prior revision (the old adapter re-emitted the items) and passes on revision 14. The remaining recall/new-id tests are unchanged and green.Remaining concerns are documented as unresolved (an unverified no-
message_startdelta resolving to a fresh id, live ordering), not confirmed findings.Review follow-up (revisions 15 and 16, commits
69781245d,c18012904, rebased on main87525aed0)The fourteenth review (head
e1558818f) found three P2s. Revision 15 (69781245d) addressed them: completed child ids are kept for the adapter's lifetime (the 4,096 cap let an evicted id's late event overwrite completed history); a frozen child's mixed assistant frame still emits itstool_useblocks and suppresses only the text; and child ids were kept acrossprompt().The fifteenth review (head
69781245d) found that keeping child ids acrossprompt()was a High regression of this PR's own defect. A child stream folded between runs has no run, the next run's attach resets the projector window, and a post-dispatch delta then skipped its commentary item, so the projector created a phase-less fragment that could be selected as the answer. Revision 16 (c18012904) restores clearing the ids at a new user turn. Addedre-establishes a between-run child stream as commentary after the next prompt; against69781245dit fails with the finding's symptom (retained item{ text: "B" }with nophase) and passes onc18012904.The sixteenth review (head
c18012904) had no P1 and no security finding. Its findings are documented, not fixed, because each one reverses an earlier fix:keeps a post-prompt delta commentary even when its recall seed was evicted. Keeping ids acrossprompt()to avoid it is the High regression above. Making the cache unbounded was rejected in review 5. The item is never phase-less, so the answer is unaffected.message_start. The result clears the stream-to-message mapping, so such a delta falls back to the envelope id and bypasses the completed-child guard. This was already listed as unresolved. Whether the Claude CLI emits that ordering is unverified.Tests (fixture coverage)
Added regressions at the changed boundary:
test/native-activity-ingress.test.ts(adapter→projector ingress, following the existing Claude usage case): a child assistant message is retained asphase: "commentary"while parent items keep their exact shape; a child stream's first delta is preceded by a commentary item with the same id, so a turn ending on the child stream selects nothing; and the delta-after-full-message merge (above).test/native-turn-recovery.test.ts(full worker + fake CLI, following the existing Claude recovery case).test/fixtures/harness.mjsnow emits child assistant output between the parent's final assistant message and the parentresult, driven byLOOP_TEST_CLAUDE_CHILD_TEXT,LOOP_TEST_CLAUDE_CHILD_DELTA_ONLYandLOOP_TEST_CLAUDE_PARENT_BLANK:result: the run's answer and the sealed Result body are the parent's text ("Fixture done").assistantmessage before the parentresult: the child text is not the answer; the run's answer is the parent's text."") and no Result is sealed (publishCompletedRunResultreturns null) — nothing is eligible.messages.update_key = 'native-message:child-1',metadata.progress = true)."Fixture done").Confirmed cases 1–3 (plus the ingress phase tests) fail on main before this change. I reverted
src/adapters/claude.tsand re-ran the new tests; the failures were the defect itself:result: "Subagent result text"instead of"Fixture done"(child assistant text sealed)result: "Subagent stream text"instead of"Fixture done"(child deltas sealed)result: "Only the subagent speaks"instead of""phase: "commentary".Verification
Submitted tips:
abe4e1218(initial fix),62cb94efe(review 1),400ca71ae(review 2),ead8891c4(review 3),0d9149b5b(review 4),85e93651d(review 5),17a21579e(review 6),d166196ae(review 7),9c7a961e9(review 8),4ed1f5333(review 9),5dfdbdeb9(review 10),afafd3e43(review 11),b6b0a0e23/5c216b8a7(review 12),e1558818f(review 13),69781245d(review 14, rebased on main87525aed0),c18012904(review 15). The table below was run on thee1558818ftree; the runs on69781245dandc18012904are listed after it.npm run checkcheck: all passed(prettier/format, typecheck, openapi, sql-index, contracts; latest run 149.9s)npm test -- --shard=1/3 --maxWorkers=1 --testTimeout=30000npm test -- --shard=2/3 --maxWorkers=1 --testTimeout=30000npm test -- --shard=3/3 --maxWorkers=1 --testTimeout=30000npm run test:nativetest/adapters.node.test.tsexercising the changed fixture)Runs on the rebased revisions:
69781245dnpm run checkcheck: all passed69781245dnpm test -- --shard=1/3 --maxWorkers=2 --testTimeout=3000069781245dnpx vitest run test/review-snapshot-load.test.tse1558818fhad timed out on this test at 5 s; this PR does not touch it)69781245dc18012904npm run checkcheck: all passedc18012904npx vitest runon the 15test/native*.test.tsvitest filesc18012904check,tests (1-3))npm run test:nativewas not rerun onc18012904; it was stopped by my time limit under host load. The fixture harness is unchanged sincee1558818f, where it passed.Host note: the shared host periodically creates a stray empty
/tmp/.gitthat trips Git-walk tests (guarded), andtest/library-route-contracts.test.tshas a pre-existing exact-ended_attiming flake; both are unrelated to this change. The shards above ran with the guard and exited 0 with no errors.Each shard also passed on the revision-1 tree earlier; the only failed shard attempts on this host were caused by a shared-host artifact (see below), not by the change.
These are fixture results; I did not run a live Claude Code session, so real CLI orderings of child-session messages remain unverified.
Host note (pre-existing, unrelated to this change): a live Loop workspace running on this host periodically creates an empty
/tmp/.gitdirectory, which makes the Git ancestor-walk inagent-worktree/harness-routing/native-workspaces/fleet-enrollmenttests throw "Could not verify the project's Git status" while it exists. I removed it before each clean run (all shards green above); CI will not have this artifact.Known limitation
Already-sealed Results that may contain subagent text (sealed before this fix) are not rewritten, re-sealed or backfilled; they stay as they are, per the constraint. No prompt or turn was replayed.
Other adapters
Reviewed for the same defect: Codex passes through the harness-provided
phase(phase: item.phase); Muse mapsmessagePhasetocommentary/final_answerand emits subagent items askind: "tool"; Pi, OpenCode, Antigravity (including headless) and the ACP/Grok adapters have no child-session marker comparable to Claude'sparent_tool_use_id— Antigravity headless marks the successful responsefinal_answer. No same defect found; no other adapter changed.docs/harnesses.md
No note added: that guide does not describe how the answer is chosen per harness (it only states that a final reply is published after the harness confirms completion), so there is nothing to update.
Canonical example followed: none: this is a native-adapter ingress fix with fixture regressions; the AGENTS.md index maps state-machine, route, SQL and external-effect recipes, none of which this change touches.