Skip to content

refactor(agents): deslop embedded agent runner third pass - #159597

Merged
steipete merged 6 commits into
mainfrom
deslop/l120-embedded-runner3
Sep 27, 2026
Merged

steipete merged 6 commits into
mainfrom
deslop/l120-embedded-runner3

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The embedded runner still repeats private forwarding, type declarations, predicates, and result projections after its earlier cleanup passes. This third pass removes 1,001 net production lines while keeping each responsibility with its existing owner.

User Impact

No intended user-visible change. Prompt, transcript, and tool bytes; exact steering/queue call shapes; compaction, model fallback, lifecycle ordering, and authority revalidation remain unchanged. No configuration default, persisted schema, migration, retention, or permission contract changes. The assertion baseline is developer-check metadata only.

Why This Change Was Made

The full production subtree and recent merged changes were reviewed before editing. Related: #158879.

  • Call the canonical tool-definition adapter directly, removing splitSdkTools, its ignored sandbox flag, and every caller/build entry. Preserve the explicit three-argument call shape.
  • Share compaction hook dispatch while retaining phase-specific payloads, hook receivers, captured session identity, warnings, and authority checks. Inline the single-use queued-preparation forwarder.
  • Derive private parameter/result types from their owning implementations instead of maintaining parallel shapes for compaction, prompt assembly, model observation, image preparation, and recovery.
  • Project manifest alias claims directly into the consumed result and resolve dynamic models once before the existing currentness check.
  • Track client-tool slots by their actual objects and share the existing tool-activity timer without wrapping deferred-tool preparation.
  • Remove property-getter forwarding, dead exports, redundant bookkeeping, and narration. Reuse existing JSON, tool-block, string-list, warning, usage, and message-size helpers while preserving output text and optional-field presence.
  • Keep model-observation state/types with the observation owner, so lifecycle consumes those types in one direction.
  • Reconcile with main's Task/TaskFlow retirement: the media-generation owner supplies operations; the waiter shares its pending-kind predicate while preserving synchronous admission, short-circuit evaluation, and abort behavior.

Fixes Found Along the Way

The compaction harness supplied a getterless auth store and resolved credentials to an unrelated constant. The typed adapter cutover exposed that mismatch. Its shared fixture now supports runtime-key storage/lookup and explicit credential precedence; the exact xAI credential assertion remains unchanged. No test cases were added.

Validation also caught the deleted wrapper's private build entry, a numeric accumulator type needed by declaration generation, and a type-only diagnostic import cycle. Those are corrected. Nine assertion-baseline entries shrink by fourteen assertions; none is raised.

Evidence

BLOCKED by upstream CI; not READY-TO-LAND. Published head: d7fee2a7b9cfa4688c16a67543a5777b5e8c463f. No merge was requested.

  • Fresh independent Codex review of the complete candidate, including the Task/TaskFlow rebase resolution: no actionable P0–P2 findings.
  • Linux Testbox on the current source tree: 55 focused async-wait/stream-settlement/worker tests across four files passed (34.61s); pnpm build passed (354.51s); 5,498 runner/ask-user tests across 350 files passed (372.89s); 59 import-boundary tests across 17 files passed (63.52s).
  • Cross-shard importers completed all 20 selections: 160 files / 4,903 tests, with 4,902 passing and one failure (1,387.37s). Main intentionally removed the former detached-task lookup fixture. The unchanged agent-runner.runreplyagent.e2e.test.ts adopted transcript-only cancellation case throws AgentDatabaseRegistryChangedError before model execution. Existing PR refactor(auto-reply): deslop auto-reply fourth pass #159527 owns the exact predecessor-cleanup race and ordered regression proof. No duplicate repair, retry, timeout increase, or weakened assertion is included here.
  • Current check-changed fails at the inherited media-retention fixture's TS2554: media-generate-background-retention.test.ts:233 calls the new callback without its session-read owner. Exact-head hosted CI fails at the inherited ACP fixture's TS2367: manager.preactive-cancellation.test.ts:46 compares its two-valued phase with the removed queued case. PR fix: repair artifact and upgrade validation after Task retirement #159819 owns both repairs, plus the retirement's stale test-ownership metadata and diagnostics staging. It remains open; its latest head also has a failing CI check. This PR is waiting for that canonical repair before rebase and final static/hosted acceptance.
  • Earlier architecture and complete changed-file proof passed before the final retirement rebase, including all type graphs, three zero-entry dead-export scans, lint, formatting, and structural guards. That historical result is not reported as a current-head static pass.
  • Incorporated main repair 601bb5ba37e5f578a35b2d7a176cd24bfde38135 fixes the earlier schema-scope CI failure. Incorporated main repair 559b4f84f6150781523bd2b66b2c08fcdc15220f fixes stale Workboard asset pointers; the Testbox-generated manifest matched that repair byte-for-byte.

