Skip to content

fix(nodes): give node sessions the same prompt and bootstrap context as local sessions - #164647

Merged
steipete merged 2 commits into
mainfrom
codex/node-parity-r3-prompt
Oct 4, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/node-parity-r3-prompt

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Prerequisite #164768 is merged as 6a3f4a2bd2612a216cbdd26cc222adab17b32c65. Final candidate: 3ba415841b1a12e8390fd5c9d7ecc9b839ff7b55. Scope and LOC figures compare this head directly with the landed prerequisite.

What Problem This Solves

Fixes missing agent instructions, persona, memory guidance, and conversation context when an OpenClaw session runs on a node instead of the Gateway.

User Impact

Node sessions receive the same selected prompt and bootstrap context as Gateway-local sessions, with workspace paths, host, OS, shell, and process facts describing the node. Prepared instructions remain authoritative when tools change, and runtime-context entries survive transcript commit and replay.

Same-lease live captures at final head 3ba415841b1a confirm identical direct-tool definitions, canonical bootstrap and memory guidance, and sender/time envelopes, with remaining differences describing location, session, and project facts. Provider tool-schema normalization is outside this change; the known Tool Search schema difference remains a separate follow-up.

Why This Change Was Made

The worker assembled a generic coding prompt around a smaller bootstrap instead of using the Gateway's prompt preparation. Node turns now call the existing bootstrap, system-prompt, prompt-hook, and context-engine owners. The node completes execution-host facts and materialized skill paths without rebuilding the selected instructions.

Context selection and settlement remain Gateway-owned. Post-turn context work runs after workspace reconciliation, while the placement claim still holds authority. Model preparation supplies the credential-dependent transcript policy used by prompt preparation. Internal session factories consume prepared resources and tool definitions, removing the redundant default prompt, resource discovery, and fallback tool construction. The documented session-extension SDK and native/Jiti loader remain supported.

Compatibility assessment for the final head: no user configuration key, schema, or configured default changes. src/agents/config.ts only makes the now-private directory helper parameterless after its removed internal factory caller; the installation-directory resolution owner is unchanged. Internal session construction now requires already-prepared inputs. The documented src/plugin-sdk/agent-sessions.ts barrel, extension SDK, and native loader remain supported. No database DDL, session-version bump, or existing-row rewrite is introduced. Historical source-only/marker-only carriers and string/text-block content are covered by exact replay preservation, transcript reopen, subsequent-turn, and legacy owner-mismatch regressions. Existing worker build/provisioning ownership is unchanged.

This is a correctness fix with an approved +152 production-line ceiling. The current diff is +1,728 / -1,579 = +149, counted independently after the prerequisite; none of its deletions are borrowed. There are 117 total paths, 61 production/counting paths, 34 substantive production paths, and 27 mechanical/deletion/bookkeeping paths. This includes the new sibling containing the moved context-engine begin operation. The detailed growth and deletion ledgers are below.

Evidence

  • The SDK regression failed on the prerequisite: it received the generic coding prompt instead of the supplied OpenClaw prompt. The repaired candidate passes that regression.
  • Before the latest repairs, 899 distinct tests passed across 52 whole files and sibling suites, covering prompt construction, bootstrap selection, context-engine lifecycle, session ownership, custom-context transport/replay, tool policy, and stable skill paths. Tests ran through node scripts/run-vitest.mjs <whole files> --maxWorkers=1; this remains prior-head evidence.
  • Prior-head production and relevant agent/session/Gateway test types passed. Typed lint passed on 106 files; formatting passed on 108 files. Script, production, and full-tree unused-export scans each reported zero findings. The mock-export guard passed. Documentation validation checked 14,867 links with zero errors.
  • The pre-repair full build passed in 635.64 seconds. Independent Codex review, repeated after rebase, was scoped-clean through P2. Post-rebase production and three scoped test-type lanes passed, as did all 108 changed formatted files on AWS. These results do not claim final repaired-head validation.
  • Four replay regressions failed on 5c6bd12a before repair. After repair, 68 tests across three whole files passed in 176.38 seconds. The replay repair also passed its types, lint, formatting, and scoped review.
  • The context-owner/cycle repair passed 75 cases across three whole files in 42.46 seconds; Madge reports zero cycles and the assertion ratchet is green. The foreground prompt-submit fixture passed 16 tests in 16.23 seconds after its capture repair.
  • Repository-wide call-index discovery covered 80 relevant symbol-consumer files and 220 indexed or one-shot fixtures. Affected session/compaction fixtures were migrated with the owner changes.
  • Final live proof on one AWS lease compared the prerequisite with 3ba415841b1a: all 24 turns completed with exact pong responses. The final candidate's local/node tool arrays matched byte-for-byte, both included all five selected bootstrap markers and Memory Recall, and each session retained identical system/tool/cache-key bytes across six turns.
  • The corrected detached-context suite passes 17 cases in 82.63 s, and the worker fault-injection suite passes 15 cases in 52.34 s. Production and agent/Gateway/infra test types pass; formatting passes on all 112 changed formatted files. Final repair review is scoped-clean through P2. ClawSweeper completed its exact-head review at 2026-10-04T07:07:33.545Z (comment 5975234314, run 37184627893), confirming both replay findings resolved and no remaining blocking correctness finding. Its generic config-compatibility checklist is addressed above. Final-head CI run 37184550610 and openclaw/ci-gate pass. Native landing completed: reviewed head 3ba415841b1a merged as 06d4475d6079aaa875a9b477ac0935d1459b1023; main ancestry was verified. The initial CI failures and verified repairs are recorded below; no green final-head CI result is claimed.
Regression boundaries, fixture repairs, and measured test cost

The primary prepared-prompt regression is src/agents/sessions/sdk.test.ts, “preserves an exact base system prompt when active tools change.” On the prerequisite it fails with the old “expert coding assistant” prompt instead of the supplied “personal assistant running inside OpenClaw” prompt.

src/gateway/worker-environments/worker-turn-execution.test.ts checks canonical agent instructions, persona and user context, selected execution-project instructions, node workspace paths, and current sender context at the actual launch boundary. It also verifies that unselected execution-workspace persona files remain excluded. src/worker/worker.runtime.test.ts includes the prompt suite that checks exact prepared prompt bytes and two-turn runtime-context persistence/replay. worker-turn-context-engine.test.ts verifies both direct and outer-owned settlement, including reconciled workspace contents and live claim authority during post-turn work.

Two custom-provider Ultra fixtures initially failed before their intended capacity-error boundary because the new model preparation performs auth resolution earlier. The fixtures now supply synthetic provider credentials; the approval owner remains exercised. The repaired whole worker execution file passes all 26 cases.

The retained legacy-store/Doctor owner-mismatch regression initially omitted the original ownership-inspection precondition before its filesystem snapshot. That made SQLite's first inspection create WAL/SHM files only in the later snapshot. Restoring the inspection before the baseline snapshot preserves the original migration invariant; the final whole auth-migration file passes all 17 cases. No snapshot exclusions or weakened migration assertions were added.

The changed settings mock now explains its isolation, and its obsolete mock-baseline entry was pruned. An unused test import and a shadowed fixture variable were corrected. The unused internal LoadExtensionsResult re-export was removed; the virtual SDK still exports the public type directly from its owner.

Recorded wall time: the initial multi-suite batch took 604.50 seconds and exposed the two custom-provider fixture failures; the repair/remainder batch took 606.76 seconds; the final whole auth-migration file took 46.11 seconds including runner preparation. These are separate invocations with overlap, not an additive CI estimate. The worker execution file reported 126.20 seconds of Vitest duration on its successful whole-file run. The transport and context-engine suites use existing fixtures because the contracts cross launch, transcript persistence, workspace publication, and authority settlement; pure renderer tests cannot prove those boundaries.

Pre-repair AWS whole-file timings via pnpm test <file> --maxWorkers=1: resource-loader 36.60 s (5 tests), skill resources 13.09 s (20 tests), SDK 25.35 s (33 tests), worker execution 128.94 s (26 tests), worker context engine 62.16 s (2 tests), and worker runtime 66.50 s (84 tests). All 170 cases passed. These reran the changed rebase inputs and recorded separate primary-boundary costs; they do not cover the later repairs. Final-head CI passes: 51 successful Node jobs total 9,727 job-seconds, including setup; this is aggregate selected-lane cost, not incremental per-test cost.

The initial CI run exposed five failing jobs:

  • The assertion ratchet retained one obsolete agent-session-extensions.ts entry after duplicate tool construction was removed. The exact stale entry is now pruned; the ratchet passes.
  • Madge found a reverse import between context-engine-logical-turn.ts and context-engine-turn-attempt.ts. The unchanged ordered begin operation now lives in context-engine-turn-begin.ts; callers import it there. This moves existing behavior without adding another policy owner. Madge reports zero cycles, with 75 context-owner cases passing across three whole files in 42.46 seconds.
  • Six detached-context cases expected raw transcript text at the projected model boundary. Their expectations now include the deterministic timestamp envelope, while separate raw-transcript, prefix-ordering, and exclusion assertions remain unchanged. The corrected whole suite passes all 17 cases in 82.63 seconds.
  • Six worker fault-injection cases supplied skill resources without the authoritative prepared skill prompt, then tried to extract a materialized location from that missing catalog. Their descriptors now carry the selected snapshot's prompt alongside its resources. The cleanup/failure assertions remain unchanged; the corrected whole suite passes all 15 cases in 52.34 seconds.
  • Eleven foreground prompt-submit cases used structuredClone(context). Correctly activated custom tools now carry execute functions, causing a verified DataCloneError before the fixture recorded a request. The three capture sites now clone messages and retain tool handles shallowly. All 16 cases pass in 16.23 seconds; no production workaround was added.

Review also found two replay defects. Historical runtime carriers identified by source-only or marker-only metadata, with either string or text-block content, must retain their provider-visible bytes. Replay admission must also reserve the complete current-turn message budget, including the runtime-context carrier. Both are repaired at the worker message/window owners. Four regressions failed on 5c6bd12a; the repaired transcript-message, worker-turn-payload, and worker-turn-execution whole files pass 68 tests in 176.38 seconds. The final whole payload file additionally passes all 25 cases in 52.84 s via pnpm test <file> --maxWorkers=1; its transport-boundary image/replay cases account for the cost. Typed lint passes on all nine remaining repair files. These repair batches overlap earlier proof and must not be summed into a new distinct-test total.

Final-head live provider capture and performance proof

All results below use the final repaired head 3ba415841b1a12e8390fd5c9d7ecc9b839ff7b55.

Captured exact OpenAI request bodies on one AWS lease at baseline 6a3f4a2bd261 and candidate 3ba415841b1a, with the same agent configuration and six local plus six node turns per head. The baseline/final runtime builds took 53.2/53.6 seconds. Lab-only capture was restored out of source after each build; candidate source SHA-256 stayed c71ba4c5146d4975d60b15a97a6b3823a610c9f9c60e4fd9c2c1ba22729e3bb8. All 24 turns completed with exact expected pong outputs.

The controlled tool configuration uses tools.codeMode.enabled=false, tools.toolSearch=false, and a read/write/edit/memory allowlist. The admitted surface also includes apply_patch and skills_read, for seven function tools. This exercises the shared prompt owner without importing the excluded Tool Search schema-normalization change.

Provider-boundary proof Baseline local / node Candidate local / node
System-prompt characters 19,890 / 11,385 19,890 / 20,949
Canonical bootstrap markers 5 / 0 5 / 5
Memory Recall guidance present / missing present / present
Selected skills same 20 names/descriptions/order; different paths same 20 names/descriptions/order; stable materialized node paths
Tools same seven function definitions; node adds native web search identical complete seven-tool arrays
Initial user-message text timestamp + sender + prompt / prompt only same timestamp/sender envelope and prompt; current-turn timestamps differ
Within-session system, tool, cache-key bytes stable across six turns in each placement stable across six turns in each placement

Both 3ba415841b1a tool arrays have normalized JSON SHA-256 26bbd96af432548b71c0354c8e7673f8f83f34039b6186562949f9909b42b109. Both prompts contain identical synthetic Parity fixture: <filename> canonical agent context. markers for AGENTS.md, SOUL.md, IDENTITY.md, USER.md, and MEMORY.md. TOOLS.md and HEARTBEAT.md are excluded by the existing canonical bootstrap policy; they are not node omissions.

The baseline generic coding prompt bypassed worker-turn-prompt's now-shared owners: it lost canonical style/execution/control guidance, bootstrap persona/user/memory, memory-recall instructions, runtime/time/channel context, and the sender envelope. The remaining 3ba415841b1a system diff contains only these classes:

  • Twenty skill locations: Gateway source paths become stable materialized node paths; names, descriptions, and ordering match.
  • Working directory and runtime repository: local session worktree versus node execution workspace.
  • Documentation/source locations: local checkout paths versus docs mirror/GitHub, with corresponding lookup instructions because those local checkout paths are unavailable to the node.
  • Project-memory identifier and session key: the two separately created sessions have distinct source worktrees/identities.
  • Executor facts: host/OS/architecture/runtime are completed on the executor, and shell is local bash versus node sh; the runtime-line field order changes accordingly.

After those location/session/project fields, the system diff is empty. All six 3ba415841b1a user messages match after normalizing their actual UTC turn timestamps; the synthetic sender envelope and user text are identical. Full-system/tool/cache-key stability is checked across all six turns; independent session keys intentionally yield separate cache keys. Transcript persistence/replay is additionally covered by the two-turn worker boundary regression.

Warm medians exclude turn zero (five observations per placement). Prompt tokens include input plus cache reads and writes; cached tokens are cache reads.

Warm median Baseline local Baseline node Candidate local Candidate node
TTFT, ms 1,433 1,383 1,106 1,491
Final, ms 1,676 1,905 1,332 2,051
First delta to final, ms 227 520 226 560
Prompt tokens 5,713 8,417 5,704 6,237
Cached tokens 4,686 7,540 4,686 5,710

Node warm TTFT increases 108 ms in this sample; tail increases 40 ms. No tail-speed improvement is claimed. The restored node context reuses a 5,710-token cached prefix on every warm turn. Baseline node token totals are confounded by its extra native web-search tool, so this fresh capture proves missing context rather than reproducing the historical half-token ratio.

This live lane covers direct WebChat, UTC, Linux execution facts, selected canonical bootstrap, catalog presence, and prompt cache reuse. It does not claim group-channel, non-UTC, cross-OS, actual skill-read or memory-retrieval proof. Those behavior families remain outside this live lane.

Per-file positive production growth justification

All deltas use the campaign classifier against the prerequisite head. Added sibling modules include code moved from existing owners; the paired reductions explain that accounting.

File Net lines Required responsibility
packages/agent-core/src/harness/messages.ts +14 Preserve typed operator-context metadata when projecting persisted system updates into model messages.
packages/gateway-protocol/src/schema/worker-admission.ts +38 Define bounded custom runtime-context messages and fragments, preserving admitted historical source/marker shapes and string/text-block content through launch and commit.
packages/gateway-protocol/src/schema/worker-inference.ts +1 Carry the existing typed operator-message marker through inference validation.
packages/gateway-protocol/src/schema/worker-protocol-primitives.ts +1 Share the operator-message field schema across worker message surfaces.
packages/gateway-protocol/src/worker-transcript-budget.ts +2 Preserve frame-budget checks for both string custom messages and structured image content.
src/agents/embedded-agent-runner/run-entry.ts +2 Forward the canonical bootstrap workspace through run admission.
src/agents/embedded-agent-runner/run/attempt-bootstrap-prepare.ts +6 Narrow the existing builder's inputs so worker preparation can reuse it without a fabricated local session.
src/agents/embedded-agent-runner/run/attempt-prompt-build.ts +13 Share prepared message context and separate execution-host facts from Gateway-owned context.
src/agents/embedded-agent-runner/run/attempt-system-prompt-prepare.ts +15 Accept node execution/reference paths and prepared tool projections while preserving the canonical renderer and refresh policy.
src/agents/embedded-agent-runner/run/context-engine-admission.ts +2 Reuse admission for worker turns and release an owned context-engine lease on setup failure and disposal.
src/agents/embedded-agent-runner/run/run-settlement.ts +2 Settle the context-engine admission through its shared disposal owner.
src/agents/embedded-agent-runner/run/runtime-context-prompt.ts +13 Extract the existing carrier-retention operation for use at both local and worker inference boundaries.
src/agents/harness/context-engine-lifecycle.ts +124 Own shared prompt assembly and post-turn candidate/finalization handling; replaces 57 lines in history preparation and 33 lines in local finalization. Transcript anchor reads use the async hydration owner.
src/agents/harness/context-engine-turn-begin.ts +26 Hold the exact existing selection/drain/begin operation in a sibling that removes the reverse-import cycle; paired with 24 lines removed from context-engine-logical-turn.ts. No new policy is introduced.
src/agents/runtime-execution-facts.ts +87 Move process/approval facts to an execution-host builder; paired with 79 lines removed from runtime-facts-prompt.ts.
src/agents/runtime-prompt.ts +16 Share project preparation and leave node host/OS/shell facts for the actual executor.
src/agents/sessions/system-prompt-metadata.ts +13 Retain extension-visible prompt metadata after deleting the 138-line competing generic prompt renderer.
src/agents/system-prompt-report.ts +2 Report prepared tool schemas without requiring executable tool handles.
src/agents/system-prompt-runtime.ts +51 Share Runtime-line rendering and complete its owned region with node facts; paired with 41 lines removed from system-prompt.ts.
src/gateway/worker-environments/inference-model.ts +176 Share approved model, credential, and transcript-policy preparation; paired with 132 lines removed from inference-runtime.ts. No tool-schema normalization is added.
src/gateway/worker-environments/transcript-commit.kernel.ts +5 Commit custom context entries through the existing transcript owner.
src/gateway/worker-environments/worker-gateway-tool-contract.ts +2 Expose the retained tool runtime's prompt projection and prompt-policy operation.
src/gateway/worker-environments/worker-gateway-tool-runtime.ts +32 Build prompt discovery guidance from the admitted tool surface and apply hook restrictions to that same surface.
src/gateway/worker-environments/worker-turn-payload.ts +158 Preserve historical custom-context bytes, reserve the complete current-turn message budget before admitting replay, and own result/context settlement after workspace publication with current claim checks. Result handling moves out of turn execution.
src/gateway/worker-environments/worker-turn-prompt.ts +264 Connect the existing bootstrap, system-prompt, hook, context-engine, and runtime-context builders to an admitted worker turn. It does not introduce a second renderer.
src/skills/runtime/resources.ts +29 Rewrite compact/XML skill locations to stable materialized paths while preserving selected descriptions and order.
src/worker/embedded-agent-transcript.runtime.ts +1 Select transcript projection explicitly so custom context enters the existing commit queue.
src/worker/embedded-agent.runtime.ts +15 Consume the prepared prompt, add executor facts, and persist custom context instead of assembling a separate node bootstrap.
src/worker/launch-descriptor.ts +9 Validate the typed context fragments and replay-policy facts required by the worker.
src/worker/replay-message-window.ts +3 Account for string custom entries while preserving bounded replay.
src/worker/transcript-message.ts +31 Preserve validated historical custom context and operator metadata for launch/commit while keeping provider inference projection distinct.

The main reductions are the prepared-only session factory (-141), generic session renderer (-138), duplicate tool construction (-99), session prompt/default state (-77), resource-loader defaults and duplicate settings reload (-66), local history assembly (-57), Runtime renderer move (-41), local finalization (-33), prompt-transform plumbing (-24), context-engine begin extraction from the logical-turn module (-24), node bootstrap assembly (-18), attempt session setup (-14), and compaction setup (-11). These removals are all within the affected prompt/session/worker owners.

Mechanical migration, deletion, and retained-contract ledger

These 27 paths are outside the 34 substantive production paths. They remain included in the production LOC total.

Path Classification
config/assertion-safety-baseline.txt Shrink both obsolete assertion entries, including the stale session-extension entry identified by CI.
config/test-mock-exports-baseline.txt Shrink the entry for the now-explained isolated mock.
src/agents/cli-runner/prepare.ts Migrate ordered context-engine selection/drain/begin to the shared operation.
src/agents/config.ts Make the obsolete factory-only directory-resolution export private and remove its unused argument.
src/agents/embedded-agent-runner/run-entry.ts Forward the existing bootstrap workspace input.
src/agents/embedded-agent-runner/run-orchestrator.ts Use the extracted project-prompt preparation owner.
src/agents/embedded-agent-runner/run/attempt-bootstrap-prepare.ts Narrow builder parameter types and make local timing instrumentation optional.
src/agents/embedded-agent-runner/run/attempt-history-prepare.ts Move context-engine assembly to the shared owner with the same local inputs.
src/agents/embedded-agent-runner/run/attempt-system-prompt.ts Simplify provider-transform forwarding while retaining prompt-region refresh behavior.
src/agents/embedded-agent-runner/run/run-settlement.ts Consume the admission owner's disposal operation.
src/agents/embedded-agent-runner/run/runtime-context-prompt.ts Extract unchanged runtime-carrier retention logic.
src/agents/harness/context-engine-logical-turn.ts Remove the superseded selection wrapper and keep logical-turn state free of the reverse import.
src/agents/harness/context-engine-turn-begin.ts Move the exact ordered selection/drain/begin operation into an acyclic sibling; no policy change.
src/agents/harness/selection.ts Migrate the local harness caller to that sequence.
src/agents/package-metadata.ts Delete documentation-path helpers used only by the retired generic prompt.
src/agents/runtime-execution-facts.ts Extract existing execution-host facts for reuse on the node.
src/agents/sessions/agent-session.ts Initialize activation from the required prepared allowlist.
src/agents/sessions/extensions/index.ts Remove the unused internal LoadExtensionsResult re-export; the public virtual SDK retains the type through its owner.
src/agents/sessions/extensions/runner.ts Move the prompt-metadata type import.
src/agents/sessions/extensions/types.ts Move the prompt-metadata type import.
src/agents/sessions/system-prompt-metadata.ts Retain the metadata contract separately from the retired renderer.
src/agents/sessions/system-prompt.ts Delete the superseded generic prompt renderer.
src/agents/system-prompt-report.ts Narrow report inputs to descriptive tool data.
src/agents/system-prompt.ts Move Runtime-line rendering to its reusable sibling.
src/gateway/worker-environments/worker-turn-rpc.ts Consume the renamed prompt projection.
src/gateway/worker-environments/worker-turn-user-message.ts Consume the renamed prompt projection.
src/worker/embedded-agent-transcript.runtime.ts Pass the explicit transcript-projection purpose.

The other 56 paths are documentation, tests, test support, or test routing. Fixture changes supply prepared resources/tools, distinguish raw transcripts from model-bound projections, avoid cloning executable tool handles, exercise the new context boundaries, and preserve lifecycle and migration coverage. Tests tied only to the retired internal default session creation or generic renderer are removed; the legacy owner-mismatch Doctor contract remains covered.

Retained contracts: src/plugin-sdk/agent-sessions.ts, src/agents/sessions/extension-sdk.ts, the native/Jiti extension loader and its tests, and the virtual-SDK Knip entry. There is no public SDK deprecation or removal in this change.

@clawsweeper

clawsweeper Bot commented Oct 4, 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 docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: XL labels Oct 4, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 4, 2026, 3:24 AM ET / 07:24 UTC (Revision 6).

ClawSweeper review

What this changes

Node-hosted sessions reuse Gateway-selected instructions, bootstrap files, and conversation context while adding node execution facts and preserving runtime context through transcript replay.

Merge readiness

⛔ Blocked before merge - 1 item remains

The fix remains necessary on current main. The previous replay findings are resolved, and source inspection supports the final compatibility assessment; no additional blocking defect was found.

Priority: P1
Reviewed head: 3ba415841b1a12e8390fd5c9d7ecc9b839ff7b55

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong final-head provider proof and focused replay repairs support a useful patch with no remaining blocking finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Final-head AWS provider captures exercise Gateway preparation through local and node turns and show restored bootstrap, memory guidance, sender envelopes, and stable prompt/tool bytes. Historical carrier preservation, transcript reopen, and subsequent-turn replay support existing-state compatibility without a schema migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Final-head AWS provider captures exercise Gateway preparation through local and node turns and show restored bootstrap, memory guidance, sender envelopes, and stable prompt/tool bytes. Historical carrier preservation, transcript reopen, and subsequent-turn replay support existing-state compatibility without a schema migration.
Evidence reviewed 9 items Pinned introduction and clean checkout: Reviewed the introduced delta from the landed prerequisite 6a3f4a2 to the exact head 3ba4158. The checkout remained clean; the stale test merge was not used to infer removal of base-branch behavior.
Current-main necessity: Fetched main still constructs node context through the smaller bootstrap and resource-loader prompt additions, rather than the shared Gateway preparation introduced here. The merged prerequisite #164768 explicitly excludes the node prompt-parity behavior.
Shared preparation owner: Worker prompt preparation calls the existing bootstrap, system-prompt, context-engine, and prompt-context owners. The worker consumes that prepared text and completes execution-host facts instead of loading ambient persona files or rebuilding a generic prompt.
Findings None None.
Security None None.

How this fits together

The Gateway prepares an agent's instructions, tools, and conversation history before dispatching execution to a node. The node runs the turn and returns transcript and workspace results for Gateway-owned settlement.

flowchart TD
  A[Session and agent configuration] --> B[Gateway prompt preparation]
  C[Bootstrap files and conversation history] --> B
  B --> D[Prepared worker launch]
  D --> E[Node execution facts and tools]
  E --> F[Provider request]
  F --> G[Transcript and workspace results]
  G --> H[Gateway context settlement]
Loading

Before merge

  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface 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
Production versus test growth Production net +149 lines; tests and test support net +516 lines The production growth is justified by shared worker preparation and replay transport while removing competing prompt and session defaults.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/agents/harness/context-engine-lifecycle.ts, serialized state: src/worker/worker-runtime-prompt.suite.ts, unknown-data-model-change: src/agents/embedded-agent-runner/run/attempt-session-prepare.ts, unknown-data-model-change: src/worker/worker-runtime-prompt.suite.ts, unknown-truncated-pull-files. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep one Gateway-owned prompt preparation path for both placements, with executor-specific facts added on the node and byte-preserving transcript replay.

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

Yes: current-main source shows the reduced node prompt path, and the recorded baseline provider capture demonstrates missing bootstrap markers and Memory Recall guidance; this review did not execute it.

Is this the best way to solve the issue?

Yes: reusing the existing Gateway preparation owners removes the competing node renderer while preserving public SDK contracts and executor-specific facts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 61ef2a47fdc5.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Node-hosted agent turns currently omit selected instructions, persona, memory guidance, and conversation context.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Final-head AWS provider captures exercise Gateway preparation through local and node turns and show restored bootstrap, memory guidance, sender envelopes, and stable prompt/tool bytes. Historical carrier preservation, transcript reopen, and subsequent-turn replay support existing-state compatibility without a schema migration.
  • proof: sufficient: Contributor real behavior proof is sufficient. Final-head AWS provider captures exercise Gateway preparation through local and node turns and show restored bootstrap, memory guidance, sender envelopes, and stable prompt/tool bytes. Historical carrier preservation, transcript reopen, and subsequent-turn replay support existing-state compatibility without a schema migration.

Evidence

What I checked:

  • Pinned introduction and clean checkout: Reviewed the introduced delta from the landed prerequisite 6a3f4a2 to the exact head 3ba4158. The checkout remained clean; the stale test merge was not used to infer removal of base-branch behavior. (3ba415841b1a)
  • Current-main necessity: Fetched main still constructs node context through the smaller bootstrap and resource-loader prompt additions, rather than the shared Gateway preparation introduced here. The merged prerequisite refactor(sdk): retire superseded worker prompt/bootstrap SDK exports #164768 explicitly excludes the node prompt-parity behavior. (src/worker/embedded-agent.runtime.ts:121, 61ef2a47fdc5)
  • Shared preparation owner: Worker prompt preparation calls the existing bootstrap, system-prompt, context-engine, and prompt-context owners. The worker consumes that prepared text and completes execution-host facts instead of loading ambient persona files or rebuilding a generic prompt. (src/gateway/worker-environments/worker-turn-prompt.ts:125, 3ba415841b1a)
  • Previous findings resolved: The exact-head commit patch accepts source-only or marker-only historical carriers with string or text-block content and reserves two current-turn slots when runtime context is present. Focused regressions cover exact carrier preservation and replay-window rejection. GitHub commit patches supplied the prior-head comparison after local historical blob retrieval failed. (packages/gateway-protocol/src/schema/worker-admission.ts:213, 3ba415841b1a)
  • Compatibility assessment verified: The compatibility comment at fix(nodes): give node sessions the same prompt and bootstrap context as local sessions #164647 (comment) matches the diff: config.ts removes an unused internal parameter, the public agent-session barrel remains intact, and no database DDL or session-version change is introduced. Transcript tests exercise custom-context commit, idempotent replay, reopen, and subsequent-turn preservation. (src/agents/config.ts:6, 3ba415841b1a)
  • Final-head real behavior proof: The fully retrieved body matches captured SHA-256 940adb359bcb86be1fde8d6d675066220ba8a36ac32d9e40faf9e1065977c2a1. Its same-lease baseline/candidate provider captures report 24 completed turns, all five selected bootstrap markers, Memory Recall guidance, identical seven-tool arrays, matching sender envelopes, and stable system/tool/cache-key bytes across six turns per placement. The live scenario explicitly excludes Tool Search normalization, group channels, cross-OS behavior, and actual memory retrieval. (src/worker/embedded-agent.runtime.ts:274, 3ba415841b1a)

Likely related people:

  • steipete: 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 (5 earlier review cycles)
  • reviewed 2026-10-04T01:03:40.934Z sha 77d5e11eb9a59d404382d7751cd94367fef2eed0 :: blocked before merge. :: [P1] Preserve supported legacy carriers in worker launch history
  • reviewed 2026-10-04T03:34:43.889Z sha 77d5e11eb9a59d404382d7751cd94367fef2eed0 :: blocked before merge. :: [P1] Preserve supported legacy carriers in worker launch history
  • reviewed 2026-10-04T03:57:13.140Z sha 77d5e11eb9a59d404382d7751cd94367fef2eed0 :: blocked before merge. :: [P1] Preserve supported legacy carriers in worker launch history | [P2] Budget the runtime carrier alongside the current user message
  • reviewed 2026-10-04T06:44:18.723Z sha 5c6bd12 :: blocked before merge. :: [P1] Preserve supported legacy carriers in worker launch history | [P2] Budget the runtime carrier alongside the current user message
  • reviewed 2026-10-04T07:07:33.545Z sha 3ba4158 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 4, 2026
…as local sessions

Node turns used a generic coding prompt and incomplete workspace bootstrap.
Prepare their context through the existing Gateway prompt and bootstrap owners,
preserve typed runtime context in the transcript, and complete execution-host
facts on the node. Keep prepared prompts authoritative when tools change.

Retire internal session defaults made redundant by prepared inputs while
preserving the documented session-extension SDK and native loader. Context
selection and settlement remain Gateway-owned, after workspace reconciliation.
Provider schema normalization is excluded.

The SDK regression fails on the original prompt owner. Validated 899 tests
across 52 whole files and siblings after fixture repairs; production and scoped
test types, lint, export guards, documentation links, and P0-P2 Codex review pass.
Production delta versus the prerequisite refactor: +147 lines.

Committed with --no-verify because this sparse checkout has no dependencies;
pnpm exec oxfmt --check passed on the validation lease. Full build and AWS live
capture/performance proof must complete before publication.
@steipete steipete changed the title fix: preserve agent context in node-hosted sessions fix(nodes): give node sessions the same prompt and bootstrap context as local sessions Oct 4, 2026
@steipete
steipete force-pushed the codex/node-parity-r3-prompt branch from 77d5e11 to 5c6bd12 Compare October 4, 2026 06:37
@steipete
steipete marked this pull request as ready for review October 4, 2026 06:38
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 4, 2026
Preserve supported historical runtime-context metadata and content, and reserve
both current-turn message slots before windowing anchored replay. Regressions
fail on the prior head and pass after this repair. Keep the shared turn-begin
operation outside the lease/attempt import cycle and prune its obsolete
assertion-baseline entry. Update prompt fixtures for prepared skills,
timestamped model projections, and active executable tool handles.

Whole replay, context-owner, and affected fixture suites pass, along with core
and scoped test types, import-cycle and assertion guards, and P0-P2 Codex review.
The complete PR remains +149 production lines against the landed prerequisite.

Committed with --no-verify because this sparse checkout has no dependencies;
pnpm exec oxfmt --check passed for the changed files on the AWS validation lease.
@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: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 4, 2026
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer compatibility assessment for 3ba415841b1a12e8390fd5c9d7ecc9b839ff7b55: the remaining config/default checklist is satisfied. There are no user config-key, schema, or configured-default changes. src/agents/config.ts only makes the unused-argument directory helper private after retiring its internal factory caller; the installation-directory resolution owner is unchanged. The documented src/plugin-sdk/agent-sessions.ts surface, extension SDK, and native loader remain supported.

There is no database DDL, session-version bump, or existing-row rewrite. The repaired tests preserve source-only and marker-only runtime carriers, string/text-block contents, committed/reopened context, and subsequent-turn replay. All four new replay regressions fail on the prior head and pass after repair; the final capture again proves local/node prompt parity. The PR body records the complete compatibility, CI-repair, and final-head live evidence.

@steipete
steipete merged commit 06d4475 into main Oct 4, 2026
203 checks passed
@steipete
steipete deleted the codex/node-parity-r3-prompt branch October 4, 2026 07:39
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…as local sessions (openclaw#164647)

* fix(nodes): give node sessions the same prompt and bootstrap context as local sessions

Node turns used a generic coding prompt and incomplete workspace bootstrap.
Prepare their context through the existing Gateway prompt and bootstrap owners,
preserve typed runtime context in the transcript, and complete execution-host
facts on the node. Keep prepared prompts authoritative when tools change.

Retire internal session defaults made redundant by prepared inputs while
preserving the documented session-extension SDK and native loader. Context
selection and settlement remain Gateway-owned, after workspace reconciliation.
Provider schema normalization is excluded.

The SDK regression fails on the original prompt owner. Validated 899 tests
across 52 whole files and siblings after fixture repairs; production and scoped
test types, lint, export guards, documentation links, and P0-P2 Codex review pass.
Production delta versus the prerequisite refactor: +147 lines.

Committed with --no-verify because this sparse checkout has no dependencies;
pnpm exec oxfmt --check passed on the validation lease. Full build and AWS live
capture/performance proof must complete before publication.

* fix(nodes): preserve replay carriers and complete prompt budgets

Preserve supported historical runtime-context metadata and content, and reserve
both current-turn message slots before windowing anchored replay. Regressions
fail on the prior head and pass after this repair. Keep the shared turn-begin
operation outside the lease/attempt import cycle and prune its obsolete
assertion-baseline entry. Update prompt fixtures for prepared skills,
timestamped model projections, and active executable tool handles.

Whole replay, context-owner, and affected fixture suites pass, along with core
and scoped test types, import-cycle and assertion guards, and P0-P2 Codex review.
The complete PR remains +149 production lines against the landed prerequisite.

Committed with --no-verify because this sparse checkout has no dependencies;
pnpm exec oxfmt --check passed for the changed files on the AWS validation lease.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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