Skip to content

perf(node-host): start worker launch helpers faster on session hosts - #160163

Merged
steipete merged 1 commit into
mainfrom
codex/node-parity-l2-launch
Sep 28, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/node-parity-l2-launch

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Sessions placed on a paired node pay avoidable helper startup latency before every worker turn.

User Impact

Warm POSIX worker launch improved by about 57 ms (17%) in the original live comparison. Update and restart the node host to receive the improvement. Full parity with Gateway-local turns remains unfinished.

Why This Change Was Made

The service relay starts a group anchor, which prepares lineage completion before spawning the worker. Building both helpers in the shared runtime graph pulled unrelated chunks into that critical path. Registering them with the existing standalone build owner avoids that work without duplicating runtime logic.

Stable artifact paths, durable startup gating, capacity admission, custody, cancellation, process-tree retirement, crash recovery, and container enforcement are unchanged. There is no protocol/schema change or new capability negotiation; the released legacy-worker startup contract remains supported.

The cleanup removes the eager runtimeProcessCoreBuildEntries export. Full-repository search found only its memory-test consumer, which now invokes the existing builder directly. Production LOC against the rebased merge base: +2 / −3, net −1. No coverage was removed.

Evidence

Refreshed onto main 8167e77d11148eb582ed7863e6e3f4c89b94023d, which contains the container-timeout diagnostics, heartbeat fixture, and compiler-guard fixes. The branch is one commit, 39c13d260e981dcbdfb0b73e8547b27ff6d2bb5a. The rebase had no conflicts, and the combined old/new diffs have identical stable patch IDs (7f3ebdba922943e707a9bc8be38fd7b3b26f5fdc).

Fresh validation on the assigned Linux AWS Crabbox lease after syncing the new base and running CI=1 pnpm install --frozen-lockfile:

  • pnpm tsgo:core: passed, 14.07 s wall.
  • Independent Codex branch autoreview against the pinned merge base, including build configuration, schema plugin, and lineage writer context: scoped-clean through P2.
  • git diff --check: passed. Production LOC remains +2 / −3, net −1 against the merge base. The requested original-base calculation reports +141788 / −175358, net −33570; it includes unrelated main history and is not this PR's savings.

Focused tests, build, and live timing evidence below are retained from pre-refresh candidate 393cc005e2cd17658badc2b57003f1581d26a3d6. They were not rerun for this patch-identical, conflict-free rebase, per the refresh work order:

  • Complete test/scripts/tsdown-runtime-config.test.ts, test/scripts/tsdown-config.test.ts, test/scripts/tsdown-build.test.ts, and test/scripts/tsdown-declaration-resolution.test.ts via node scripts/run-vitest.mjs ... --maxWorkers=1: 262 passed, 4 existing skips; 80.21 s wall. The modified runtime-config file took 0.288 s test time. Standalone cost via pnpm test test/scripts/tsdown-runtime-config.test.ts --maxWorkers=1: 32 passed, 0.238 s test time / 26.02 s wrapper wall (mostly source transformation).
  • Complete service-child-group-anchor.preparation, service-child-relay-host.owned-worker, and doctor-session-sqlite.memory test files: 19 passed; 135.07 s wall. Startup cancellation, durable worker gating, cleanup, and the existing 256 MiB import budget remain covered.
  • pnpm tsgo:core, pnpm tsgo:scripts, and pnpm tsgo:test:root: passed. Targeted oxfmt --check: passed.
  • Instrumented qaRuntime build: 41.2 s, then real-provider measure.sh npl11 3 succeeded. Instrumentation remains lease-only.

Retained warm-turn measurements (turns 2 / 3, milliseconds):

Metric Original base Pre-refresh candidate
Dispatch → worker child PID 333 / 329 278 / 282
Node client TTFT 2785 / 2298 2689 / 2363
Node client final 3806 / 3777 3565 / 3278
Local client TTFT 1367 / 1532 1103 / 1216
Local client final 1618 / 1679 1356 / 1439

The measurement baseline uses 204b00bf083e and the measured candidate uses merge-base 56376753f832, so it verifies the retained improvement without isolating every intervening main change. Provider variability prevents attributing end-to-end movement solely to this patch. Live proof covers Linux; no new macOS, Windows, Bun, or live-container proof is claimed. Child module loading and workspace reconciliation remain unchanged; this does not add warm processes, defer durability, or cache authority.

Earlier CI found a PR-caused schema-plugin expectation omission, now included in the single commit: both standalone executable graphs retain schema inlining, with negative coverage for other graphs. Later run 36389229458 passed preflight but failed on two inherited planner assertions in test/scripts/ci-changed-node-test-plan.integration.test.ts: duplicate hourly ownership of the device-pair doctor test and mismatched UI runner size. Both reproduced on pinned main 5c467fb8f27c52846ca42f6ec398d610c84c1f9c (34 passed, the same 2 failed; 148.26 s wall). That historical failure cancelled downstream coverage; those cancelled checks were not passes.

Final refreshed-head CI: run 36403190142 tested 39c13d260e981dcbdfb0b73e8547b27ff6d2bb5a and completed successfully: 84 successful jobs, 23 skipped, zero failures. Preflight, all selected test shards, artifact checks, lint, and boundary checks passed. No reruns, manual workflow dispatches, CI-limit changes, or retry-only pushes were used. The PR remains open and unmerged.

