Repository navigation
fix(skills): run experience review outside released request roots - #116040
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 2:53 PM ET / 18:53 UTC. ClawSweeper reviewWhat this changesThe PR runs delayed skill experience reviews under independent gateway-work admission, adds scheduler skip/schedule diagnostics, and tests the released-request-root case that previously rejected the review. Merge readinessKeep this PR open for explicit maintainer handling. The reported production failure is concrete, the patch is narrowly aimed at the detached gateway-work boundary, and the PR body provides before/after live-gateway evidence; however, the protected Priority: P1 Review scores
Verification
How this fits togetherAfter a sufficiently deep agent turn, the skill workshop scheduler waits for an idle interval and launches a detached experience-review run. That run passes through gateway work admission and the skill-review lane before it can create or automatically apply a skill proposal. flowchart LR
A[Foreground agent turn] --> B[Experience review scheduler]
B --> C[Idle timer callback]
C --> D[Gateway work admission]
D --> E[Skill review lane]
E --> F[Embedded reviewer]
F --> G[Proposal or auto-apply]
Decision needed
Why: The Before merge
Agent review detailsSecurityNone. PR surfaceSource +25, Tests +41. Total +66 across 2 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the focused admission-boundary repair once a maintainer confirms the independent-root helper preserves real shutdown-drain refusal and the current head’s required checks finish successfully. Do we have a high-confidence way to reproduce the issue? No independently executed current-main reproduction was available in this read-only review, but the proposed regression test models the released root-work admission context described in the live gateway failure. Is this the best way to solve the issue? Unclear pending the required source-level lifecycle audit; re-entering independent root admission is a narrow plausible fix if it preserves genuine gateway-draining refusal. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 83aca8a59c7c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* origin/main: fix(ui): explain unavailable MCP tool catalogs (openclaw#115994) fix(skills): run experience review outside released request roots (openclaw#116040) docs(security): add safe Gmail reader setup (openclaw#116041) chore: refresh browser gateway runtime (openclaw#116043) test: isolate gateway sequence lifecycle coverage docs: note gateway reconnect sequence fix test: cover gateway sequence reset on restart test: cover gateway sequence reset on reconnect fix: reset gateway event sequence on reconnect
* origin/main: (151 commits) feat(plugins): allow per-turn tool narrowing in prompt hooks (openclaw#114151) docs(hooks): mark pairing hook observation-only (openclaw#116055) docs(control-ui): document composer capability menu (openclaw#115858) fix(build): bound declaration memory use (openclaw#116021) fix: Slack replies recover after gateway startup replay (openclaw#115991) fix(azure-speech): keep valid voices from malformed catalogs (openclaw#115067) fix(agents): prevent model runtime startup timeout (openclaw#116039) fix(ui): explain unavailable MCP tool catalogs (openclaw#115994) fix(skills): run experience review outside released request roots (openclaw#116040) docs(security): add safe Gmail reader setup (openclaw#116041) chore: refresh browser gateway runtime (openclaw#116043) test: isolate gateway sequence lifecycle coverage docs: note gateway reconnect sequence fix test: cover gateway sequence reset on restart test: cover gateway sequence reset on reconnect fix: reset gateway event sequence on reconnect fix(codex): avoid transcript mirror snapshot churn (openclaw#115070) fix(test): stop cross-file state leaks in media suites (openclaw#116027) feat(hooks): add persistent hook session mode (openclaw#75918) fix(memory): return early for blank searches (openclaw#116034) ...
* origin/main: (39 commits) feat(apple): media renditions, Now Playing, video upload (#116051) feat(android): media renditions, MediaSession, video upload (#116037) feat(cli): run agent exec against the ambient config, composed in memory (#116038) fix #95351: [Feature]: Generic JSONL line-parsing hook for CliBackendPlugin (native tool-card support beyond claude-stream-json) (#95386) feat(plugins): allow per-turn tool narrowing in prompt hooks (#114151) docs(hooks): mark pairing hook observation-only (#116055) docs(control-ui): document composer capability menu (#115858) fix(build): bound declaration memory use (#116021) fix: Slack replies recover after gateway startup replay (#115991) fix(azure-speech): keep valid voices from malformed catalogs (#115067) fix(agents): prevent model runtime startup timeout (#116039) fix(ui): explain unavailable MCP tool catalogs (#115994) fix(skills): run experience review outside released request roots (#116040) docs(security): add safe Gmail reader setup (#116041) chore: refresh browser gateway runtime (#116043) test: isolate gateway sequence lifecycle coverage docs: note gateway reconnect sequence fix test: cover gateway sequence reset on restart test: cover gateway sequence reset on reconnect fix: reset gateway event sequence on reconnect ...
What Problem This Solves
On a real gateway, the autonomous experience review never ran: every delayed review died with
GatewayDrainingError: Gateway is draining; new tasks are not acceptedon a healthy, running gateway, and the candidate was silently dropped (one WARN line, no retry). Self-learning's background review + auto-apply (#115576, #115887) was effectively non-functional in production.Why This Change Was Made
The scheduler arms its idle timer inside the foreground run's agent-end side effects, which execute within the RPC's root-work admission
AsyncLocalStoragecontext. Timer callbacks inherit that ALS context. By the time the 30s quiet timer fires, the request root is released, soisGatewaySubordinateWorkAdmissionClosed()returnscurrent.released === trueand the review's lane enqueue is refused. Unit tests injectrunReview, and the vitest live eval callsrunSkillExperienceReviewdirectly with no ALS ancestor — both bypass the failing admission path, which is why this only surfaced under a real gateway.The fix re-enters admission as independent root work (
runWithGatewayIndependentRootWorkAdmission) around the review run — the documented seam for detached follow-up work. A genuine restart drain still refuses the review. Also adds debug-levelexperience review scheduled/skipped(reason)logging, which this investigation sorely missed.User Impact
Self-learning experience reviews (and
auto-mode applies) now actually run on live gateways. No config changes.Evidence
openai/gpt-5.6-lunaruntime, real OpenAI key): before the fix, a 10+ iteration turn producedskill experience review failed: GatewayDrainingError~60s after turn end, zero proposals. After the fix: three consecutive deep turns (sessions stress-s2/s3/s4) each produced a review, a pending proposal, and anauto-mode apply (skill_workshop_proposalsrowsapplied, skills on disk), with zero review failures in the gateway log.experience-review-auto-apply.test.ts"re-enters gateway admission when fired from a released request root" — schedules the review from a released root-work ALS context and assertsisGatewaySubordinateWorkAdmissionClosed()isfalseinside the run (fails withGatewayDrainingErrorbefore the fix).node scripts/run-vitest.mjs src/skills/workshop/experience-review.test.ts src/skills/workshop/experience-review-auto-apply.test.ts— 23 passed, on top of fix(agents): harden skill-review lane against cold-load stalls #115950.node scripts/check-changed.mjsgreen locally (Blacksmith backend unreachable; documented trusted-source fallback) except a max-lines ratchet drift that resolved itself after rebasing onto latestmain.gpt-5.6-sol): clean, no findings (0.94).Live stress testing also surfaced two adjacent defects tracked separately: user aborts unwind the embedded run with a raw
AbortErrorbefore any agent-end side effects (starving interrupted-turn review, autocapture, and plugin hooks), and terminal sessions from agent exec calls outlive their runs until the 24-session cap breaks exec gateway-wide.