Repository navigation
fix: planned restarts no longer log the expected subagent sweep skip as a warning - #201774
Anurag-5ingh wants to merge 1 commit into
Conversation
A sweep refused because the Gateway is draining for a planned restart is expected and is resumed by the next Gateway. Record it at info instead of warn; genuine sweep failures stay at warn. Refs openclaw#200440
|
🦞👀 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: blocked before merge. What this changesThis PR logs expected subagent sweep refusals during Gateway drain at INFO while retaining WARN for genuine sweep failures. Example: A subagent sweep becomes due while the Gateway drains after SIGTERM.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: the focused logging correction is useful and introduces no identified defects; exact-head CI still awaits workflow approval. Priority: P3 Before merge
FindingsNone. Agent review detailsHow this fits togetherThe subagent registry supplies logging callbacks to its background sweeper, which submits cleanup through Gateway work admission and records accepted work, expected drain refusals, or genuine failures. flowchart TD
A[Subagent registry] --> B[Scheduled sweeper tick]
B --> C[Gateway work admission]
C --> D[Admitted cleanup]
C --> E[Drain refusal]
E --> F[INFO skip record]
D --> G[WARN on genuine failure]
Technical reviewBest possible solution: Use the existing registry logger to record expected drain skips at INFO while preserving admission, scheduling, cleanup, and genuine failure warnings. Do we have a high-confidence way to reproduce the issue? Current-main source directly routes expected drain refusal to WARN, and the contributor supplies a matching Gateway capture; this read-only review ran no target code. Is this the best way to solve the issue? The patch is the smallest complete severity correction: it extends the existing logger injection, updates every consumer, and adds one regression without introducing another policy owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f0f3db9e4aeb. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +3, Tests +17. Total +20 across 6 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label 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 HistoryReview history (1 earlier review cycle)
Reviewed November 19, 2026, 2:10 PM ET / 19:10 UTC (Revision 2). |
|
@clawsweeper re-review Added a live Gateway before/after capture to the PR body: a real subagent launch arms the sweeper, the Gateway is stopped as the tick comes due, and the same skip is recorded at WARN on main and at INFO on this branch. |
|
🦞👀 Re-review progress:
|
Refs #200440
What Problem This Solves
Every planned Gateway restart can log
WARN subagent run sweep skipped: gateway is draining for restart. The skip is the designed behavior: restart drain refuses new background work, and the next Gateway resumes the sweep. Logging it as a warning makes routine restarts look like faults. The reporter counted 155 of these lines in 31 days of nightly restarts.User Impact
The expected drain skip is still recorded, at info, so it no longer shows up as a warning on every restart. A genuine sweep failure still logs
subagent run sweep failed: ...at warn.Why This Change Was Made
#147904 changed this refusal from a "sweep failed" message to "sweep skipped" and kept it as a record of skipped work. It went through
warnonly because that was the sweeper's only logger. The sweeper now also receivesinfofrom the registry's existing subsystem logger, and the drain skip uses it. Scheduling is unchanged: the refused tick still returns without rearming, as before.Scope follows the review's suggested first repair: only the drain-skip severity. The health-refresh capacity errors and lease-wait volume in the issue need separate evidence, so this PR refers to the issue instead of closing it.
Evidence
New regression test in
subagent-registry-sweeper-recovery.test.ts: with restart drain marked through the real Gateway work-admission module, a sweeper tick records the skip atinfo, makes nowarncall, does no cleanup and keeps the run. It fails on currentmain(the skip goes towarn) and passes with this change.Sweeper and registry suites pass: sweeper recovery, lifecycle, owed batches, kill and restart settle, registry pressure, plus every suite using the sweeper test helpers and the lifecycle timer retention fixture (191 tests).
pnpm tsgo:core,pnpm tsgo:core:test, oxlint, oxfmt andgit diff --checkare clean.Live Gateway capture, before and after. Isolated state dir and port, model served by the repo's local QA mock provider (
startQaMockOpenAiServer), channels skipped. Steps:pnpm openclaw gateway run --port <port>, thenpnpm openclaw agent --message 'Call sessions_spawn with task="..." mode=run'so a real subagent launch arms the sweeper, then SIGTERM to that foreground Gateway timed to land just before the sweeper's next 60-second tick. The tick then starts inside the stop drain. Same steps on both builds; only the two runtime files differ.Before (
main), structured Gateway log:After (this branch):
Shutdown completed cleanly in both runs; only the recorded level changed.