Skip to content

fix: distinguish inbound messages from runtime context - #140859

Merged
steipete merged 4 commits into
mainfrom
codex/runtime-context-role
Sep 7, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/runtime-context-role

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Related: #140404. Cloud-worker follow-up: #140666.

What Problem This Solves

Fixes an issue where inbound message text could be mistaken for OpenClaw-generated runtime context during Gateway-owned prompt assembly. This addresses the structural ambiguity behind @fstrasz's report of legitimate runtime events being refused or described back to the operator.

Why This Change Was Made

Runtime instructions, conversation data, and heartbeat outcomes retain their producer-owned provenance through prompt-prelude.ts, internal-events.ts, and the single Gateway owner in attempt-prompt-build.ts:473. The model boundary in attempt-llm-boundary.ts:71 neutralizes internal-context delimiter mentions and quotes data. The old text-based context classifier is removed; matching message text does not grant runtime provenance. Existing provider message roles stay unchanged because retained thinking can bind to the preceding message prefix.

The existing transcript header selects the projection: genuinely new sessions use version 4, while existing version 3 sessions remain readable and unmigrated. Branching, reset boundaries, compaction, restoration, and replay preserve the source policy. This avoids a new custom policy entry; bounded replay already loads the header, and the header is persisted before the first provider request. Doctor repairs canonical headerless legacy history with version 3 and preserves existing headers, including unknown versions. Creation/adoption initializes a header only when the transcript is physically empty, rechecked inside the queued write. Unknown projection versions fail rather than silently reinterpreting an existing prefix.

Shared command preparation preserves completion content for CLI and worker dispatch. Legacy sessions retain their existing event and MCP App escaping. The Gateway-only producer/projection changes preserve raw user transcript bytes. One append owner keeps full and resumable inbound context aligned, so resumed room CLI turns retain new thread notes, system events, and MCP App snapshots.

Cloud-worker prompt assembly still needs the same hardening through its launch contract. It bypasses the Gateway projection owner; that explicitly deferred work, including worker restart and Gateway/worker transition proof, is tracked in #140666.

User Impact

This is prompt hardening, not an authorization boundary or a guarantee against prompt injection. New Gateway-assembled sessions distinguish user text from runtime-owned instructions and context data. Start a genuinely new session to select the escaped projection; existing sessions retain their policy across replay so earlier provider prefixes are not rewritten. No configuration option, SQL schema, dependency, provider-role migration, or worker protocol change is introduced.

Evidence

Reviewed head: 99c7be243bc5081bda8221c06b08f9f9f4977df9. git diff --check passes. The production candidate and final test-only adjustments passed their changed-file checks. A second conflict resolution preserves main’s relocation of cache observation; all 64 affected tests and its full changed-file check passed. Exact-head hosted CI is green: run 34098328672, including openclaw/ci-gate and Windows.

Production: +626 / -627 (net -1). Tests and support: +858 / -1119 (net -261). Documentation: +20. Counts exclude test fixtures and the Docker proof client from production.

Independent Codex review: scoped-clean at P0–P2 for the staged final candidate. The full compatibility gate and first post-rebase changed check passed. The final candidate has a fresh clean P0–P2 review; both the full second-rebase check and the final correction’s changed-file check passed.

The initial focused proof covered 470 tests across 21 files. After CI exposed compatibility gaps, the Doctor/import suites passed 244 tests, cron passed 26, and prompt-prelude passed 11. The final context/adoption/retry run passed 246 tests across five files; the extracted MCP suite passed all three tests and the remaining lifecycle suite passed 31. These runs retain event selection, exclusion, queue state, MCP consumption, and raw transcript assertions.

Upgrade-compatibility evidence is detailed in the review response: existing 3/4/99 headers and raw event bytes survive repair/adoption; imports below 3 stop at 3; branching reopens versions 3 and 4 unchanged.

New regressions failed before their corrections: resumed source additions and MCP snapshots were missing; Doctor selected version 4 for retained headerless history; and adoption appended a new header to retained history. Corrected tests preserve existing versions 3, 4, and 99, and verify raw event bytes remain unchanged. The first-head CI failures are repaired; the final exact-head hosted run passes the landing gate. The necessary rebase preserved main’s new active process/subagent/media facts and routes them as typed conversation data, including on runtime-only turns; all 99 overlap tests pass. The local install was refreshed to the frozen lockfile after main’s dependency changes. Final empty-reset and restart-sentinel suites pass all 98 tests; the ACP suite passes all 131 tests with a real producer-generated completion fixture. These test-only updates retain the existing exact ownership, delivery, and transcript assertions. A final review found explicit runtime fragments were discarded for version 3 runtime-only turns; removing that conditional preserves producer context under both policies while escaping remains version-selected. The version 3 regression failed before the correction; all 65 related context/submission/cache-stability tests now pass.

