Repository navigation
fix(plugins): show acquisition owners in reload timeout logs - #183995
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
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. |
|
Codex review: needs maintainer review before merge. What this changesPreserve captured acquisition owners in structured plugin-reload logs and emit drain-timeout diagnostics at warning level. Example: Plugin fixture retains work attributed to run private-run and service private-service when its 60-second replacement drain expires.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR provides a useful, narrowly scoped diagnostic correction that current main still needs; no actionable correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway reload cleanup owner observes live plugin references while replacement waits, then sends bounded snapshots through the existing file, console, and diagnostic logging transports. flowchart TD
A[Plugin acquisitions] --> B[Instance reference diagnostics]
B --> C[Gateway reload drain]
C --> D[Subsystem logger]
D --> E[Raw file records]
D --> F[Redacted console and exports]
E --> G[Redacted log tail and support bundles]
Technical reviewBest possible solution: Keep this correction in the existing reload logger while preserving admitted-work lifetimes and shared egress redaction. Do we have a high-confidence way to reproduce the issue? Current main explicitly replaces captured owners with unknown in reload snapshots; source inspection establishes that diagnostic path, and the PR reports matching Gateway reproduction without reviewer execution. Is this the best way to solve the issue? This is the smallest complete correction: preserve the existing bounded snapshot as structured metadata and use WARN where plain console transports render that metadata. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 367b4fa493e2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests +61, Docs +8. Total +70 across 3 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 25, 2026, 8:41 PM ET / October 26, 2026, 00:41 UTC. |
What Problem This Solves
Plugin replacement timeout logs report acquisition owners as
unknowneven when the retained reference already records its run and service. This makes long-turn reload failures difficult to attribute.User Impact
Operators can identify the captured acquisition owner from the raw log and the timeout warning. This is the diagnostics fix only: replacement still waits for admitted work, and a long turn can still exhaust the 60-second drain budget.
Why This Change Was Made
Keep the bounded snapshots as structured log fields instead of discarding owner facts and embedding JSON in the message. Timeout records use WARN so plain console/journal output includes structured diagnostics; queued observations remain INFO. Existing egress redactors protect secret-shaped values, and support-bundle export omits the nested references. No new redaction policy, state, cache, or lifecycle mechanism is introduced.
The reproduction found three nested generation leases for a dispatched parent turn and two for its native subagent. These are executable-generation holds, not preparation-only holds: both turns invoke the plugin's tools and end hooks after a 100-second provider wait. Releasing them after preparation would break admitted work. Concurrent replacement also needs a separate resource-ownership contract: the documented lifecycle disposes an old registration before its successor registers. This PR preserves that contract.
Evidence
config.patchreturnedUNAVAILABLEafter 60.70 seconds while both provider turns remained active for 100 seconds. Both turns then used the original generation successfully; the saved configuration applied afterward and the replacement instance had zero retained references. The warmed-sessiontools.effectivecall returned in 225 ms, so its reported secondary stall was not reproduced.config.patchstill returnedUNAVAILABLEafter 60.30 seconds; both 100-second turns completed with their original prompt hooks, tools, and end hooks. The saved configuration then applied and the replacement had zero references. The raw timeout is now WARN with captured run/service owners, and the console warning includes those fields. A genuinely unowned acquisition remainsunknown. Both isolated Gateways stopped cleanly. These single runs establish functional behavior, not a performance comparison.node scripts/run-vitest.mjs src/gateway/server-plugin-reload.retention.test.ts --maxWorkers=1fails 2/2 on the baseline'sowner: "unknown"output and passes 2/2 with this change (57 ms test execution; 27.30 s wrapper wall time). It exercises raw file logging, log tail, compact console, support sanitization, and diagnostic-event export, plus release/timeout semantics.node scripts/run-vitest.mjs src/plugins/plugin-instance.retention.test.ts src/plugins/plugin-retention-diagnostics.test.ts --maxWorkers=1: 17 passed, 70.34 s wrapper wall time.git diff --checkpassed.45badf43c32a1e2ecef149d4ac56e321b46f0347: 33 successful jobs, including changed tests, type checks, lint, docs, architecture guards, and all three PostgreSQL conformance shards. No rerun was needed.Production LOC: +1 (6 additions, 5 deletions); the added line carries structured diagnostics through the existing logger. This is a cold-path diagnostic correction, with no CPU/allocation improvement claim. Owner microbenchmarks and whole-Gateway performance stress are not used as evidence for it.