Repository navigation
refactor(agents): deslop agent subsystems third pass - #159346
Conversation
|
🦞👀 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 27, 2026, 7:53 AM ET / 11:53 UTC (Revision 6). ClawSweeper reviewWhat this changesConsolidates agent session, authentication, subagent, harness, CLI, and sandbox code while correcting remote filesystem path handling and whitespace-padded structured-input choices. Merge readiness⛔ Blocked before merge - 3 items remain Keep open. Current main still has the remote path and padded-choice behavior this branch repairs. The pinned test merge is clean, and the reviewed owner paths reveal no concrete introduced defect. The linked SSH QA fixture PR addresses separate work. Priority: P2 Review scores
Verification
How this fits togetherThe agent runtime receives turns, credentials, tool requests, and session records, then routes work through a harness, subagents, and sandboxed tools. It returns results and replies and persists session history. flowchart LR
A[Chat turn and session] --> B[Agent runtime]
C[Credentials and configuration] --> B
B --> D{Harness or subagent}
D --> E[Sandboxed tools]
D --> F[Structured input]
E --> G[Results and transcript]
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: Keep sandbox path pinning and choice decoding with their existing owners, guarded by the shell-backed containment and path-byte regressions. Do we have a high-confidence way to reproduce the issue? Yes for the targeted defects: the shell-backed bridge regressions specify newline-path and parent-alias failures, and the structured-input execution test specifies the padded-choice failure. This read-only review did not run them. Is this the best way to solve the issue? Yes. The fixes stay with the existing sandbox resolver and structured-input decoder, without adding a competing owner, setting, or stored format. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fe609d4ce1a8. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Consolidate subsystem projections, runtime forwarding, and typed contracts while preserving authentication, lifecycle authority, and persistence semantics. Preserve canonical remote sandbox path bytes and decode padded structured-input labels consistently. Keep model-facing display text unchanged.
Canonicalize the full parent before unlink or rename, leaving final-entry symlink handling to the guest filesystem owner. Keep missing path spellings on one mutation queue identity. Retain public event payload types at their dispatch boundary and shrink verified assertion allowances.
a4ebae4 to
e7ffdfb
Compare
|
* refactor(agents): deslop agent subsystems third pass Consolidate subsystem projections, runtime forwarding, and typed contracts while preserving authentication, lifecycle authority, and persistence semantics. Preserve canonical remote sandbox path bytes and decode padded structured-input labels consistently. Keep model-facing display text unchanged. * fix(agents): preserve remote mutation parent identity Canonicalize the full parent before unlink or rename, leaving final-entry symlink handling to the guest filesystem owner. Keep missing path spellings on one mutation queue identity. Retain public event payload types at their dispatch boundary and shrink verified assertion allowances.
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]>
What Problem This Solves
Maintainer-requested third cleanup pass across agent subsystems: repeated runtime forwarding, request/result projections, and locally duplicated types make ownership harder to follow.
User Impact
The cleanup preserves credential resolution order, auth-profile semantics, sandbox containment, subagent authority and fencing, transcript formats, model-facing text, and public SDK exports. No migration or configuration change is required.
Bugs found during the sweep are also fixed: remote sandbox reads/writes preserve path newlines; unpinned remove/rename through an in-mount parent symlink operate on the intended entry; and structured input accepts its own declared choice labels when they contain surrounding whitespace.
Why This Change Was Made
Production code is reduced by 1,358 net lines. Recent merged cleanup diffs were inspected first; the sweep prioritized untouched files and recorded coverage of every production file over 200 lines.
Fixes found along the way
Remote canonicalization used line-delimited output and shell substitutions that lost path newline bytes. A real shell-backed filesystem regression failed with
FileNotFoundErrorfor the truncated root, then passed with byte-preserving framing. Existing containment checks remain in place.Remote remove/rename already separated a filename from its parent, but an obsolete final-symlink option could then drop a symlinked parent and target a same-named root sibling. Parent canonicalization now resolves the full parent; the guest filesystem engine retains final-entry no-follow handling. Regression coverage protects root siblings, symlink targets, escaping parents, and equivalent missing-path queue identities.
Structured-input validation accepted padded labels and the Gateway returned those display bytes, but the decoder compared a trimmed answer to an untrimmed label. The execution regression first returned
declined, then passed after decoding and Other-field classification normalized labels consistently. Displayed labels and schema values stay unchanged.Evidence
Final validation passed for head
e7ffdfbf8f10752c6fa88601f227f830455f5205. This PR is ready to land; it has not been merged.pnpm buildpassed (419 seconds).expectedEntry.--maxWorkers=1). All 50 sandbox/importer suites, boundary checks and build passed after those corrections. The conflict-resolved candidate has a fresh scoped-clean P2 review. Final Testbox gates passed:node scripts/check-changed.mjs(1,299s), 51 reconciled CLI/extension/steering/result/path suites (100s), four boundary suites (22s), andpnpm build(367s).A supplemental broad importer selection found unrelated tooling failures. The PR provisioning failure is already fixed on main by
0a9fa7dafabec7ce52c5dac5bd71b9e3c1bcc784and is included by the rebase. The inherited SSH QA fixture lifetime failure is tracked separately in #159572, including readiness-failure and parent-death cleanup regressions.Current-head verification and compatibility
CI run 36300740291 passed on the exact head: 158 successful jobs, including
openclaw/ci-gate; 20 jobs were inapplicable/skipped. Blacksmith Testbox providerblacksmith-testbox, leasetbx_01m3grs8m4mgmhbpy2p1dh9fgs, completed the final command successfully and was stopped. Earlier required cross-shard directory/importer proof is summarized above; passing proof was reused where inputs stayed unchanged.There are no changed config keys/defaults, database schemas, migrations, serialized credential/session formats, retention rules, or permissions. The
auth-profiles/doctor.tsedit removes a private forwarding helper while preserving the public hint operation. Thefailover/message-patterns.tsedit replaces six equivalent substring alternatives withsome; it does not read or write stored data. The assertion baseline only shrinks verified counts. Existing auth, session persistence, compatibility, and importer tests passed; no migration is introduced or required.Changed-test cost
Linux Testbox command wall time, each run with
pnpm test <file> --maxWorkers=1:src/agents/)harness/structured-input-execution.test.tsharness/structured-input.test.tssandbox/remote-fs-bridge.path-bytes.test.tssandbox/remote-fs-bridge.parent-alias.test.tssandbox/remote-fs-bridge.test.tssessions/resource-loader.test.tssubagents/announce/subagent-announce-delivery.test.tssubagents/completion/subagent-completion-admission.cancel-rollback.test.tssubagents/completion/subagent-completion-admission.store.test.tssubagents/registry/subagent-registry-lifecycle-wake.retry.test.tssubagents/registry/subagent-registry-lifecycle.test.tsCurrent-head CI compact Node test shards took 85–546 seconds each, including setup and multiple files. GitHub's run-log archive endpoint failed twice with an HTTP/2 stream cancellation, so per-file CI time is unavailable; these are shard wall times, not standalone file measurements. No retries, increased timeouts, skipped regressions, or weaker assertions were added.