All seven changed test files also pass individually. These are measured Linux Testbox wall times for pnpm test <file> --maxWorkers=1, including wrapper startup, on the prepared build:

Test file Wall seconds
src/agents/agent-bundle-mcp-tools.request-boundary.test.ts 15.16
src/agents/agent-tool-definition-adapter.metadata.test.ts 15.14
src/agents/agent-tools.before-tool-call.integration.e2e.test.ts 22.52
src/agents/embedded-agent-runner/compact.hooks.test.ts 34.49
src/agents/embedded-agent-runner/run/attempt-session.test.ts 16.53
src/agents/embedded-agent-runner/run/attempt.configured-mcp-lifecycle.test.ts 17.38
src/agents/provider-stream.lifecycle.test.ts 15.36

Hosted per-file timings are unavailable: the type failure cancelled the test jobs before they ran.

Provider: blacksmith-testbox. Final proof lease tbx_01m3j0me64mq3xy4n1hxkmqkfh is stopped, as are all earlier task-owned leases. Testbox run. Commands ran through the repository wrapper: pnpm install --frozen-lockfile, node scripts/check-changed.mjs, pnpm build, node scripts/run-vitest.mjs for the focused, runner/ask-user, importer, and boundary selections, and the seven single-worker commands above. The compound invocation exited 1 because of the documented upstream static and E2E failures; passing phases are recorded separately.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL labels Sep 27, 2026
@steipete
steipete marked this pull request as ready for review September 27, 2026 10:52
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 6:31 PM ET / 22:31 UTC (Revision 11).

ClawSweeper review

What this changes

The branch simplifies embedded agent runs by using the existing tool adapter directly, sharing compaction hook dispatch, consolidating private types and helpers, and updating related tests and build entries.

Merge readiness

⛔ Blocked before merge - 4 items remain

Current main retains the forwarding path this PR removes, so the merged earlier cleanup does not make this work redundant. I found no concrete introduced defect in the reviewed paths; the PR description still needs to reflect the current head and the now-merged fixture repair.

Priority: P3
Reviewed head: 2686b65f78a934265386abc5876e54756758a619

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The cleanup has substantial focused validation and no supported correctness finding, while the durable evidence has not yet been refreshed for the reviewed head.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The member-authored internal refactor is outside the external-contributor live-proof gate. The PR body reports Testbox build and runner validation for an earlier head; hosted checks for the reviewed merge head were still pending. No stored-data contract change was identified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored internal refactor is outside the external-contributor live-proof gate. The PR body reports Testbox build and runner validation for an earlier head; hosted checks for the reviewed merge head were still pending. No stored-data contract change was identified.
Evidence reviewed 7 items Current-main behavior: The pinned main revision retains splitSdkTools, a forwarding wrapper around the existing tool-definition adapter.
Introduced tool path: The branch calls the existing adapter with the tool list, hook context, and abort signal, then derives the session allowlist from the resulting definitions.
Compaction ordering and authority: The shared dispatcher checks active authority around internal hook delivery and before plugin hooks, with phase-specific payloads.
Findings None None.
Security None None.

How this fits together

The embedded agent runner turns an admitted session’s prompt, tools, and model choice into a provider call. It also manages compaction and passes the result to reply delivery.

flowchart LR
  A[Admitted session] --> B[Prompt and tool preparation]
  B --> C[Embedded agent runner]
  C --> D[Model provider]
  C --> E[Compaction hooks]
  D --> F[Reply result]
  E --> F
Loading

Before merge

  • Complete next step (P2) - Refresh the PR Evidence section for head 2686b65: identify fix: repair artifact and upgrade validation after Task retirement #159819 as merged, remove the outdated blocker claim, and record exact-head acceptance when checks finish.
  • Resolve review confidence - ClawSweeper must reach high confidence before merge readiness is known.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Assertion safety ratchet 9 entries reduced; 14 fewer allowances The developer assertion baseline shrinks without raising an allowance.

Stored data model

Persistent data-model change detected: unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain the direct adapter and shared compaction owner while preserving prompt bytes, live authority checks, and run lifecycle ordering.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR proposes behavior-preserving cleanup rather than reporting a defect to reproduce.

Is this the best way to solve the issue?

Yes: using the existing tool adapter and compaction owner removes duplicate paths without introducing a new public contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against e74690a70ca8.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal cleanup with no intended user-visible change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The member-authored internal refactor is outside the external-contributor live-proof gate. The PR body reports Testbox build and runner validation for an earlier head; hosted checks for the reviewed merge head were still pending. No stored-data contract change was identified.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vito Cappello: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-27T15:44:33.051Z sha 33b9a72 :: blocked before merge. :: [P1] Break the reciprocal model-diagnostic type import
  • reviewed 2026-09-27T15:58:39.024Z sha af2138a :: blocked before merge. :: none
  • reviewed 2026-09-27T16:16:46.533Z sha af2138a :: blocked before merge. :: none
  • reviewed 2026-09-27T17:03:37.639Z sha ed20828d394d5abb48d4ea9d52e8b60980ffbbd9 :: blocked before merge. :: none
  • reviewed 2026-09-27T17:23:55.977Z sha ed20828d394d5abb48d4ea9d52e8b60980ffbbd9 :: blocked before merge. :: none
  • reviewed 2026-09-27T18:16:24.595Z sha d7fee2a :: blocked before merge. :: none
  • reviewed 2026-09-27T19:22:51.385Z sha d7fee2a :: blocked before merge. :: none
  • reviewed 2026-09-27T19:43:25.692Z sha eb9fcae :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
@steipete
steipete force-pushed the deslop/l120-embedded-runner3 branch from 3396375 to 33b9a72 Compare September 27, 2026 15:35
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 27, 2026
@steipete
steipete force-pushed the deslop/l120-embedded-runner3 branch from af2138a to ed20828 Compare September 27, 2026 16:54
@steipete
steipete force-pushed the deslop/l120-embedded-runner3 branch from ed20828 to d7fee2a Compare September 27, 2026 18:03
@steipete
steipete enabled auto-merge (squash) September 27, 2026 19:26
@steipete
steipete merged commit f77e791 into main Sep 27, 2026
228 checks passed
@steipete
steipete deleted the deslop/l120-embedded-runner3 branch September 27, 2026 22:45
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
…59597)

* refactor(agents): deslop embedded agent runner third pass

* refactor(agents): finish runner adapter cutover and validation fixes

* refactor(agents): keep model observation types with their owner

* refactor(agents): remove redundant async-wait narration
steipete added a commit that referenced this pull request Sep 29, 2026
Consolidate equivalent embedded-runner projections and owner helpers, remove unused plumbing, and simplify redundant branches while preserving run authority, cancellation, prompt/transcript bytes, tool policy, transport shaping, and usage accounting. Production change: 361 added / 1,002 removed, net -641 lines.

Preserve real model-selection exports in the command test mock. Missing provider maps return undefined on both main and the refactor; the legacy automatic fallback still wins over the colliding alias. Keep the unchanged collision configuration in the existing fixture helper to satisfy the line-cap ratchet.

Validation: main/PR comparison with model-selection fully unmocked; 138 command tests; all 20 facade-mocking siblings plus embedded runner tests (355 files / 5,827 tests); final check-changed; independent autoreview through P2. No production behavior change is claimed.

Related: #159597

Exact-head CI exception: checks-node-compact-small-18 has the same two sparse-runner missing-prerequisite failures as unrelated PR #160075 run 36528303180. All other execution jobs passed or skipped. See PR Evidence.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
…160906)

Consolidate equivalent embedded-runner projections and owner helpers, remove unused plumbing, and simplify redundant branches while preserving run authority, cancellation, prompt/transcript bytes, tool policy, transport shaping, and usage accounting. Production change: 361 added / 1,002 removed, net -641 lines.

Preserve real model-selection exports in the command test mock. Missing provider maps return undefined on both main and the refactor; the legacy automatic fallback still wins over the colliding alias. Keep the unchanged collision configuration in the existing fixture helper to satisfy the line-cap ratchet.

Validation: main/PR comparison with model-selection fully unmocked; 138 command tests; all 20 facade-mocking siblings plus embedded runner tests (355 files / 5,827 tests); final check-changed; independent autoreview through P2. No production behavior change is claimed.

Related: openclaw#159597

Exact-head CI exception: checks-node-compact-small-18 has the same two sparse-runner missing-prerequisite failures as unrelated PR openclaw#160075 run 36528303180. All other execution jobs passed or skipped. See PR Evidence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant