Repository navigation
fix: P0 #5369 spill growth + P1 bug batch (#5421, #5008, #4191, #3522, #4779, #3661) - #5825
Conversation
…ng replay (#5421) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… and preserve reasoning on v4-pro (#5421) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The only orphan GC pass ran once inside ensureLoaded(), so orphans created while the process kept running — crash leftovers, failed best-effort unlinks, stubs the snapshot budget cut — survived until the next restart. sweepOrphanedResponseSpills now rides the responses-continuation liveness tick alongside the abandoned-temp sweep. Its referenced set covers live spill stubs, pendingSpillUnlinks, and every queued/in-flight publication name from the spill queue, and it runs under tighter periodic bounds (scan 512 / cleanup 64 / 25 ms deadline) since the tick is synchronous on the serving event loop. It is a no-op before the lazy load runs. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…-home Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…all turn (#5008) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
#5008) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Regression coverage for a read-only inspector over responses-state-spill: totals vs store-owned vs orphan candidates past the orphan grace, report/ reclaim agreement, scan-cap truncation, and the snapshot-ownership path a separate doctor process relies on. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Operators cannot tell owned spill bytes from orphaned ones on disk. inspectResponseSpillDir walks responses-state-spill with the same name/ stat orphan predicate as recoverOrphanedResponseSpills — extracted into shared helpers so the report and the unlink cannot disagree — and counts totals, store-owned files, and orphan candidates past the grace window without ever unlinking. inspectResponseSpillStorage supplies the referenced set as the union of live spill stubs, pending unlinks, and names the persisted snapshot still references, so a separate doctor process sees the same ownership a restart would. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
ocx doctor gains a "Response-state spill files" section via formatResponseSpillLines: totals on disk, bytes still owned by the store or persisted snapshot, and orphan candidates past the grace window — report only, never unlink. /api/system/memory gains a scalar-only responseSpill sibling of the pinned responseState block with the same counts. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Explain what responses-state-spill/ holds, its three bounds (1 GiB payloads, 1000 entries, 24h TTL), why a restart re-owns every referenced file, and that the orphan reclaim handles unreferenced leftovers — so operators should not delete spill files by hand. Points at the new "Response-state spill files" section in ocx doctor and the responseSpill block on /api/system/memory for the owned-vs-orphan split. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…aim and doctor (#5369) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…stage record (#4191) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… the WS stage record (#4191) The stage record could already tell a silent socket from one that carried only quota control frames, but send->first-frame is measured on ANY inbound frame: a peer that answers quota metadata then stalls on the turn itself reads identically to one that answered and started immediately. The reporter's remaining unmeasured axis is the wait for the first real Responses event (response.created and friends). firstResponseMs is stamped on the first non-control response.*/error frame the relay observes, feeds the failure message suffix and the durable stage record, and survives the usage-log drop-guard like its sibling durations. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…drate (#4191) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ured (#4191) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Cover the consumed stable-directory timeout memo: after the re-arm window the spill queue's caller-owned retry must get one bounded recovery attempt, and a still-stalled runner must get at most one bounded probe per window instead of instant refusals forever. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…et window (#3522) Once the spill directory's "required:<dir>" timeout memo was consumed, retryTimedOutOnce callers were refused forever: the memo only clears on a successful harden, which the refusal makes unreachable. On Windows a single stalled icacls then bricked every continuation spill write for the life of the process -- successes froze, write failures accumulated, and readiness stayed healthy (2.39.0 incident signature). A consumed memo now re-arms after TIMEOUT_MEMO_REARM_MS (5min) of quiet -- strictly above the per-harden deadline cap so a stalled run produces at most one bounded probe per window, and only for callers carrying retryTimedOutOnce. Flagless callers keep the instant refusal; a successful harden still deletes the memo outright. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ntial UAC (#4779) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…uler payloads (#4779) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…or the elevated-stage shape (#4779) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… recovery (#3661) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ransient upstream failures (#3661) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…apshot budget Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… the bounded snapshot Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… before residents Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
inspectResponseSpillStorage reads the snapshot and walks the spill directory synchronously; reuse one result per 30 s window instead of rescanning per request. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…E shapes on the async path (#4779) Mirrors the synchronous hardenEntry guard so an async caller of the elevated staging shape cannot accept an owner-only ACL as already compliant. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
리뷰 반영했습니다 (최신 push):
|
|
Maintainer triage: Criteria (P0): Critical: security/credential exposure, auth bypass, data loss, or unbounded resource growth on a running hub; no workaround. Related issues:
|
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. |
…en across ticks (#5369) The offset cursor re-skipped from a fresh opendir each tick, and that skip spent the 25 ms deadline, so a slow enumeration left scanned=0 and pinned the cursor at the same prefix forever. Hold the real iterator instead, never read a name the tick will not process, and drop it at EOF, on an iteration error, or when the spill directory changes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Zero orphans in the first RESPONSE_SPILL_SCAN_MAX entries says nothing about the unscanned tail; warn instead of printing the ok line and swallowing the truncation notice. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…covery deadline (#3661) The retry helper clamped Retry-After to the 2 s backoff cap, so a Retry-After: 30 resent after 2 s. Pass retryAfterIsLowerBound and end with the current failure when the required wait would outlive the shared recovery deadline. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 255b9e0a2d
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| firstResponseAt ??= Date.now(); | ||
| try { | ||
| if (nativeControl) steeringEnded = nativeControl.observe(normalized.payload); | ||
| else correlation?.accept(normalized.payload); |
There was a problem hiding this comment.
Record first-response time only after correlation succeeds
On a reused Codex WebSocket session, a foreign or mismatched response.* frame sets firstResponseAt before correlation.accept() or nativeControl.observe() rejects it. The resulting non-replayable 502 and persisted usage record therefore report a non-null first-response duration even though no event for this turn was accepted or relayed, undermining the diagnostic distinction this field was added to provide. Set the timestamp only after correlation validation returns successfully.
Useful? React with 👍 / 👎.
Summary
This PR combines the P0 fix and the P1 bug fixes. Each child worker's result was reviewed before it was added, and every issue keeps its own focused commits.
P0 #5369:
responses-state-spill/grows without boundsweepOrphanedResponseSpills()now runs on theresponses-continuationliveness tick. It is bounded (PERIODIC_SPILL_SWEEP_OPTS = {scanMax: 512, cleanupMax: 64, deadlineMs: 25}), keeps the 15-minute grace period, and does nothing until the store has loaded.spillstubs,pendingSpillUnlinks, and queued or in-flight publication names (spillQueueReferencedSpillFileNames(): superseded spill, temp, destination).ensureLoaded(), so a long-running hub never reclaimed them.writeBoundedSnapshotnow picks bounded stubs and tombstones before resident entries. Previously the newest-first resident cohort could use the whole 24 MiB budget, drop spill stubs, and leave their files orphaned after a restart.inspectResponseSpillDir()/inspectResponseSpillStorage()share one orphan predicate and one directory scan with the reclaim, so they always agree with it. Results appear inocx doctor("Response-state spill files") and in theresponseSpillfield of/api/system/memory. There is a new troubleshooting doc section.ownedSpillFileNames()reference set is shared by the load-time GC, the periodic sweep and the inspector.P1 #5421: DeepSeek
reasoning_textHTTP 400. On the Responses wire,sanitizeReasoningInputContent({ requirePlaintextReasoning })now fills inreasoning_textfromsummary_text, or uses" "if there is none. This applies only to providers whererequiresPlaintextReasoningReplayis true.deepseek-v4-prois added topreserveReasoningContentModels.P1 #5008: Antigravity 400 when a request opens with a function call. When compaction leaves a
modelturn containingfunctionCallat index 0,messagesToGeminiFormatnow puts{role:"user", parts:[{text:"(continue)"}]}in front of it.P1 #4191: diagnosing a dead Codex WebSocket. Adds
firstResponseMs(time from send to the first non-controlresponse.*orerrorframe) to the WS stage record and the failure detail (first-response=). Usage-log records written before this field existed still load, with the field set tonull. The worker's version would have dropped them, so a fix and a test were added for that.P1 #3522: Windows spill failures pile up while readiness reports healthy. Once the
windows-secret-acltimeout memo had used its one recovery attempt, it refused every later harden for the stable spill directory. That broke durable publication for the rest of the process's life. The memo now re-arms afterTIMEOUT_MEMO_REARM_MS(5 min), and only for callers that passretryTimedOutOnce. Callers without the flag are still refused immediately.P1 #4779: Task Scheduler staging unreadable under an alternate-credential UAC prompt. New
hardenElevatedStagePath/Dirgive the owner full control and give read-only access to SYSTEM and BUILTIN\Administrators. They are used only for the elevated scheduler staging payloads, which are integrity-checked with SHA-256. Secret call sites keep owner-only ACLs, and the two shapes have separate memo caches. The owner-only "already compliant" shortcut is also skipped for the staging shape.P1 #3661:
unreadable_encrypted_agent_task. Adds an opt-inagentTaskRecovery.retriessetting (0–2, default 0) that retries recovery only on transient 5xx or transport errors. Retries share the caller's deadline, admission and cache flight. Default behaviour is unchanged.No code change (findings only):
devby the test-harness changes.Verification
bun run typecheck,bun run privacy:scan,bun run structure:check: all pass.(cd docs-site && bun run build): 505 pages built.bun test tests/responses/: 3146 pass, 0 fail.bun test tests/windows/ tests/server/agent-task-recovery.test.ts tests/server/config.test.ts: 722 pass, 0 fail.bun test tests/adapters/google/: 655 pass, 1 fail (google-models-listingbearer token). That file passes on its own (14/14), so this looks like shared state between parallel test files.bun run test:changed: 25649 pass, 26 fail. All 26 failures are in 9 files (service claim/ownership/sqlite-home/WSL/service, native codex/grok toggle, reserve-catalog-lifecycle, replay-refusal-parity). Each of those files passes when run on its own, which points to shared-home contention between parallel test files; none of them touch the code changed here.Checklist
windows-secret-acl.tsis listed in MAINTAINERS.md as needing explicit security review; please give the [Bug][Windows]: elevated Task Scheduler staging is unreadable under alternate-credential UAC #4779 and [Bug][Windows] Continuation spill failures accumulate behind healthy readiness after #3011 (observed on 2.39.0) #3522 changes that review.Link to Devin session: https://app.devin.ai/sessions/c3784bc025a148d3bf396fe4623542cb
Open in Devin Desktop: https://app.devin.ai/desktop/session/c3784bc025a148d3bf396fe4623542cb?variant=devin
Maintainer regression verification
src/lib/windows-secret-acl.ts/windows-ops.ts([Bug][Windows]: elevated Task Scheduler staging is unreadable under alternate-credential UAC #4779, [Bug][Windows] Continuation spill failures accumulate behind healthy readiness after #3011 (observed on 2.39.0) #3522): the elevated-stage shape is a separate export used only by the non-secret, SHA-256-verified scheduler staging payloads. It grants read and never write to SYSTEM and Administrators, and the secret call sites still get the owner-only ACL. The timeout-memo re-arm applies only toretryTimedOutOncecallers. Appliedmaintainer-sponsored.tests/responses/ tests/windows/ tests/providers/ tests/adapters/google/ tests/usage/+ touched server/doctor/watchdog tests) were run on the PR head and on thedevtip: PR 10679 pass / 38 fail, dev 10629 pass / 38 fail, with an identical failure set (kiro/xAI/account-pool shared-state, andprotocol-direct-encoders-chatstall watchdog). No regressions; the PR adds 50 passing tests.test 1/4/macos 1/2failure (stall watchdog fails the turn like the bridge) reproduces on thedevtip too. This PR did not cause it.Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.