feat(continuation): #354 codex P1 fixes β retry-drain-widen + chain-state-persistence-fail#359
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The mock at server-restart-sentinel.test.ts:108 used a zero-arg
`vi.fn(async () => ({...}))` lambda which locked TS to a
`() => Promise<...>` signature. The .mockImplementationOnce at line 294
then could not pass an opts param.
Type the vi.fn declaration to the full
RecoverPendingSessionDeliveriesParams shape via Parameters<typeof ...>[0]
so .mockImplementationOnce arg-shape stops getting rejected.
When the post-compaction delegate dispatch logic was extracted from agent-runner.ts (cdc9b6e), the slice that enforced maxDelegatesPerTurn (and accounted for any bracket-style delegate already spawned this turn via bracketDelegateOffset) was dropped. The new path mapped over the full persisted+staged list, so a turn could exceed the configured per-turn delegate budget. Caught by codex review on PR #354 (r3144284490) and byte-confirmed by π» / π. Restoration mirrors the pre-extraction behavior at src/auto-reply/reply/agent-runner.ts pre-cdc9b6ecd54: bracketDelegateOffset = continuationSignalKind === "delegate" ? 1 : 0 compactionBudget = max(0, maxDelegatesPerTurn - bracketDelegateOffset) released = allCompactionDelegates.slice(0, compactionBudget) resolveContinuationRuntimeConfig is now a dispatch dep so tests can inject runtime configs without process-wide loadConfig calls. Adds three regression tests: cap drops overflow, bracket offset reduces budget by one, zero-budget edge case enqueues nothing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b5aef7b17
βΉοΈ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (result === "spawned") { | ||
| deliveredDelegates += 1; | ||
| } |
There was a problem hiding this comment.
Include rejected delegates in dropped lifecycle accounting
This drain path only increments deliveredDelegates when a queued delegate is spawned, but it never tracks terminal "rejected" outcomes (for example, chain-length or cost-cap rejections). Because the lifecycle event later uses the precomputed droppedCompactionDelegates, those rejected delegates are acknowledged and removed from the queue without being counted as dropped, so operators can see Released 0 ... with no corresponding dropped count even though delegates were definitively not released.
Useful? React with πΒ / π.
Closing as superseded by #354 (
|
Summary
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
Regression Test Plan (if applicable)
User-visible / Behavior Changes
Operators should see post-compaction delegate retries recover during later drain cycles instead of waiting for restart, and lifecycle release counts no longer include queued-but-not-accepted delegate deliveries.
Diagram (if applicable)
Security Impact (required)
Repro + Verification
Environment
Steps
Expected
Actual
Evidence
Human Verification (required)
Review Conversations
Compatibility / Migration
Risks and Mitigations