Repository navigation
fix(codex): read subagent parent and compaction phase where they live - #4718
Merged
Merged
Conversation
Two Codex parser reads target shapes the wire does not produce. The subagent parent link was gated on forked_from_id, which only 545 of 3,083 real spawn sessions carry. 2,538 name the parent solely under source.subagent.thread_spawn.parent_thread_id, so they ingested with no parent, no topology edge and no branch type. Fall back to the spawn block and then to a top-level parent_thread_id. The replacement-history phase counter read `phase` from each content item, where it never appears; Codex puts it on the history entry. The counter was absent from all 18,561 real compaction events. The fixtures covering both paths asserted the shapes the code expected rather than the shapes Codex emits, which is why they passed. Reshaped onto observed wire shapes and added the thread-spawn-only majority case. Refs: polylogue-zc11x, polylogue-4x49r Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sinity
enabled auto-merge (squash)
September 6, 2026 00:01
Sinity
added a commit
that referenced
this pull request
Sep 22, 2026
…#5417) ## Summary `devtools verify` ended its output with a gate's `ok` line whether it passed or failed, so `devtools verify | tail` reported **tail's exit 0** whatever the gates found. Salvaged from `fix/test-verify-reds`, a two-week-old branch whose other five defects all turned out to be superseded. ## Problem Measured at base `74e1aa3d0`: the last line of a green `verify --quick` is ``` gate population-coverage ... ok (1.3s) ``` and a **failing** run ends identically. The verdict lived only in the exit status, which a pipeline discards. `#4718` gave the last-line verdict contract to `devtools test` (`run_tests.py:681`) but never to `devtools verify`, whose `_main` ended at `_emit(payload, ...)`. This is the hazard the environment contract already names — *read command exit status directly; a pipeline's final status does not prove an earlier check passed* — with no way to comply short of not piping. ## Solution `_write_verdict_line`, called from `_emit`, covering all four terminal paths: completion, checkout-import mismatch, affected-admission refusal, and interruption. Written to **stderr**, so the `--json` stdout contract stays exactly one document. A green run's absent diagnosis is **omitted** rather than reported as `diagnosis=unknown` — an absent determination is not a failed one. Live production output at the branch tip: ``` verify: PASSED exit=0 receipt=.cache/verify/runs/20260922T130618Z-quick-1977478-53268ffe/run.json ``` `TESTING.md:146` is corrected; it claimed the last-line-verdict contract for `devtools test` alone. ## Anti-vacuity — four mutations, each executed and restored 1. **delete the write entirely** → `assert 'gate populat...... ok (1.3s)' == 'verify: FAIL...0922/run.json'`, plus two `IndexError: list index out of range` because stderr was empty. That is the defect itself: a run that exited 1 whose last line is a gate's `ok`. 2. **guard with `if exit_code:`** so only failures speak → exactly 1 red, `test_a_passing_run_states_its_verdict_too`. The failing case stayed green, so red/green separates on the named axis and a failure-only verdict cannot pass. 3. **write to `sys.stdout`** → `json.decoder.JSONDecodeError: Extra data: line 3 column 1` — the prose landed after the document, exactly as the contract test names. 4. **restore `payload.get("diagnosis") or "unknown"`** → exactly 1 red: `+ verify: PASSED exit=0 diagnosis=unknown receipt=...`. The failing case, which has a real diagnosis, stayed green — so the test pins the absence-vs-unknown distinction, not merely the presence of a line. ## Verification - **Inherited-red baseline** at base `74e1aa3d0` before any edit: `devtools verify --quick` exit 0, 25 gates all ok, zero FAILED. Nothing to attribute. - `devtools verify --quick` at the tip: exit 0, 25 gates, gate set **byte-identical to the base run** (diffed). - `devtools render all --check`: exit 0, `grep -c 'out of sync'` = **0** — checked explicitly, since this command can print per-surface `sync OK` and still exit 1. - `devtools test` over `test_verify.py`, `test_run_tests.py`, `test_pytest_invocation.py`: exit 0, **111 passed**, selected 111 / terminal 111. - **Schema closure**: both changed files `out`. Identity measured directly on both trees, not inferred — `index=5274c9cc…`, `ops=86866235…`, **identical**. Unlike several PRs today, this one carries no rebuild-boundary constraint. ## The other five defects on that branch were superseded Reported rather than landed: - the rerun report path — landed as `pytest_rerun.py:72 _path_for_receipt`, identical remedy - the venv diagnosis expectation — head is already parametrized `[(False, "gate_unprovisioned_environment"), (True, "gate_missing_executable")]` - the pueue task-id identity hazard — closed by a *different, better* mechanism: the pueue route is gone, replaced by `agentctl job start` with a durable job id and a per-pid result file the runner unlinks first - the testmon expectation — head carries the branch's exact assertions - **`current-pytest-summary.json` — decided the opposite way on purpose.** `#4718` closed the same bead choosing "stop naming it" over "write it"; `run_tests.py:675` states *"The receipt is this run's own file, never a `current-*` name a concurrent run in the same checkout would overwrite."* Reviving the branch would have regressed a landed adjudication. ## Residual `devtools verify`'s agent-tier refusal (`verify.py:894-912`) returns 2 before any `VerifyRun` exists and still ends in its own prose refusal rather than a `verify:` line. That is a refusal *before* a run, not a run with a lost verdict, so it is left alone; if one sentence shape is wanted for every exit, that path is the remaining gap. Separately, `tests/unit/storage/test_index_generation.py:305` still says *"which later blocks archive-root relocation"*, describing a mechanism `#5086` deleted. It is the only surviving reference in the tracked tree — a one-line follow-up owed by that change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
Summary
Two Codex parser reads target shapes the wire does not produce. Both are silent
losses that a rebuild would mint permanently.
Problem
Subagent parent (polylogue-zc11x). Lineage assignment was gated on
forked_from_id. Of 3,083 real subagent sessions only 545 carry that field;2,538 name the parent solely under
source.subagent.thread_spawn.parent_thread_id. The parser computed thesubagent-spawn flag from that block but never read the parent out of it, so the
branch was skipped and the flag discarded. Those sessions ingested as orphans —
no parent, no topology edge, no branch type, no branch point.
Compaction phase (polylogue-4x49r). The replacement-history phase counter
read
phasefrom each content item. Codex putsphaseon the history entry;content items are exactly
{text,type}or{image_url,type}. Across a600-file sample: 227,576 content items, zero carrying
phase; 27,015 entriescarrying it. The counter was absent from all 18,561 real compaction events.
Both paths had passing tests. Each fixture asserted the shape the code expected
rather than the shape Codex emits — the lineage fixture supplied both carriers
(the 17.7% minority), the compaction fixture invented
phaseone level down.Solution
Read the parent from whichever carrier is present:
forked_from_id, thenthread_spawn.parent_thread_id, then a top-levelparent_thread_id. Readphasefrom the history entry.Fixtures reshaped onto observed wire shapes, with the thread-spawn-only
majority case and the top-level-
parent_thread_idcase added.Precedence is safe to order arbitrarily: across 1,497 first
session_metarecords the carriers never disagree (1,076 spawn, 206 fork, 0 conflicts) and no
session names itself as parent, so the fallback introduces no topology
self-loop.
Verification
devtools verify --quickon the merged tree: all 14 gates ok, exit 0, noout of sync.The bead's own reproduction now resolves:
parent= parent-2 branch= subagentwhere it previously printed
parent= None branch= None.The focused pytest run did not execute. The host's pytest slot was starved --
one task held it for 35+ minutes with 14 lanes queued behind it -- so
devtools test tests/unit/sources/test_parsers_codex.pynever started. Thismerges on static gates plus the reproduction above, as a deliberate call under
quota pressure, not because test evidence was obtained.
Anti-vacuity conditions are named but not executed -- verifying them needs
the same starved slot. Reverting the
spawn_parent_thread_idfallback shouldredden
test_subagent_thread_spawn_alone_sets_subagent_parent(parent becomesNone); reverting
meta_parent_thread_idshould reddentest_top_level_parent_thread_id_sets_parent; moving thephaseread back tothe content item should empty
replacement_history_phase_countsand reddentest_compacted_replacement_history_aggregates_phase_and_ghost_commit. Eachnew test fails against unpatched parser code by construction, since each
asserts a value the old code could not produce.
Residuals
polylogue-vtyud (the ~1.34 GB
item_completedexec-evidence drop) is not inthis PR. Its stated mechanism — pair
payload.itemto the adjacentcustom_tool_call_output— does not hold:item.idisexec-<uuid>andshares no id space with
call_id, and 518 of 2,067 CommandExecution items haveno positionally-following output (480 are back-to-back parallel execs). That
needs a pairing decision before implementation.
polylogue-amks7 (broader fixture reshaping) is untouched beyond the two
fixtures these fixes required.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid