fix(server): preserve native Codex subagent lifecycle in v2 - #11996
lnieuwenhuis wants to merge 3 commits into
Conversation
|
Macroscope has since reviewed this pull request. An earlier review was skipped by a cost limit; a review has now completed, so that notice no longer applies. |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a contained Codex adapter bug fix that corrects native subagent status and lifecycle projection, including idle-retention behavior. The changes add no schema or deployment surface and include broad replay coverage for status and event-order cases. You can add or adjust custom eligibility rules. Learn more. |
f63b335 to
08a1b86
Compare
There was a problem hiding this comment.
All clear
Posted via Macroscope — Effect Service Conventions
bbe3dd9 to
01c2162
Compare
a1f8051 to
0337dd6
Compare
6603dbc to
7630e9e
Compare
|
Rebased this PR onto the current What changed on the branch
Verified
Left for you / a maintainer
Rebased and touched up by a maintainer's agent; a human will re-review. |
| for (const [nativeStatus, expectedStatus, terminal] of [ | ||
| ["pendingInit", "pending", false], | ||
| ["running", "running", false], | ||
| ["interrupted", "interrupted", true], | ||
| ["completed", "completed", true], | ||
| ["errored", "failed", true], | ||
| ["shutdown", "cancelled", true], | ||
| ["notFound", "failed", true], | ||
| ] as const) { | ||
| for (const nativeTurnStarted of [false, true]) { | ||
| it.effect( |
| for (const childStartsFirst of [false, true]) { | ||
| it.effect( |
|
Superseded by merged PR #12974, which includes the Codex V2 native subagent-status lifecycle fixes and broader settlement/reopen handling. Closing this older implementation. |
Codex collaboration events use native statuses that the V2 adapter was treating as
running, leaving interrupted, shut-down, and missing children active and initializing children incorrectly marked as executing.Map all seven native statuses explicitly. Keep initializing children protected from idle release and promote them on their first native turn, including when the child start arrives before its spawn snapshot. Settle both registration execution nodes for children that terminate before their first native turn; native-turn events retain ownership once execution starts.
Targets
t3code/codex-turn-mappingfor #2829. Refs #11164. #11608 addresses the separate client-runtime path onmain; this fixes the V2 provider adapter.Validation: 91 adapter replay tests pass, including regressions observed failing before the fix; scoped server typecheck and targeted lint/format pass. Independent adversarial reviews found lifecycle gaps that were fixed with regression coverage. A subsequent Macroscope finding about children terminating before their first native turn was reproduced and fixed; a fresh adversarial review of that fix reported no findings. Changed files pass the secrets scan. No live-provider verification.
The repository scanner config retains default rules and exempts only the exact synthetic
idempotencyKeyfixture inpackages/effect-codex-app-server/src/protocol.test.ts, which otherwise flags twice in the inherited V2 history. Negative controls confirm other values, keys, paths, and credential rules remain detected.Implemented with GPT-6 Astra via Codex.