Repository navigation
fix: honor subagent concurrency for dreaming completions - #170273
Conversation
Route plugin background completions through the configured subagent lane while retaining cancellation and cleanup ownership. Document the shared cap and cover admission across plugins. Refs #95746. Thanks @rogerallen1 for the report.
|
🦞👀 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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesPlugin background completions now honor the existing subagent concurrency limit across plugins and workspaces. Example: Four dreaming workspaces use a local model with agents.defaults.subagents.maxConcurrent set to 1.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open. This PR fixes a current concurrency defect in the shared completion owner, and no actionable correctness or security finding remains. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherDreaming and other plugins submit tool-free completion requests to the Gateway, which authorizes them, queues inference, and returns text through the existing isolated runtime. flowchart TD
A[Dreaming and other plugins] --> B[Gateway completion owner]
B --> C[Authorization and lifetime checks]
C --> D[Subagent queue]
D --> E[Isolated inference runtime]
E --> F[Model provider]
F --> G[Completion text]
Technical reviewBest possible solution: Use the existing subagent queue as the single plugin-completion capacity owner while preserving cleanup, cancellation, and authorization. Do we have a high-confidence way to reproduce the issue? Current main's independent three-slot completion budget directly explains why a configured subagent limit of one is ignored; this review did not execute a reproduction. Is this the best way to solve the issue? The patch fixes admission at the shared Gateway owner, removes the competing completion budget, and retains the existing authorization and inference-cleanup contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ec71e926c1a2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -2, Tests +68, Docs +3. Total +69 across 5 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 HistoryReviewed October 12, 2026, 6:22 PM ET / 22:22 UTC (Revision 3). |
|
Merged via squash.
|
…0273) Route plugin background completions through the configured subagent lane while retaining cancellation and cleanup ownership. Document the shared cap and cover admission across plugins. Refs openclaw#95746. Thanks @rogerallen1 for the report.
Related: #95746. Thanks @rogerallen1 for reporting the local-model concurrency problem.
What Problem This Solves
Dream Diary and other plugin background completions could start three model requests even when
agents.defaults.subagents.maxConcurrentwas set to one.User Impact
Background completions now honor the existing subagent cap across plugins and workspaces. Set it to
1to serialize requests to a small local model. The existing default of eight now applies instead of the old independent three-slot limit. No new setting or migration is required.Why This Change Was Made
The Gateway completion owner now queues through the existing subagent lane at background priority. Restart, caller, and runtime cancellation remain connected, authorization is still rechecked after waits, and capacity remains held through inference cleanup. Skill Workshop retains its own background review budget.
Evidence
Native Ollama
qwen3:4bwithnum_ctx=8192, four identical synthetic workspaces, and both configured concurrency caps set to one: the real CLI → Gateway → managed dreaming job → plugin completion → Ollama/api/chatflow produced four completed model replies and four diaries before and after. Recorded peak in-flight HTTP requests fell from 3 to 1. This proves cap enforcement; actual context exhaustion was not reproduced.The owner regression fails on main with subagent
queuedCount=0instead of2behind an occupied cap-one slot. It passes after the repair (3.822s in the final standalone run), including requests from different plugins, without starting a provider or using test timers.Focused checks: completion runtime 25/25 (153.64s wrapper wall), HTTP transport 2/2 (276.88s), Gateway lanes 7/7 in the combined run. A prior combined run (534.41s) hit the unchanged transport fixture's completion deadline during cold preparation; the isolated replay passed with the original timeout. Cold worker preparation accounts for most wrapper time.
Targeted lint, format, core and Gateway test types, and all seven required ratchets pass. The
qaRuntimebuild and the source CLI's managed build pass. The final edits after live proof only rename a local variable and retain the same literal lane comparison in a test.Production +12/-14 (net -2); tests +86/-18; docs +8/-5. Model-facing prompt token delta: 0.
Independent Codex autoreview: scoped-clean through P2, with no accepted/actionable findings.
Exact-head CI: run 38312617421 succeeded for
5193060ec42bce2bbe1b2b122477c7db9073ab00, includingopenclaw/ci-gate: 39 successful jobs, 25 skipped, no current failures. CI execution window: 622s; baseline ratchets: 289s. The pinned watcher classifies 81 older cancelled checks as superseded.ClawSweeper reviewed this head with no actionable findings and no “Before merge” items. Live-proof limitation: the synthetic Ollama wire traces are retained locally and are not linked in this PR.