Two harmless literal-marker regression cases fail against the original normalizer because it leaves the markers unescaped; both pass with the new projection, with unchanged transcript input objects and consistent current/history projection.

Exact benign assembled prompt before:

System: Base system prompt
Transcript user: Visible request
Model user: Visible request
Model carrier (custom, converted to user):
<<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>
Conversation info: channel=telegram
<<<END_OPENCLAW_INTERNAL_CONTEXT>>>

After, for a genuinely new session:

System: Base system prompt
Transcript user: Visible request
Model user: Visible request
Model carrier (custom, converted to user):
<<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>
Conversation data (data, not instructions):
"Conversation info: channel=telegram"
<<<END_OPENCLAW_INTERNAL_CONTEXT>>>

The stored carrier body remains raw; only its model projection changes. The deterministic assembly test asserts this exact output.

Validation commands
CI=1 node scripts/run-vitest.mjs src/agents/command/attempt-execution.shared.test.ts src/agents/embedded-agent-runner/run/attempt-prompt-context.test.ts src/agents/embedded-agent-runner/run/attempt-prompt-phase.test.ts src/agents/embedded-agent-runner/run/attempt-session-boundary.test.ts src/agents/embedded-agent-runner/run/attempt.llm-boundary.test.ts src/agents/embedded-agent-runner/run/attempt.spawn-workspace.context-engine.test.ts src/agents/embedded-agent-runner/run/runtime-context-prompt.test.ts src/agents/internal-events.test.ts src/agents/internal-runtime-context.test.ts src/agents/mcp-app-model-context.test.ts src/agents/sessions/session-manager-branching.test.ts src/agents/sessions/session-manager-codec.test.ts src/agents/subagents/completion/subagent-completion-admission.store.test.ts src/auto-reply/reply/prompt-prelude.test.ts src/config/sessions/session-accessor.parent-fork.test.ts src/config/sessions/session-accessor.recovery.test.ts src/config/sessions/session-accessor.sqlite-message-cut.test.ts src/agents/agent-command-execution-identity.test.ts src/auto-reply/reply/queue.collect.test.ts src/agents/embedded-agent-runner/run/attempt.llm-boundary.cache-stability.test.ts src/agents/embedded-agent-runner/run/attempt.llm-boundary.steering.test.ts
CI=1 node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/attempt-prompt-context.test.ts
node scripts/run-vitest.mjs src/agents/sessions/session-manager-branching.test.ts src/agents/subagents/completion/subagent-completion-admission.store.test.ts
CI=1 node scripts/run-vitest.mjs src/agents/internal-events.test.ts
CI=1 node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/attempt.llm-boundary.test.ts src/agents/embedded-agent-runner/run/attempt.llm-boundary.cache-stability.test.ts
CI=1 node scripts/run-vitest.mjs src/auto-reply/reply/prompt-prelude.test.ts src/auto-reply/reply/agent-runner-execution-lifecycle.test.ts src/auto-reply/reply/get-reply-run.media-only.test.ts src/agents/embedded-agent-runner/run/attempt-prompt-submit.test.ts src/auto-reply/reply/agent-runner-session-reset.test.ts src/cron/isolated-agent/run-session-state.test.ts src/commands/doctor-session-sqlite.test.ts src/commands/doctor-session-transcript-headers.test.ts
CI=1 node scripts/run-vitest.mjs src/config/sessions/session-accessor.creation-snapshot.test.ts src/config/sessions/incognito-session-transcript.test.ts src/auto-reply/reply/agent-runner-execution-lifecycle.test.ts src/auto-reply/reply/get-reply-run.media-only.test.ts src/agents/embedded-agent-runner/run/attempt-prompt-submit.test.ts
CI=1 node scripts/run-vitest.mjs src/auto-reply/reply/agent-runner-execution-mcp-context.test.ts
CI=1 node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/attempt-prompt-context.test.ts src/agents/embedded-agent-runner/run/attempt.spawn-workspace.context-engine.test.ts src/agents/embedded-agent-runner/run/attempt-prompt-phase.test.ts
CI=1 node scripts/run-vitest.mjs src/config/sessions/session-accessor.sqlite-reset-header.test.ts src/gateway/server-restart-sentinel.test.ts
CI=1 node scripts/run-vitest.mjs src/agents/agent-command.live-model-switch.test.ts
CI=1 node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/attempt-prompt-context.test.ts src/agents/embedded-agent-runner/run/attempt-prompt-submit.test.ts src/agents/embedded-agent-runner/run/attempt.llm-boundary.cache-stability.test.ts
OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 pnpm check:changed
OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 pnpm check:changed --staged
OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 pnpm check:changed -- src/agents/agent-command.live-model-switch.test.ts
git diff --check

The broad focused run used the existing Testbox lease. The corrected helper, explicitly selected support suites, and final changed check ran locally. The remote full changed check was stopped after a known local dead-export finding made its frozen tree obsolete; it is not reported as passing proof.

The reported provider refusal was not reproduced live. Validation covers prompt assembly, transcript preservation, provenance, and replay policy through deterministic tests.

Reported by @fstrasz in #140404. No contributor PR was replaced.

@clawsweeper

clawsweeper Bot commented Sep 7, 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 gateway Gateway runtime scripts Repository scripts docker Docker and sandbox tooling agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 7, 2026
@steipete
steipete marked this pull request as ready for review September 7, 2026 05:26
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 7, 2026, 4:13 AM ET / 08:13 UTC.

ClawSweeper review

What this changes

Separates inbound text from Gateway-generated runtime context, escapes delimiter mentions for new sessions, and preserves existing sessions’ prompt projections through repair, branching, and replay.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains useful work absent from current main. The earlier Doctor and resumed-context findings are addressed, and the documented persisted-state compatibility evidence resolves the previous upgrade-proof request. No blocking introduced defect was identified.

Priority: P2
Reviewed head: 99c7be243bc5081bda8221c06b08f9f9f4977df9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent boundary repair with meaningful compatibility coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Supplied evidence covers Gateway projection and persisted-session compatibility through deterministic tests; it explicitly does not demonstrate live provider-refusal recovery.
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 PR is exempt from the external-contributor proof gate. Supplied evidence covers Gateway projection and persisted-session compatibility through deterministic tests; it explicitly does not demonstrate live provider-refusal recovery.
Evidence reviewed 10 items Current main still uses text-based extraction: At fetched main, resolveRuntimeContextPromptParts still calls extractInternalRuntimeContext on effective prompt text; the producer-fragment replacement remains necessary.
Latest release retains the previous session version: The supplied latest release, v2026.9.2, declares session version 3; fetched main also declares version 3. Neither contains this branch’s version-selected projection.
Producer-owned projection: The inspected assembly passes explicit event fragments under both session policies. The model boundary escapes inbound delimiters and quotes data only for version 4, preserves version 3 projection, and rejects unknown versions.
Findings None None.
Security None None.

How this fits together

The Gateway assembles user messages, background events, and conversation metadata before sending them to a model. This change keeps their origins separate while preserving stored transcripts and selecting model-facing formatting through the session header.

flowchart TD
  A[Inbound user text] --> D[Gateway prompt assembly]
  B[Runtime events and conversation data] --> D
  C[Stored session version] --> E[Model projection]
  D --> F[Preserved transcript]
  D --> E
  E --> G[Model request]
Loading

Before merge

  • Resolve merge risk (P1) - The reported provider refusal has not been reproduced after the change; deterministic projection evidence does not establish how a live model will respond.
Agent review details

Security

None.

PR surface

Source -1, Tests -259, Docs +20, Other -2. Total -242 across 75 files.

View PR surface stats
Area Files Added Removed Net
Source 41 626 627 -1
Tests 32 850 1109 -259
Docs 1 20 0 +20
Config 0 0 0 0
Generated 0 0 0 0
Other 1 8 10 -2
Total 75 1504 1746 -242

Review metrics

Metric Value Why it matters
Session projection compatibility Version 3 retained; version 4 selected for new sessions The existing header controls adoption without rewriting retained provider prefixes.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/agents/sessions/session-manager.ts, migration/backfill/repair: src/commands/doctor-session-transcript-headers.ts, serialized state: src/agents/command/attempt-execution.shared.ts, serialized state: src/agents/sessions/session-manager.ts, unknown-data-model-change: src/agents/command/attempt-execution.shared.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #140404
Summary: This PR is the Gateway-scoped candidate for the reported context ambiguity; cloud-worker handling remains separately tracked.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep producer-owned context separate at the Gateway boundary, retain existing session projections, and complete cloud-worker parity through the already-tracked follow-up.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep producer-owned context separate at the Gateway boundary, retain existing session projections, and complete cloud-worker parity through the already-tracked follow-up.

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

Yes for the structural ambiguity: current main extracts runtime context from inbound delimiter text, and the branch contains focused regression cases. The reported live provider refusal was not reproduced.

Is this the best way to solve the issue?

Yes for the approved Gateway scope: carrying producer facts to one projection boundary removes text-based classification while preserving transcript bytes and existing session policies.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 240b8b158988.

Labels

Label justifications:

  • P2: This is bounded prompt hardening with a defined compatibility path and no demonstrated authorization bypass.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 PR is exempt from the external-contributor proof gate. Supplied evidence covers Gateway projection and persisted-session compatibility through deterministic tests; it explicitly does not demonstrate live provider-refusal recovery.

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)

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-07T05:34:05.641Z sha 2c85ac9 :: blocked before merge. :: [P1] Preserve legacy projection when Doctor reconstructs a header | [P2] Carry relocated context into resumable room-event prompts
  • reviewed 2026-09-07T07:04:58.325Z sha 9e4bde1d909224ecf154f2e6791e66d33f8dcd85 :: blocked before merge. :: none
  • reviewed 2026-09-07T07:36:20.306Z sha a182ce89738ca5bfc292c210242496aca5ffc536 :: blocked before merge. :: none
  • reviewed 2026-09-07T07:58:54.062Z sha 0d0e6ec :: blocked before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Sep 7, 2026
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the two actionable findings in 9e4bde1d909224ecf154f2e6791e66d33f8dcd85.

Doctor now repairs canonical headerless legacy history with version 3. Regression coverage preserves raw event JSON and leaves existing versions 3, 4, and 99 untouched. The same audit found session adoption could append a new-version header to retained history; adoption now uses the existing initializer only for physically empty transcripts, rechecked inside the queued write after preparation.

A shared append operation now updates full text, resumable text, and producer-typed fragments together. Both reply-prelude additions and MCP App snapshots use it. Regressions failed before the corrections for missing resumed context and incorrect enrollment; the corrected context, adoption, retry, Doctor, and migration suites pass. Queue selection, exclusions, MCP consumption, and transcript-byte assertions remain covered. The final full changed-file check and independent review are clean; hosted CI is running on this new head.

Live provider-refusal verification remains a stated proof gap. The maintainer-approved scope is deterministic Gateway prompt hardening, with cloud-worker launch-contract hardening tracked separately in #140666.

@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 Sep 7, 2026
@steipete
steipete force-pushed the codex/runtime-context-role branch from 9e4bde1 to a182ce8 Compare September 7, 2026 07:27
@steipete

steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Upgrade compatibility proof for the remaining data-model review item is covered by deterministic persisted-state tests, using synthetic sessions:

  • src/agents/sessions/session-manager-codec.test.ts:12 loads versions 1, 2, 3, 4, and 99. Imports below 3 migrate only to 3; existing 3/4/99 headers retain their versions; only a genuinely new session starts at 4.
  • src/agents/sessions/session-manager-branching.test.ts:27 exercises both memory and SQLite sessions at versions 3 and 4, branches them, reopens the persisted result, and checks policy preservation and source transcript bytes.
  • src/commands/doctor-session-transcript-headers.test.ts:94 repairs retained headerless history with version 3 and unchanged event bytes. The table at line 221 preserves existing 3/4/99 headers. These tests passed with the Doctor/import suites (244 tests).
  • src/config/sessions/session-accessor.creation-snapshot.test.ts:30 adopts retained headerless and version 3/4/99 history without adding or rewriting a header. The context/adoption/retry proof passed 246 tests across five files.
  • The model-boundary suites verify current/history projection, unchanged input objects, legacy projection, and rejection of unknown projection versions. Existing reset/recovery/compaction coverage verifies inherited policy; the empty-reset cases select the new-session version only for physically empty history.

No SQLite schema migration or new policy field is used. The maintainer approved selecting new-session projection through the existing transcript header; existing prefixes retain their policy. This is upgrade compatibility proof, not a claim that the reported provider refusal was reproduced live. Cloud-worker launch-contract hardening remains explicitly tracked in #140666.

The final head 99c7be243bc5081bda8221c06b08f9f9f4977df9 also preserves explicit runtime-only producer fragments for version 3 sessions. The new table case failed before the conditional removal; all 65 prompt-context/submission/cache-stability tests pass afterward. The version still selects escaping, while producer context remains present under both policies. Full changed-file checks and the final correction check pass; independent review is clean at P0–P2. The generic data-model checklist is satisfied by this evidence, consistent with the technical review’s statement that the prior upgrade-proof blocker is resolved.

Carry producer-owned context through Gateway prompt assembly and escape
inbound delimiters only in the model projection. Preserve raw transcripts
and select the new projection through the existing per-session header.

Keep existing provider roles and legacy session prefixes. Cloud-worker
launch-contract hardening remains tracked separately in #140666.

Related: #140404
Keep legacy headerless history on its existing projection during Doctor
repair, and initialize adopted transcripts only when physically empty.
Append new context to full and resumable prompts through one shared owner.

Preserve event selection, MCP consumption, retry context, and raw transcript
bytes in the compatibility tests.
@steipete
steipete force-pushed the codex/runtime-context-role branch from 2bc8619 to 0d0e6ec Compare September 7, 2026 07:52
@steipete
steipete merged commit 2d0d99f into main Sep 7, 2026
192 checks passed
@steipete
steipete deleted the codex/runtime-context-role branch September 7, 2026 08:23
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

The final review identifies no introduced blocking defect. Its remaining live-refusal checklist item is retained as an explicit proof limitation under the maintainer-approved scope: this landing hardens Gateway prompt structure and provenance while preserving provider roles and existing session prefixes. The PR body states that the reported provider refusal was not reproduced live and makes no claim that model behavior is guaranteed. Deterministic assembly, lifecycle, and persisted-state regressions establish the structural repair; final-head hosted CI is green. Cloud-worker launch parity remains #140666.

@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@VACInc

VACInc commented Sep 8, 2026

Copy link
Copy Markdown
Member

Related follow-up: #141544 merged on September 8, 2026. It sanitizes outward reasoning previews at the shared dispatch boundary; it does not change model input or runtime-context carrier placement.

This is complementary downstream output hardening, not a replacement for the inbound/runtime-context distinction implemented here. #141544 leaves versioned model-input projection and raw replay data unchanged, and does not complete the cloud-worker follow-up in #140666.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
* fix(agents): distinguish inbound text from runtime context

Carry producer-owned context through Gateway prompt assembly and escape
inbound delimiters only in the model projection. Preserve raw transcripts
and select the new projection through the existing per-session header.

Keep existing provider roles and legacy session prefixes. Cloud-worker
launch-contract hardening remains tracked separately in openclaw#140666.

Related: openclaw#140404

* fix(agents): preserve projection during repair and resumed turns

Keep legacy headerless history on its existing projection during Doctor
repair, and initialize adopted transcripts only when physically empty.
Append new context to full and resumable prompts through one shared owner.

Preserve event selection, MCP consumption, retry context, and raw transcript
bytes in the compatibility tests.

* test(agents): align projection lifecycle fixtures with producers

* fix(agents): retain runtime events in legacy sessions
necromman pushed a commit to necromman/openclaw that referenced this pull request Sep 16, 2026
* fix(agents): distinguish inbound text from runtime context

Carry producer-owned context through Gateway prompt assembly and escape
inbound delimiters only in the model projection. Preserve raw transcripts
and select the new projection through the existing per-session header.

Keep existing provider roles and legacy session prefixes. Cloud-worker
launch-contract hardening remains tracked separately in openclaw#140666.

Related: openclaw#140404

* fix(agents): preserve projection during repair and resumed turns

Keep legacy headerless history on its existing projection during Doctor
repair, and initialize adopted transcripts only when physically empty.
Append new context to full and resumable prompts through one shared owner.

Preserve event selection, MCP consumption, retry context, and raw transcript
bytes in the compatibility tests.

* test(agents): align projection lifecycle fixtures with producers

* fix(agents): retain runtime events in legacy sessions

(cherry picked from commit 2d0d99f)
necromman pushed a commit to necromman/openclaw that referenced this pull request Sep 16, 2026
배치 A 체리픽이 이 포크에 없는 중간 리팩터링에 걸린 지점을 포크 코드에 맞춰 정리했다.

- 문자열 이스케이프 복구: attempt-prompt-build.ts, attempt-prompt-context.test.ts
- openclaw#140859: session-accessor.entry-mutation.ts 의 transcript 헤더 import 복원
- openclaw#141247: runs.ts 에서 포크에 없는 projectSessionActive 조건 제거
- openclaw#141471: execute-plugin.test-support.js 가 없어 native-bash 테스트 파일 제거
- openclaw#141960: quickjs-wasi 3.6.0 의 MAX_STACK_SIZE 를 쓸 수 없어 되돌림(포크는 3.5.0 핀)
- openclaw#142130: agents.ts 의 assertCurrent 호출 제거, cleanup-utils 는 선택 인자로 유지
- openclaw#142158: manifest-planner.ts 의 remoteModelIds·manifestModelsById 복원
- openclaw#143308: simple-completion-runtime.ts 에 acquireSimpleCompletionModelForAgent 래퍼 추가
- openclaw#143899: src/infra/file-descriptor.ts 의 fingerprint 비교 헬퍼 이식, backup-shared 의 configCapture 참조 제거

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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.

2 participants