Both the openclaw/ci-gate check run and commit status are successful on the final head. The status publication's Security Review run 36404810158 is linked for provenance. No failing or pending PR checks remained at verification.

@clawsweeper

clawsweeper Bot commented Sep 28, 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.

@steipete
steipete marked this pull request as ready for review September 28, 2026 05:38
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts commands Command implementations size: XS labels Sep 28, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 28, 2026, 6:06 AM ET / 10:06 UTC (Revision 5).

ClawSweeper review

What this changes

The PR builds the node host’s service relay and process-group anchor as separate launch artifacts, adjusts build and test coverage, and documents the restart needed to receive the improvement.

Merge readiness

⛔ Blocked before merge - 2 items remain

Current main has not absorbed this startup optimization. The patch has no discrete correctness finding, but the installed node-host upgrade and older-worker compatibility case remains unproven.

Priority: P2
Reviewed head: 39c13d260e981dcbdfb0b73e8547b27ff6d2bb5a

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch and Linux runtime measurements are useful, but the required installed-upgrade case limits merge confidence.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (terminal): The standalone build entries package the relay and anchor used by hosted turns; the PR body reports successful real-provider Linux turns on an earlier patch-equivalent candidate and faster warm child startup. That proof does not cover an installed host upgrade with an older worker bundle. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The standalone build entries package the relay and anchor used by hosted turns; the PR body reports successful real-provider Linux turns on an earlier patch-equivalent candidate and faster warm child startup. That proof does not cover an installed host upgrade with an older worker bundle. No stored-data contract changes.
Evidence reviewed 8 items Introduced build change: The pinned merge-base-to-head diff adds the relay and anchor to the standalone build list and removes an eager build-entry export.
Current-main necessity: Fetched current main still leaves both launch helpers outside the standalone build list.
Build and launch boundary: The build gives each standalone entry a configuration without code splitting; the runtime resolver keeps the named packaged worker path.
Findings None None.
Security None None.

How this fits together

A Gateway session turn can run on a paired node host. The host starts launch helpers before the worker; their packaged code affects startup time and must remain usable when the host updates.

flowchart LR
A[Gateway session turn] --> B[Paired node host]
C[Packaged launch artifacts] --> B
B --> D[Service relay]
D --> E[Process-group anchor]
E --> F[Worker turn]
F --> G[Result and cleanup]
Loading

Before merge

  • Resolve merge risk (P1) - A node host installed from a published release may fail to start or serve an older retained worker bundle after updating and restarting with the separately packaged helpers; that upgrade path has not been exercised.
  • Complete next step (P2) - Capture a published-release-to-candidate node-host update and restart, then show a completed hosted turn using an older worker bundle.
Agent review details

Security

None.

PR surface

Tests +12, Docs +6, Other -1. Total +17 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 4 25 13 +12
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 3 -1
Total 6 33 16 +17

Review metrics

Metric Value Why it matters
Warm worker startup 333/329 ms baseline; 278/282 ms candidate Two reported Linux turns show faster child startup, although the compared revisions include other main changes.

Merge-risk options

Maintainer options:

  1. Prove the installed upgrade (recommended)
    Update and restart a published-release node host into this candidate, then complete a hosted turn using an older retained worker bundle.

Technical review

Best possible solution:

Keep the existing standalone build owner and verify that a published node-host installation can update, restart, and complete a hosted turn with an older worker bundle.

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

Not applicable as a bug reproduction: reported Linux hosted-turn timings provide a concrete performance check, but this read-only review did not run it.

Is this the best way to solve the issue?

Yes: the existing standalone build owner is a narrow place to reduce helper startup work. Installed-upgrade compatibility still needs direct proof.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded node-host startup improvement with limited user-facing blast radius.
  • merge-risk: 🚨 compatibility: Changing installed helper packaging leaves published-host update and older-worker startup compatibility unverified.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The standalone build entries package the relay and anchor used by hosted turns; the PR body reports successful real-provider Linux turns on an earlier patch-equivalent candidate and faster warm child startup. That proof does not cover an installed host upgrade with an older worker bundle. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The standalone build entries package the relay and anchor used by hosted turns; the PR body reports successful real-provider Linux turns on an earlier patch-equivalent candidate and faster warm child startup. That proof does not cover an installed host upgrade with an older worker bundle. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Lehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Capture a published-release-to-candidate node-host update, restart, and older-worker hosted-turn trace.

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 (4 earlier review cycles)
  • reviewed 2026-09-28T05:45:10.297Z sha c737e71 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-28T07:06:48.383Z sha 393cc00 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-28T07:21:14.053Z sha 393cc00 :: blocked before merge. :: none
  • reviewed 2026-09-28T09:30:10.057Z sha 39c13d2 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 28, 2026
@steipete
steipete force-pushed the codex/node-parity-l2-launch branch from 393cc00 to 39c13d2 Compare September 28, 2026 09:23
@steipete
steipete merged commit ed911c3 into main Sep 28, 2026
173 checks passed
@steipete
steipete deleted the codex/node-parity-l2-launch branch September 28, 2026 11:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XS 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