Skip to content

refactor(agents): split embedded runner orchestration - #106552

Merged
steipete merged 6 commits into
mainfrom
codex/refactor-embedded-runner
Jul 13, 2026
Merged

steipete merged 6 commits into
mainfrom
codex/refactor-embedded-runner

Conversation

@steipete

@steipete steipete commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Related: #72072

What Problem This Solves

The embedded runner entry points mixed queue admission, lifecycle ownership, session bootstrap, progress reporting, model resolution, auth scoping, skill startup, and tool-runtime preparation into two very large orchestration modules. That made ordering and cleanup invariants difficult to review.

Why This Change Was Made

Extract cohesive, narrow helpers while keeping the retry loop and per-attempt stream sequence visible in their owning orchestrators. run.ts drops from 5,092 to 4,413 lines; run/attempt.ts drops from 3,867 to 3,469 lines against current main. Every new production helper is 220 lines or smaller.

The extraction also makes two existing cleanup obligations explicit: restore skill environment overrides when later startup preparation throws, and dispose partially created MCP/LSP runtimes when later bundle preparation fails.

The test-planner guard now gives git ls-files a 16 MiB output buffer. The repository inventory crossed Node's 1 MiB spawnSync default, which truncated discovery and incorrectly forced a filesystem fallback.

User Impact

No intended user-visible behavior change. Internal runner ownership and review surfaces become smaller; existing API, config, protocol, provider, and tool behavior remain unchanged.

Evidence

  • Exact head: 7e66f090fdac712241518d85cdf556ea58cdd6ff
  • Blacksmith Testbox lease: tbx_01kxe70qwrrt6vkm3m8jehfsrk
  • Focused exact-head proof: 365 tests passed across lane timeout, fast-mode progress, attempt orchestration, bundle cleanup, skill startup cleanup, context-engine raw-model gating, extension test planning, and embedded-runner E2E (run).
  • Hosted exact-head CI: 72 successful checks, 41 skipped, 1 neutral, 0 failed or pending.
  • git diff --check passed.
  • Structured autoreview: clean, patch correct, confidence 0.96.
  • Full exact-head pnpm check:changed passed on the same Testbox lease in 12m36.856s, including core/core-test typechecks, tooling checks, all core lint shards, database-first guards, and import-cycle checks.
  • Direct Codex contract inspection: Responses is the only wire API and ChatGPT auth selects the Codex backend (provider source, auth routing); requests still use the Responses transport (client, request contract).

@steipete
steipete requested a review from a team as a code owner July 13, 2026 16:31
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Jul 13, 2026
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Jul 13, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head 7e66f090fdac712241518d85cdf556ea58cdd6ff.

  • Hosted exact-head CI: 72 successful checks, 41 skipped, 1 neutral, 0 failed or pending.
  • Blacksmith Testbox tbx_01kxe70qwrrt6vkm3m8jehfsrk, run 29269018610: 365/365 focused tests passed in 1m19.907s.
  • Focused command: corepack pnpm test src/agents/embedded-agent-runner.e2e.test.ts src/agents/embedded-agent-runner/run.lane-timeout.test.ts src/agents/embedded-agent-runner/run.fast-mode-auto.test.ts src/agents/embedded-agent-runner/run/attempt.test.ts src/agents/embedded-agent-runner/run/attempt-bundle-tools.test.ts src/agents/embedded-agent-runner/run/attempt-startup.test.ts src/agents/embedded-agent-runner/run/attempt.spawn-workspace.context-engine.test.ts test/scripts/test-extension.test.ts
  • Broad command on the same exact head and lease: env OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 corepack pnpm check:changed; passed in 12m36.856s.
  • git diff --check passed. Fresh structured autoreview: no findings, 0.96 confidence.
  • Repo-native review artifacts validated; OPENCLAW_TESTBOX=1 scripts/pr prepare-run 106552 passed and confirmed the remote PR head matches the prepared head.
  • Codex dependency contract checked directly at c7a4a7e136d96554e1fc6f66532e6060fd2aaf15: provider/API selection, auth routing, Responses transport, and request contract.

Known proof gaps: none.

@steipete
steipete merged commit 8d9950d into main Jul 13, 2026
120 checks passed
@steipete
steipete deleted the codex/refactor-embedded-runner branch July 13, 2026 17:22
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 14, 2026
* refactor(agents): split embedded runner orchestration

* test(agents): fix skill startup fixture type

* style(agents): format runner imports

* refactor(agents): remove stale attempt import

* refactor(agents): reuse attempt result slot type

* fix(test): avoid truncating extension test inventory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant