Skip to content

fix(plugins): show acquisition owners in reload timeout logs - #183995

Merged
steipete merged 1 commit into
mainfrom
steipete/fix-plugin-replacement-drain-in-place-20261025
Oct 26, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/fix-plugin-replacement-drain-in-place-20261025

Conversation

@steipete

@steipete steipete commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Plugin replacement timeout logs report acquisition owners as unknown even 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

  • Isolated built Gateway, synthetic prompt hook/tool/end-hook plugin, native subagent, local mock provider: baseline config.patch returned UNAVAILABLE after 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-session tools.effective call returned in 225 ms, so its reported secondary stall was not reproduced.
  • Identical candidate repro at this PR's head: config.patch still returned UNAVAILABLE after 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 remains unknown. Both isolated Gateways stopped cleanly. These single runs establish functional behavior, not a performance comparison.
  • Regression: node scripts/run-vitest.mjs src/gateway/server-plugin-reload.retention.test.ts --maxWorkers=1 fails 2/2 on the baseline's owner: "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.
  • Focused lifecycle proof: 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.
  • Runtime build, changed-file oxfmt/oxlint, and git diff --check passed.
  • Exact-head CI run 40249231387 passed at 45badf43c32a1e2ecef149d4ac56e321b46f0347: 33 successful jobs, including changed tests, type checks, lint, docs, architecture guards, and all three PostgreSQL conformance shards. No rerun was needed.
  • Independent subagent review (autoreview route unavailable): no accepted findings. The configured helper refused the requested provider route because it did not match operator configuration; configuration was left unchanged.

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.

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: S labels Oct 26, 2026
@steipete
steipete marked this pull request as ready for review October 26, 2026 00:24
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-26T00:24:50.002264Z 45badf4 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserve 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.

  • Before: The retained-reference record reports owner unknown and is logged at INFO.
  • After: The structured record preserves the captured owner, and the WARN console output includes bounded diagnostic fields.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused correction with meaningful logging-boundary regressions and detailed reported Gateway verification; separate runtime artifacts were not supplied and broad CI remains pending.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the ordinary contributor-proof gate; its body reports isolated shipped-Gateway timeout verification with captured owners and preserved work completion, while directly inspectable coverage is the production logging integration test.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators cannot attribute retained work from reload timeout logs even when acquisition ownership was captured.
Reason: The maintainer-authored direction restores useful diagnostics through existing logging contracts without changing plugin lifecycle policy.

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
Reviewed head: 45badf43c32a1e2ecef149d4ac56e321b46f0347

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Reload snapshot owner suppression and INFO-only timeout records changes intended behavior with a stated reason (bd2dbfd: feat(plugins): identify retained references blocking reload #167456 deliberately reserved acquisition ownership for administrator inspection because logs have broader readership.)
  • Release and timeout regression expectations changes intended behavior with a stated reason (bd2dbfd: The original cases protected owner suppression and observation without releasing admitted work; this PR changes the former and preserves the latter.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: The introduced production diff changes only snapshot owner inclusion, structured logging, and timeout severity; drain admission, deadlines, release, and replacement remain unchanged. (src/gateway/server-plugin-reload-cleanup.ts:32, 45badf43c32a)
  • Current main still suppresses owners: Fetched main explicitly requests includeOwners:false and embeds snapshots in an INFO message, so it does not already provide this correction. (src/gateway/server-plugin-reload-cleanup.ts:40, 367b4fa493e2)
  • Intentional logging-policy change: feat(plugins): identify retained references blocking reload #167456 intentionally withheld owners from drain logs. This maintainer-authored PR explicitly changes that choice to preserve raw acquisition facts and use existing egress redactors, consistent with the repository logging contract. Public docs: docs/logging.md. (docs/logging.md:1301, 45badf43c32a)
  • Existing transport boundaries: Console warning metadata passes through the shared structured redactor before its 2,048-character cap; diagnostic export redacts records, and support sanitization excludes the nested reference objects. (src/logging/subsystem.ts:284, 45badf43c32a)
  • Regression coverage: The existing release/timeout cases now exercise the real logging pipeline, checking captured owners, secret redaction, support omission, console visibility, and unchanged reference settlement; the body reports baseline failures and candidate passes. (src/gateway/server-plugin-reload.retention.test.ts:32, 45badf43c32a)
  • Reported Gateway verification: The full PR body reports baseline and candidate isolated built-Gateway runs through config.patch with parent and native-subagent turns: candidate timeout warnings expose run/service owners, admitted work completes on its original generation, and replacement later reaches zero references. No separate runtime artifact is linked. (45badf43c32a)

Likely related people:

  • Josh Lehman: Raw commit bd2dbfd adds src/gateway/server-plugin-reload-cleanup.ts:33 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bd2dbfdeb493; files: src/gateway/server-plugin-reload-cleanup.ts)
  • Peter Steinberger: Raw commit 0351056 adds src/gateway/server-plugin-reload-cleanup.ts:25 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0351056b6057; files: src/gateway/server-plugin-reload-cleanup.ts)

PR surface

Source +1, Tests +61, Docs +8. Total +70 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 6 5 +1
Tests 1 81 20 +61
Docs 1 8 0 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 95 25 +70

Review metrics

Metric Value Why it matters
Production versus test LOC Production +6/-5; tests +81/-20 The production change reuses existing owners; test growth replaces logger mocks with distinct file, console, tail, and export boundary checks.

Labels

Label changes:

  • add P2: Missing acquisition attribution impedes diagnosis of plugin reload timeouts, while serving-generation and drain behavior remain intact.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Missing acquisition attribution impedes diagnosis of plugin reload timeouts, while serving-generation and drain behavior remain intact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 25, 2026, 8:41 PM ET / October 26, 2026, 00:41 UTC.

@steipete
steipete merged commit 23a235b into main Oct 26, 2026
227 of 228 checks passed
@steipete
steipete deleted the steipete/fix-plugin-replacement-drain-in-place-20261025 branch October 26, 2026 00:59
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant