Repository navigation
refactor(agents): deslop subagents, sessions, worktrees, commands and auth - #158020
Conversation
… auth Reuse canonical normalization, result projection, and lifecycle owners. Remove dead private paths while preserving public and persisted contracts. Synchronize registry fixtures with runtime registration and publication.
|
🦞👀 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. Reviewed September 25, 2026, 10:07 AM ET / 14:07 UTC (Revision 5). ClawSweeper reviewWhat this changesThe branch consolidates agent session, command, authentication, subagent, and managed worktree logic and updates lifecycle tests, with no intended user-visible change. Merge readiness⛔ Blocked before merge - 3 items remain Keep open for ordinary maintainer review. Current main still uses pre-refactor paths, the exact-head CI run passed, and this review found no concrete introduced defect or merged replacement. Priority: P3 Review scores
Verification
How this fits togetherAgent commands receive user or channel requests, select a session, model, and credentials, then run the agent. Child agents and managed worktrees support that run; completion state determines what is persisted and delivered. flowchart LR
A[User or channel request] --> B[Agent command and session]
B --> C[Credential and model selection]
C --> D[Agent run]
D --> E[Subagent registry]
D --> F[Managed worktree]
D --> G[Reply and persisted state]
E --> G
F --> G
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Land the consolidation with credential ownership, session identity, delivery custody, and worktree recovery behavior preserved under the repository’s normal merge gates. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR addresses duplicated internal logic, not a reported current-main bug. Focused lifecycle and compatibility tests are recorded in its body. Is this the best way to solve the issue? Yes: the inspected changes reuse existing owners and retain the relevant auth, session, attachment, and worktree boundaries; no narrower replacement owns the whole cleanup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 297c2b3db102. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
Merged via squash.
|
* commit '54b5f23b006ae917c8bb7903f5ee7dad6108ec25': (194 commits) feat(ui): listen to managed desktop audio in the panel (#157724) fix(ci): resume partially published preparation receipts (#158174) feat(release): one approval per release via an attested parent approval receipt (#157911) feat(desktop): advertise current managed desktop audio (#157723) fix(ui): retain delayed progress scroll gestures (#158153) refactor(ui): share sidebar mutation error feedback (#158173) test: await database verifier process lifecycle events (#158171) perf(update): avoid repeated retained-copy parent creation feat(desktop): bind audio streaming to screen authorization (#157722) refactor(gateway): split companion prompts and metadata fixtures (#158050) feat(desktop): isolate managed Linux application audio (#157720) fix(test): prepare catalog fixture modules before startup (#158157) fix: keep model pickers usable during provider sign-in (#158132) refactor(test): remove unused prompt scenario metadata (#158151) fix(ci): unblock Control UI targeted Crabbox gates (#158149) refactor(agents): deslop subagents, sessions, worktrees, commands and auth (#158020) fix: bound stalled browser stream startup (#156323) fix(onnx): prevent worker fixture hangs after release (#158146) fix(models): preserve scoped provider discovery outcomes (#158139) fix(agents): report offline trash failures after agent delete (#158052) ...
* commit '54b5f23b006ae917c8bb7903f5ee7dad6108ec25': (175 commits) feat(ui): listen to managed desktop audio in the panel (#157724) fix(ci): resume partially published preparation receipts (#158174) feat(release): one approval per release via an attested parent approval receipt (#157911) feat(desktop): advertise current managed desktop audio (#157723) fix(ui): retain delayed progress scroll gestures (#158153) refactor(ui): share sidebar mutation error feedback (#158173) test: await database verifier process lifecycle events (#158171) perf(update): avoid repeated retained-copy parent creation feat(desktop): bind audio streaming to screen authorization (#157722) refactor(gateway): split companion prompts and metadata fixtures (#158050) feat(desktop): isolate managed Linux application audio (#157720) fix(test): prepare catalog fixture modules before startup (#158157) fix: keep model pickers usable during provider sign-in (#158132) refactor(test): remove unused prompt scenario metadata (#158151) fix(ci): unblock Control UI targeted Crabbox gates (#158149) refactor(agents): deslop subagents, sessions, worktrees, commands and auth (#158020) fix: bound stalled browser stream startup (#156323) fix(onnx): prevent worker fixture hangs after release (#158146) fix(models): preserve scoped provider discovery outcomes (#158139) fix(agents): report offline trash failures after agent delete (#158052) ...
* fix(qa-lab): retain tab focus and scroll during polling * chore(qa-lab): merge main for tab navigation validation * fix(qa-lab): keep focused tabs visible after layout changes * fix(qa-lab): reconcile navigation retention with current app * chore: refresh main for QA Lab navigation validation * commit '54b5f23b006ae917c8bb7903f5ee7dad6108ec25': (194 commits) feat(ui): listen to managed desktop audio in the panel (#157724) fix(ci): resume partially published preparation receipts (#158174) feat(release): one approval per release via an attested parent approval receipt (#157911) feat(desktop): advertise current managed desktop audio (#157723) fix(ui): retain delayed progress scroll gestures (#158153) refactor(ui): share sidebar mutation error feedback (#158173) test: await database verifier process lifecycle events (#158171) perf(update): avoid repeated retained-copy parent creation feat(desktop): bind audio streaming to screen authorization (#157722) refactor(gateway): split companion prompts and metadata fixtures (#158050) feat(desktop): isolate managed Linux application audio (#157720) fix(test): prepare catalog fixture modules before startup (#158157) fix: keep model pickers usable during provider sign-in (#158132) refactor(test): remove unused prompt scenario metadata (#158151) fix(ci): unblock Control UI targeted Crabbox gates (#158149) refactor(agents): deslop subagents, sessions, worktrees, commands and auth (#158020) fix: bound stalled browser stream startup (#156323) fix(onnx): prevent worker fixture hangs after release (#158146) fix(models): preserve scoped provider discovery outcomes (#158139) fix(agents): report offline trash failures after agent delete (#158052) ... Co-authored-by: Vincent Koc <[email protected]>
… auth (openclaw#158020) * refactor(agents): deslop subagents, sessions, worktrees, commands and auth Reuse canonical normalization, result projection, and lifecycle owners. Remove dead private paths while preserving public and persisted contracts. Synchronize registry fixtures with runtime registration and publication. * test(agents): await registered subagent completion
) * fix(qa-lab): retain tab focus and scroll during polling * chore(qa-lab): merge main for tab navigation validation * fix(qa-lab): keep focused tabs visible after layout changes * fix(qa-lab): reconcile navigation retention with current app * chore: refresh main for QA Lab navigation validation * commit '0001f441f53712e44b2ca6edf2a6752b8abd6d1d': (194 commits) feat(ui): listen to managed desktop audio in the panel (openclaw#157724) fix(ci): resume partially published preparation receipts (openclaw#158174) feat(release): one approval per release via an attested parent approval receipt (openclaw#157911) feat(desktop): advertise current managed desktop audio (openclaw#157723) fix(ui): retain delayed progress scroll gestures (openclaw#158153) refactor(ui): share sidebar mutation error feedback (openclaw#158173) test: await database verifier process lifecycle events (openclaw#158171) perf(update): avoid repeated retained-copy parent creation feat(desktop): bind audio streaming to screen authorization (openclaw#157722) refactor(gateway): split companion prompts and metadata fixtures (openclaw#158050) feat(desktop): isolate managed Linux application audio (openclaw#157720) fix(test): prepare catalog fixture modules before startup (openclaw#158157) fix: keep model pickers usable during provider sign-in (openclaw#158132) refactor(test): remove unused prompt scenario metadata (openclaw#158151) fix(ci): unblock Control UI targeted Crabbox gates (openclaw#158149) refactor(agents): deslop subagents, sessions, worktrees, commands and auth (openclaw#158020) fix: bound stalled browser stream startup (openclaw#156323) fix(onnx): prevent worker fixture hangs after release (openclaw#158146) fix(models): preserve scoped provider discovery outcomes (openclaw#158139) fix(agents): report offline trash failures after agent delete (openclaw#158052) ... Co-authored-by: Vincent Koc <[email protected]>
Block A (announce deps seam): subagent-announce-deps.ts and the
`export { testing }` / `subagentAnnounceDeps.*` calls resurrected the
module-level deps object that upstream ffcd6e7 (openclaw#154985, keep announce
overrides in test support) removed, using createLazyImportLoader where
c61ba3e (openclaw#158020) uses createLazyPromise. The announce host now calls the
runtime barrel directly (getRuntimeConfig, callSubagentLifecycleGateway for
cleanup) and tests use upstream's announceTesting seam, which spies on that
barrel. The format e2e suite drops its second seam.
Block B (descendant wake old shape): subagent-announce-descendant-wake.ts and
the findings-wake wrapper kept the pre-9ca49c5ac1 (openclaw#159346) shape
(stripWakeRunSuffixes, isWakeContinuationRun, wakeSubagentRunAfterDescendants)
plus the accepted steer-dispatch reservation (#1404). The file is
upstream bytes again and the host makes upstream's runDescendantWake call. The
findings-wake file and the fork-only wake-ownership test are deleted; the
nested-matrix and continuation test-support helpers drop the wake-ack and
reservation fakes.
What stayed (continuation): the host keeps one lazy
loadSubagentContinuationRuntime (createLazyPromise) and reads
resolveContinuationRuntimeConfig from the runtime barrel at call time, so
continuation suites that mock the barrel still steer it. The two continuation
topology/runtime contract tests now point at the host instead of the deleted
deps file.
Home: restored to upstream (drift residue). Upstream's descendant-wake
currency matrix (subagent-announce-delivery.test.ts + test-support at
b51feb9) passes 148/148 against this shape.
Refs #1418
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fix(ui): release failed avatar response bodies * test(ui): cover avatar response cancellation in Chromium * test(ui): assert retained image after avatar failure * test(ui): preserve window global type in avatar proof * test(ui): avoid shadowed avatar proof bindings * chore: refresh main for avatar lifecycle validation * commit '54b5f23b006ae917c8bb7903f5ee7dad6108ec25': (175 commits) feat(ui): listen to managed desktop audio in the panel (#157724) fix(ci): resume partially published preparation receipts (#158174) feat(release): one approval per release via an attested parent approval receipt (#157911) feat(desktop): advertise current managed desktop audio (#157723) fix(ui): retain delayed progress scroll gestures (#158153) refactor(ui): share sidebar mutation error feedback (#158173) test: await database verifier process lifecycle events (#158171) perf(update): avoid repeated retained-copy parent creation feat(desktop): bind audio streaming to screen authorization (#157722) refactor(gateway): split companion prompts and metadata fixtures (#158050) feat(desktop): isolate managed Linux application audio (#157720) fix(test): prepare catalog fixture modules before startup (#158157) fix: keep model pickers usable during provider sign-in (#158132) refactor(test): remove unused prompt scenario metadata (#158151) fix(ci): unblock Control UI targeted Crabbox gates (#158149) refactor(agents): deslop subagents, sessions, worktrees, commands and auth (#158020) fix: bound stalled browser stream startup (#156323) fix(onnx): prevent worker fixture hangs after release (#158146) fix(models): preserve scoped provider discovery outcomes (#158139) fix(agents): report offline trash failures after agent delete (#158052) ... * test(ui): wait for settled avatar fallback * test(ui): wait for control UI before avatar handoff * fix(ui): preserve avatar cleanup across retry lifecycle updates Integrate current main while preserving retry exhaustion, auth restoration, and deferred response cleanup. Keep the real-stream test on real timers and drain loader cleanup before restoring shared test state. * fix(ui): integrate avatar response cleanup with current main * test(ui): align avatar cleanup proof with current harness * test(ui): qualify avatar cleanup harness types and formatting Co-authored-by: Vincent Koc <[email protected]>
* fix(ui): release failed avatar response bodies * test(ui): cover avatar response cancellation in Chromium * test(ui): assert retained image after avatar failure * test(ui): preserve window global type in avatar proof * test(ui): avoid shadowed avatar proof bindings * chore: refresh main for avatar lifecycle validation * commit '0001f441f53712e44b2ca6edf2a6752b8abd6d1d': (175 commits) feat(ui): listen to managed desktop audio in the panel (openclaw#157724) fix(ci): resume partially published preparation receipts (openclaw#158174) feat(release): one approval per release via an attested parent approval receipt (openclaw#157911) feat(desktop): advertise current managed desktop audio (openclaw#157723) fix(ui): retain delayed progress scroll gestures (openclaw#158153) refactor(ui): share sidebar mutation error feedback (openclaw#158173) test: await database verifier process lifecycle events (openclaw#158171) perf(update): avoid repeated retained-copy parent creation feat(desktop): bind audio streaming to screen authorization (openclaw#157722) refactor(gateway): split companion prompts and metadata fixtures (openclaw#158050) feat(desktop): isolate managed Linux application audio (openclaw#157720) fix(test): prepare catalog fixture modules before startup (openclaw#158157) fix: keep model pickers usable during provider sign-in (openclaw#158132) refactor(test): remove unused prompt scenario metadata (openclaw#158151) fix(ci): unblock Control UI targeted Crabbox gates (openclaw#158149) refactor(agents): deslop subagents, sessions, worktrees, commands and auth (openclaw#158020) fix: bound stalled browser stream startup (openclaw#156323) fix(onnx): prevent worker fixture hangs after release (openclaw#158146) fix(models): preserve scoped provider discovery outcomes (openclaw#158139) fix(agents): report offline trash failures after agent delete (openclaw#158052) ... * test(ui): wait for settled avatar fallback * test(ui): wait for control UI before avatar handoff * fix(ui): preserve avatar cleanup across retry lifecycle updates Integrate current main while preserving retry exhaustion, auth restoration, and deferred response cleanup. Keep the real-stream test on real timers and drain loader cleanup before restoring shared test state. * fix(ui): integrate avatar response cleanup with current main * test(ui): align avatar cleanup proof with current harness * test(ui): qualify avatar cleanup harness types and formatting Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Agent session, subagent, worktree, command, and auth owners repeat normalization, result projection, and lifecycle bookkeeping, making the same contracts harder to maintain consistently.
User Impact
No intended production behavior change. Public SDK exports, CLI/config/protocol contracts, transcript and credential bytes, stored schemas, delivery/custody, and requester-wake semantics remain unchanged.
Why This Change Was Made
Reuse existing owners and remove private forwarding layers and unreachable branches:
Retain recovery and compatibility paths with named runtime-extension, durable-state, security, or external-tool contracts. No dependency, configuration, protocol, schema, or changelog changes.
Compatibility: config fields/defaults, SQLite table definitions/schema versions, credential-store shape, and transcript formats are unchanged. No migration or backfill is introduced. Repair-named modules reuse existing normalization and projection owners;
config/assertion-safety-baseline.txtis a shrinking static-analysis baseline, not product state. Existing credential refresh/order/persistence, session/registry persistence, and worktree recovery coverage is retained.Fixes Found Along the Way
Requester-wake assertions raced worker publication by advancing fake time. The fixture now observes actual mocked RPC entry, uses the canonical cleanup wait, and joins owned work at ungated boundaries and before teardown. Archive mocked an obsolete synchronous export; its registered runtime test double now serves the real async lookup/finalization adapters and shipped synchronous termination. Valid task records and an exact task-ID assertion replace the opaque result. All outcome assertions, retry deadlines, and failure-return cases remain.
The registered-completion fixture also polled for announcement entry within an incidental one-second window. It now awaits an explicit entry signal and joins owned completion work before assertions and teardown. Every original assertion remains, and the case keeps its original registration position in the existing task-settlement support module.
Related: #157242 contains overlapping lifecycle-fixture work. These fixture adaptations use the current async runtime and publication owners and are required to qualify this refactor.
Evidence
Current head:
378773433bcfd79c5a550568c43962fdd31905d0. The follow-up changes only the registry completion fixture. Its committed tree exactly matches the Linux-validated source (1521955e0a08ceb50a6b7427a9e0af98cd697047): full changed checks passed in 2,077.349 s; Codex autoreview is scoped-clean through P2 with zero findings; all three original 176-file shard runs and 20 complete registry-file repetitions passed. Exact-head hosted CI passed: 144 jobs succeeded, 19 were skipped, and none failed. The repository-native exact-head watcher reports GREEN; the enforced CI gate and dependency review both published success for this SHA.The branch is based on
dfd01bf712b3d40d7600ed8f45130264889b0757; no listed settlement-overlap PR had merged at publication. The production delta is unchanged from the qualified prior head. Its PR CI passed and skipped build-artifacts; the existing workflow was then dispatched at that same head with the main tier, where hosted build-artifacts passed. The broader run exposed the fixture and native failures attributed below.Completed on Linux for exact head
1bc0d73253bb6129f5c135a49416e28781c82018(candidate tree verified before execution):node scripts/check-changed.mjs: passed, 1,855.972 s.pnpm build: passed, 529.782 s, including the changed lazy-loading/module graph.pnpm plugin-sdk:surface:check: passed, 3.291 s.node scripts/run-vitest.mjs test/scripts/plugin-sdk-surface-report.test.ts: 11 passed, 6.586 s.Earlier Linux proof at source base
26d1ec973edc2906284254027bf16385777d839e:node scripts/check-changed.mjs: passed after the fixture corrections, 1,841.557 s, including 25 core-test type shards, lint, formatting, and guards.pnpm build: passed, 548.104 s. This PR's production delta has not changed since this build.pnpm plugin-sdk:surface:check: passed, 3.324 s.node scripts/run-vitest.mjs test/scripts/plugin-sdk-surface-report.test.ts: 11 passed, 6.453 s.The current package names the SDK API gate
plugin-sdk:surface:check;plugin-sdk:api:checkis absent. Seven credential-dependent live tests remain separate; no live-provider proof is claimed.Before the fixture corrections, the cohort failed identically on candidate and clean base
26d1ec973edc2906284254027bf16385777d839e: requester-wake 13/18 failed, archive 5/26 failed, lifecycle-grace 14/14 passed. The earlier broad 27-file comparison also established these fixture failures independently of the refactor.One larger pre-existing defect remains a separate follow-up: the ambiguous Discord-custody scenario fails on both candidate and clean base. The supported WebSocket fallback retains a Gateway-owned CLI task, while completion settlement requires a subagent task. Diagnostics show completed execution, pending ambiguous delivery, no retry timestamp, and an owner-changed suspension error. Repair requires preserving the task's execution owner while correlating completion custody. Related #157878 addresses the runtime mismatch by discarding non-subagent completion delivery; that does not establish preservation of the supported Gateway CLI fallback or a passing Discord regression. The delivery contract still needs a separate repair. No assertion, timeout, or gate is weakened to hide this failure.
Additional main-tier CI attribution at
1bc0d73253bb6129f5c135a49416e28781c82018used the original decoded shard selections, Node 24.21.0, three workers, plan concurrency one, an 8 GiB heap limit, and separate caches on base/candidate. The 176-entry registry selection passed both revisions: base 3,390 cases in 317.221 s and candidate 3,392 in 299.149 s (one selected file is new on the candidate). The reported seam case completed in 133/182 ms; its original CI failure exhausted an incidental one-second polling window. Its fixture now awaits actual announcement entry and joins owned completion work, retaining all assertions. The repaired case passed three original registry-shard runs and 20 consecutive complete registry-file runs; final qualification is recorded below.The original 16-file Gateway group reproduced the catalog timeout on clean base
dfd01bf712b3d40d7600ed8f45130264889b0757: startup/connect exhausted 60 seconds, while all 134 other cases passed. Candidate passed all 135 cases in 210.189 s; the catalog case took 38.729 s. These observations establish that the timeout predates this refactor, not that a passing replay fixes it. The unchanged fixture remains a focused follow-up; no deadline or assertion is relaxed.The expanded same-head run also reported an Apple Watch system failure: Xcode's coordinator fired its startup watchdog before receiving the test-execution acknowledgment (
XCTHTestOperationCoordinatorErrorDomain Code=14). The artifact has no named failing assertion. Native source, toolchain scripts, dependencies, and workflow inputs are unchanged from the merge base. A separate clean-base native control completed the actual Watch operation step: 48 tests in three suites passed, including the three realtime tests absent from the interrupted candidate log. This is attribution evidence, not a claimed native test fix. No diagnostics policy or deadline was changed. The temporary control branch was deleted after proof.The registered-completion fixture retains all 188 parent-suite cases after moving into the existing task-settlement test-support module. Its final layout passed the original registry shard and 20 consecutive full-file runs (3,760 executions); the measured
pnpm test src/agents/subagents/registry/subagent-registry.test.ts --maxWorkers=1command passed in 29.504 s. The parent file now shrinks under the line-cap ratchet. The full changed gate passed in 2,077.349 s on the final source tree; the independent follow-up Codex review passed through P2 with zero findings in 28.173 s. Current-head ClawSweeper also reports no actionable defect or security finding; its compatibility checklist is addressed above, with maintainer confidence review reserved for the coordinator. All three original 176-file shard runs passed on the final layout: 188.553 s, 176.322 s, and 250.577 s.Campaign measurement:
That is 1,302 net lines removed by the required non-test/docs command, or 1,388 production-source lines after separately excluding the shrinking assertion baseline and test helpers (the required filter also counts the 89 added test-support lines for the extracted completion fixture). The coverage log covers all 105 original and 65 expanded production files over 200 lines, plus smaller modules in component logs.
Blacksmith Testbox verified selected source hashes and base ancestry before proof. Passing integrated proof used
tbx_01m3bdhe9p25fxbjqtkaxetrs8; current-base attribution usedtbx_01m3bhxxq9ghfeyw5p1kp12zws. All are stopped. Final fixture qualification and review usedtbx_01m3bnfpp84g3gneknnynbnx21(run), also stopped. The previous production head passed its ordinary PR CI. The post-rebase Linux build has passed. The refreshed registry repetitions and final review passed; the subsequent same-head hosted build-artifacts job also passed. The registered-completion repair is now fully qualified locally on Linux. Final changed checks, review, and shard repetitions usedtbx_01m3c7qzm05ttprs1m5ya4sh9f(run); that lease is stopped. No owned Testbox remains active.Measured changed-test command cost (
pnpm test <file> --maxWorkers=1, Linux; all completed rows passed):Command timings include runner startup. The fixture repairs add no Gateway or process boots. The attachment finding was rechecked with
node scripts/run-vitest.mjs src/agents/subagents/spawn/subagent-spawn.attachments.test.ts src/agents/tools/sessions-spawn-tool.test.ts: 174 passed in 47.384 s. The four ordinary CI shards emitted per-case timings rather than per-file wall receipts; those sums are not substituted for file duration. The E2E CI values are native file durations and exclude shared runner startup.