Repository navigation
fix: keep runtime context in user messages on compatible Responses endpoints - #168546
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR keeps runtime-context carriers in the user role on compatible Responses endpoints and documents provider-specific roles. Example: A reasoning model uses http://localhost:8080/v1 with supportsDeveloperRole enabled.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a current-main Responses compatibility defect through the existing shared serializer, with no actionable introduced defect found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherBoth Responses entry points pass conversation history through a shared serializer that projects internal messages into provider request input. flowchart LR
A[Conversation history] --> B[Shared Responses serializer]
B --> C[Native endpoint eligibility]
C --> D[Native instruction role]
C --> E[Compatible user role]
D --> F[Responses request]
E --> F
Technical reviewBest possible solution: Reuse native-endpoint eligibility for runtime-carrier roles while preserving content, ordering, retention, and transcript bytes. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically promotes marked text carriers on localhost Responses routes, and the PR reports pre-fix regression failures; no target code was executed during this review. Is this the best way to solve the issue? The shared serializer is the correct owner, and its existing endpoint check fixes both entry points without adding competing policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0f08bb02f0b7. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +69, Docs +31. Total +100 across 4 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 10, 2026, 1:34 PM ET / 17:34 UTC (Revision 3). |
|
Merged via squash.
|
Align provider-review continuation request captures with #168546. The ChatGPT Responses fixture is outside the native OpenAI endpoint predicate, so its runtime carrier keeps the user role and original content blocks. Keep the exact reviewed steer, carrier ordering, image omission, request count, transcript immutability and review-settlement assertions. This only updates two expected arrays; no request assembly or provider policy changes. Linux proof: 32 focused tests, all 1,454 tests in the original 111-file shard, and 11 provider-role tests pass. Restoring unconditional instruction role conversion makes all four affected cases fail. Selected test types, lint and P2 review pass. The unrelated dead-export failures also reproduce on the untouched baseline; no ignores or suppressions were changed.
Keep XML context within consecutive text parts, including empty text, and stop it at native tool or thinking blocks in final extraction and block snapshots. Retain the terminal retry and warning assertions with the sanitized payload expectation. Align the QA private-completion projection with the compatible Responses user-role carrier contract merged in openclaw#168546. Keep separate ordered messages and all private nonce, media, and channel-delivery assertions.
Follow #168546's intentional runtime-carrier policy for compatible Responses endpoints. Decode the actual request using the QA input owner while preserving developer/system context and every existing private completion, channel delivery, and restart assertion. Add focused coverage for native and compatible carriers plus missing, unmarked, stale, and leaked private data. No production behavior changes. Proof: reproduced the original smoke failure on Linux; profile 4 passes all 9 scenarios; QA config passes 312 files / 3347 tests; all type graphs, targeted typed/boundary lint, import cycles, and P2 review pass. pnpm test extensions/qa-lab/src/scenario-terminal-context.test.ts --maxWorkers=1 takes 27s including initial transforms; its 9 test bodies take under one second. No CI jobs were added. Check-changed reaches unrelated existing model-auth and Solid unused exports; its remaining relevant checks were run separately.
* fix(text): strip GLM arg_key shadow calls on current main Refresh the shared sanitizer onto the current text-filter composition and drop the gateway harness so the diff stays under the size M line budget. * fix(text): keep GLM streaming inside the assistant-text profile The public stripToolCallXmlTags helper stays terminal-only. Streaming holds stay on the private profile path. * test(text): restore the GLM proof harness on current main The shrink dropped the stream-phase table and the Gateway chat.final harness that exercise this sanitizer. Put both back on the conflict-free branch so they run against the current head. * test(gateway): remove fixed waits from final-text-only regression * fix: hide serialized tool markup throughout reply delivery Keep GLM shadow text and standalone invocation XML in the shared visible-text sanitizer. Hold incomplete stream prefixes, restore finished literal examples, and retain payload context across adjacent native text parts. Preserve prose, code, and native tool execution. Incorporates the distinct invocation cases from #153635 alongside the GLM repair from #138204. Thanks @ericcaiwx-star and @ruiling-smartbear. Co-authored-by: Ruilin Gao <[email protected]> * fix: preserve replies across native content boundaries Keep XML context within consecutive text parts, including empty text, and stop it at native tool or thinking blocks in final extraction and block snapshots. Retain the terminal retry and warning assertions with the sanitized payload expectation. Align the QA private-completion projection with the compatible Responses user-role carrier contract merged in #168546. Keep separate ordered messages and all private nonce, media, and channel-delivery assertions. * fix: remove unused channel migration binding --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Ruilin Gao <[email protected]>
…dpoints (openclaw#168546) * fix: keep runtime context in user messages on compatible Responses endpoints * test: retain serialized Responses request captures
Align provider-review continuation request captures with openclaw#168546. The ChatGPT Responses fixture is outside the native OpenAI endpoint predicate, so its runtime carrier keeps the user role and original content blocks. Keep the exact reviewed steer, carrier ordering, image omission, request count, transcript immutability and review-settlement assertions. This only updates two expected arrays; no request assembly or provider policy changes. Linux proof: 32 focused tests, all 1,454 tests in the original 111-file shard, and 11 provider-role tests pass. Restoring unconditional instruction role conversion makes all four affected cases fail. Selected test types, lint and P2 review pass. The unrelated dead-export failures also reproduce on the untouched baseline; no ignores or suppressions were changed.
Follow openclaw#168546's intentional runtime-carrier policy for compatible Responses endpoints. Decode the actual request using the QA input owner while preserving developer/system context and every existing private completion, channel delivery, and restart assertion. Add focused coverage for native and compatible carriers plus missing, unmarked, stale, and leaked private data. No production behavior changes. Proof: reproduced the original smoke failure on Linux; profile 4 passes all 9 scenarios; QA config passes 312 files / 3347 tests; all type graphs, targeted typed/boundary lint, import cycles, and P2 review pass. pnpm test extensions/qa-lab/src/scenario-terminal-context.test.ts --maxWorkers=1 takes 27s including initial transforms; its 9 test bodies take under one second. No CI jobs were added. Check-changed reaches unrelated existing model-auth and Solid unused exports; its remaining relevant checks were run separately.
* fix(text): strip GLM arg_key shadow calls on current main Refresh the shared sanitizer onto the current text-filter composition and drop the gateway harness so the diff stays under the size M line budget. * fix(text): keep GLM streaming inside the assistant-text profile The public stripToolCallXmlTags helper stays terminal-only. Streaming holds stay on the private profile path. * test(text): restore the GLM proof harness on current main The shrink dropped the stream-phase table and the Gateway chat.final harness that exercise this sanitizer. Put both back on the conflict-free branch so they run against the current head. * test(gateway): remove fixed waits from final-text-only regression * fix: hide serialized tool markup throughout reply delivery Keep GLM shadow text and standalone invocation XML in the shared visible-text sanitizer. Hold incomplete stream prefixes, restore finished literal examples, and retain payload context across adjacent native text parts. Preserve prose, code, and native tool execution. Incorporates the distinct invocation cases from openclaw#153635 alongside the GLM repair from openclaw#138204. Thanks @ericcaiwx-star and @ruiling-smartbear. Co-authored-by: Ruilin Gao <[email protected]> * fix: preserve replies across native content boundaries Keep XML context within consecutive text parts, including empty text, and stop it at native tool or thinking blocks in final extraction and block snapshots. Retain the terminal retry and warning assertions with the sanitized payload expectation. Align the QA private-completion projection with the compatible Responses user-role carrier contract merged in openclaw#168546. Keep separate ordered messages and all private nonce, media, and channel-delivery assertions. * fix: remove unused channel migration binding --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Ruilin Gao <[email protected]>
…dpoints (#168546) * fix: keep runtime context in user messages on compatible Responses endpoints * test: retain serialized Responses request captures (cherry picked from commit b5bf83f) Backport notes: docs-only conflict in docs/concepts/system-prompt.md: kept the branch's Runtime Context sentence (without main-only local date/time zone wording) and applied only this commit's change, replacing the provider-projection sentence with the link to Runtime context and provider roles.
Align provider-review continuation request captures with #168546. The ChatGPT Responses fixture is outside the native OpenAI endpoint predicate, so its runtime carrier keeps the user role and original content blocks. Keep the exact reviewed steer, carrier ordering, image omission, request count, transcript immutability and review-settlement assertions. This only updates two expected arrays; no request assembly or provider policy changes. Linux proof: 32 focused tests, all 1,454 tests in the original 111-file shard, and 11 provider-role tests pass. Restoring unconditional instruction role conversion makes all four affected cases fail. Selected test types, lint and P2 review pass. The unrelated dead-export failures also reproduce on the untouched baseline; no ignores or suppressions were changed. (cherry picked from commit 8445937)
Follow #168546's intentional runtime-carrier policy for compatible Responses endpoints. Decode the actual request using the QA input owner while preserving developer/system context and every existing private completion, channel delivery, and restart assertion. Add focused coverage for native and compatible carriers plus missing, unmarked, stale, and leaked private data. No production behavior changes. Proof: reproduced the original smoke failure on Linux; profile 4 passes all 9 scenarios; QA config passes 312 files / 3347 tests; all type graphs, targeted typed/boundary lint, import cycles, and P2 review pass. pnpm test extensions/qa-lab/src/scenario-terminal-context.test.ts --maxWorkers=1 takes 27s including initial transforms; its 9 test bodies take under one second. No CI jobs were added. Check-changed reaches unrelated existing model-auth and Solid unused exports; its remaining relevant checks were run separately. (cherry picked from commit e674d8e)
…roof The sessions_send visible-child proof timed out on every 2026.10.5 candidate: its synthetic provider picked the latest user item that lacked the legacy <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>> marker as the user prompt. Since #168546 (backport 8d66b94), OpenAI-compatible Responses endpoints, including mock-openai, keep runtime context in a user-role "OpenClaw runtime context:" carrier after the user turn instead of a developer message. The fixture then read that carrier as the prompt, never saw the "send" prompt on turn 2, answered PARENT_READY again, and the test waited for PARENT_DONE until timeout. Captured provider requests: v2026.10.4 sends the turn-2 carrier with role developer; the 10.5 tip sends it with role user. Reverting a293f2e (#168410) left the failure unchanged. Select the prompt with the shared qa-lab isInternalRuntimeContextCarrierText helper, which already accepts current and legacy carrier shapes.
…roof The sessions_send visible-child proof timed out on every 2026.10.5 candidate: its synthetic provider picked the latest user item that lacked the legacy <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>> marker as the user prompt. Since #168546 (backport 8d66b94), OpenAI-compatible Responses endpoints, including mock-openai, keep runtime context in a user-role "OpenClaw runtime context:" carrier after the user turn instead of a developer message. The fixture then read that carrier as the prompt, never saw the "send" prompt on turn 2, answered PARENT_READY again, and the test waited for PARENT_DONE until timeout. Captured provider requests: v2026.10.4 sends the turn-2 carrier with role developer; the 10.5 tip sends it with role user. Reverting a293f2e (#168410) left the failure unchanged. Select the prompt with the shared qa-lab isInternalRuntimeContextCarrierText helper, which already accepts current and legacy carrier shapes. (cherry picked from commit d3a06e7)
…7319) * fix(test): treat the env-gated Agents API live proof as optional shard evidence test/gateway-agentsapi.live.test.ts (new since 2026.10.4) skips its only case unless OPENCLAW_LIVE_AGENTS_API=1, which the native live test-harness shard never sets, so the shard's no-passing-assertions guard failed it on every 2026.10.5 candidate once the other harness tests went green. Register it in the existing whole-file opt-in map like the other env-gated live proofs. (cherry picked from commit 761ef64) * fix(test): decode the Codex CLI JSON error after plugin uninstall The live Codex npm plugin lane matched the expected post-uninstall error against raw --json stdout, where quotes are escaped, so the correct owner-plugin-not-activatable error never matched. Decode the canonical CLI error message first, as the 2026.10.4 release line does (a9fd56d). (cherry picked from commit e8772a9) * fix(test): scope CLI announcement barrier to parent probe (cherry picked from commit d5c0db7) (cherry picked from commit a48d4a8) * test(live): wait out the crash-loop breaker before the orphan settles The native subagent restart live proof SIGKILLs the Gateway three times in about two minutes. The third unclean boot trips the documented restart-loop breaker (3 unclean boots within 5 minutes, #166238), which pauses restart settlement, including interrupted subagent recovery (#166846), until the unclean window drains. The orphan assertion added with the #169144 backport only waited 30 seconds, so the nonannouncing child was still `running`. Wait up to 360 seconds for the orphan settlement so the proof covers the breaker pause and the automatic resume after its window. Assertions are unchanged. 2026.10.4 passed because it predates the breaker pause, startup subagent reconciliation, and this assertion. Deterministic proof: the quiet-child e2e twin with SIGKILL restarts and an exec-blocked child passes with one prior kill; with two warm-up kills it logs "restart-loop breaker tripped" and the parent continuation never arrives within 60 seconds; with a 400-second wait it settles and passes (338s). (cherry picked from commit 1a4c2a0) * test(qa-lab): skip user-role runtime carriers in visible-child send proof The sessions_send visible-child proof timed out on every 2026.10.5 candidate: its synthetic provider picked the latest user item that lacked the legacy <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>> marker as the user prompt. Since #168546 (backport 8d66b94), OpenAI-compatible Responses endpoints, including mock-openai, keep runtime context in a user-role "OpenClaw runtime context:" carrier after the user turn instead of a developer message. The fixture then read that carrier as the prompt, never saw the "send" prompt on turn 2, answered PARENT_READY again, and the test waited for PARENT_DONE until timeout. Captured provider requests: v2026.10.4 sends the turn-2 carrier with role developer; the 10.5 tip sends it with role user. Reverting a293f2e (#168410) left the failure unchanged. Select the prompt with the shared qa-lab isInternalRuntimeContextCarrierText helper, which already accepts current and legacy carrier shapes. (cherry picked from commit d3a06e7) * test(buzz): skip real reconnect backoff in cold-start recovery (cherry picked from commit fa2049a) * fix(release): let the Telegram release lane finish its 25 scenarios The isolated Telegram candidate job hit its 60-minute limit at scenario 24/25 on every 2026.10.5 candidate (about 62 minutes needed at 102-108s per packaged Gateway start). main carries the same Telegram scenario set and job, so raise the job budget to 90 minutes; the calling release-checks job keeps its 210-minute bound. Also carry the 2026.10.4 release-line fixture fix for telegram-prepared-delivery-recovery (8b78670): keep the audit receipt in the shared Gateway workspace and create it up front so the isolated SUT can append without EACCES. main still writes it under the private tempRoot. (cherry picked from commit 3cb49f0, adapted to main's runner anchor) * test(gateway): probe startup readiness on fresh connections The deferred-fleet startup test failed twice in 2026.10.5 FRV #12 with `fetch failed` / `read ECONNRESET`. Its Gateway shares the test process's event loop. A /healthz or /readyz probe could reuse a keep-alive socket that Undici still treated as live; when the request was written and a synchronous main-thread startup stall followed, the server's idle-timer callback ran before the poll phase read the request and destroyed the socket with the request unread, so the kernel reset the connection. main still probes with default keep-alive fetches. Probe with `Connection: close`, matching existing Gateway test probes. Assertions are unchanged. (cherry picked from commit e3c63f2, adapted to main's probe sites) * test(live): expect review effort for Skill Workshop background reviews in the Ultra lane Since #161057 the Skill Workshop counts iterations per session, so Ultra probe sessions trigger a background review after idling. The review runs under its own skill-workshop-review: run and does not inherit the session's thinking level, so the lane's every-request-is-max assertion failed on 2026.10.5 whenever a review reached the provider. On main, #173889 pins review runs to thinkLevel "low" (review-run.ts), which the OpenAI stream wrapper sends as effort "low". Expect that effort for review runs; Ultra runs and their sessions must still be max, and independent heartbeats stay medium. The live file is over the line cap, so the Ultra wire effort policy moves to a sibling helper with its observation type, and the deterministic review cases run in the normal helper suite. (cherry picked from commit ca15213, adapted to main's review thinking level) * test(release): forward-port 2026.10.4-line upgrade-survivor and runtime-smoke harness fixes Release-line harness fixes that 2026.10.1-2026.10.5 carried but main never received: - cron-scheduled-authority: seed the cron authority specimen through the published baseline's own SQLite writer (seedPublishedCronJobs) instead of a raw cron/jobs.json that current candidates treat as a retired pre-July store; drop owner fields for pre-2026.7.1 baselines (usesCronOwnerAtBaseline). The dispatcher passes the package root to seedState, and the scenario now requires a published baseline. - bundled plugin runtime smoke: join deferred read-only update discovery via update.status before the package-manager child watchdog. main still defers install discovery (`<manager> root -g`) until after ready, so it can race the watchdog's no-package-manager-children check. Skips the codex npm plugin live source-reply grep from the release commit: main already probes dynamic-tool-source-reply.ts and dynamic-tools.ts. (cherry picked from commit fcdf0d1, codex grep hunk dropped; cron seed test adapted to main's executable-mode fixture writes)
…nclaw#177319) * fix(test): treat the env-gated Agents API live proof as optional shard evidence test/gateway-agentsapi.live.test.ts (new since 2026.10.4) skips its only case unless OPENCLAW_LIVE_AGENTS_API=1, which the native live test-harness shard never sets, so the shard's no-passing-assertions guard failed it on every 2026.10.5 candidate once the other harness tests went green. Register it in the existing whole-file opt-in map like the other env-gated live proofs. (cherry picked from commit 761ef64) * fix(test): decode the Codex CLI JSON error after plugin uninstall The live Codex npm plugin lane matched the expected post-uninstall error against raw --json stdout, where quotes are escaped, so the correct owner-plugin-not-activatable error never matched. Decode the canonical CLI error message first, as the 2026.10.4 release line does (a9fd56d). (cherry picked from commit e8772a9) * fix(test): scope CLI announcement barrier to parent probe (cherry picked from commit d5c0db7) (cherry picked from commit a48d4a8) * test(live): wait out the crash-loop breaker before the orphan settles The native subagent restart live proof SIGKILLs the Gateway three times in about two minutes. The third unclean boot trips the documented restart-loop breaker (3 unclean boots within 5 minutes, openclaw#166238), which pauses restart settlement, including interrupted subagent recovery (openclaw#166846), until the unclean window drains. The orphan assertion added with the openclaw#169144 backport only waited 30 seconds, so the nonannouncing child was still `running`. Wait up to 360 seconds for the orphan settlement so the proof covers the breaker pause and the automatic resume after its window. Assertions are unchanged. 2026.10.4 passed because it predates the breaker pause, startup subagent reconciliation, and this assertion. Deterministic proof: the quiet-child e2e twin with SIGKILL restarts and an exec-blocked child passes with one prior kill; with two warm-up kills it logs "restart-loop breaker tripped" and the parent continuation never arrives within 60 seconds; with a 400-second wait it settles and passes (338s). (cherry picked from commit 1a4c2a0) * test(qa-lab): skip user-role runtime carriers in visible-child send proof The sessions_send visible-child proof timed out on every 2026.10.5 candidate: its synthetic provider picked the latest user item that lacked the legacy <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>> marker as the user prompt. Since openclaw#168546 (backport 8d66b94), OpenAI-compatible Responses endpoints, including mock-openai, keep runtime context in a user-role "OpenClaw runtime context:" carrier after the user turn instead of a developer message. The fixture then read that carrier as the prompt, never saw the "send" prompt on turn 2, answered PARENT_READY again, and the test waited for PARENT_DONE until timeout. Captured provider requests: v2026.10.4 sends the turn-2 carrier with role developer; the 10.5 tip sends it with role user. Reverting a293f2e (openclaw#168410) left the failure unchanged. Select the prompt with the shared qa-lab isInternalRuntimeContextCarrierText helper, which already accepts current and legacy carrier shapes. (cherry picked from commit d3a06e7) * test(buzz): skip real reconnect backoff in cold-start recovery (cherry picked from commit fa2049a) * fix(release): let the Telegram release lane finish its 25 scenarios The isolated Telegram candidate job hit its 60-minute limit at scenario 24/25 on every 2026.10.5 candidate (about 62 minutes needed at 102-108s per packaged Gateway start). main carries the same Telegram scenario set and job, so raise the job budget to 90 minutes; the calling release-checks job keeps its 210-minute bound. Also carry the 2026.10.4 release-line fixture fix for telegram-prepared-delivery-recovery (8b78670): keep the audit receipt in the shared Gateway workspace and create it up front so the isolated SUT can append without EACCES. main still writes it under the private tempRoot. (cherry picked from commit 3cb49f0, adapted to main's runner anchor) * test(gateway): probe startup readiness on fresh connections The deferred-fleet startup test failed twice in 2026.10.5 FRV openclaw#12 with `fetch failed` / `read ECONNRESET`. Its Gateway shares the test process's event loop. A /healthz or /readyz probe could reuse a keep-alive socket that Undici still treated as live; when the request was written and a synchronous main-thread startup stall followed, the server's idle-timer callback ran before the poll phase read the request and destroyed the socket with the request unread, so the kernel reset the connection. main still probes with default keep-alive fetches. Probe with `Connection: close`, matching existing Gateway test probes. Assertions are unchanged. (cherry picked from commit e3c63f2, adapted to main's probe sites) * test(live): expect review effort for Skill Workshop background reviews in the Ultra lane Since openclaw#161057 the Skill Workshop counts iterations per session, so Ultra probe sessions trigger a background review after idling. The review runs under its own skill-workshop-review: run and does not inherit the session's thinking level, so the lane's every-request-is-max assertion failed on 2026.10.5 whenever a review reached the provider. On main, openclaw#173889 pins review runs to thinkLevel "low" (review-run.ts), which the OpenAI stream wrapper sends as effort "low". Expect that effort for review runs; Ultra runs and their sessions must still be max, and independent heartbeats stay medium. The live file is over the line cap, so the Ultra wire effort policy moves to a sibling helper with its observation type, and the deterministic review cases run in the normal helper suite. (cherry picked from commit ca15213, adapted to main's review thinking level) * test(release): forward-port 2026.10.4-line upgrade-survivor and runtime-smoke harness fixes Release-line harness fixes that 2026.10.1-2026.10.5 carried but main never received: - cron-scheduled-authority: seed the cron authority specimen through the published baseline's own SQLite writer (seedPublishedCronJobs) instead of a raw cron/jobs.json that current candidates treat as a retired pre-July store; drop owner fields for pre-2026.7.1 baselines (usesCronOwnerAtBaseline). The dispatcher passes the package root to seedState, and the scenario now requires a published baseline. - bundled plugin runtime smoke: join deferred read-only update discovery via update.status before the package-manager child watchdog. main still defers install discovery (`<manager> root -g`) until after ready, so it can race the watchdog's no-package-manager-children check. Skips the codex npm plugin live source-reply grep from the release commit: main already probes dynamic-tool-source-reply.ts and dynamic-tools.ts. (cherry picked from commit fcdf0d1, codex grep hunk dropped; cron seed test adapted to main's executable-mode fixture writes)
Backport openclaw#168546 for the extended-stable release audit. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Compatible Responses endpoints could receive runtime context as mid-conversation
developerorsystemmessages, even though their chat templates may reject or hoist those messages.Fixes #164791
User Impact
OpenAI-compatible and local endpoints keep runtime context in a user-role carrier. Supported direct Anthropic API-key routes and native OpenAI Responses retain their existing operator/in-history instruction channel. The docs explain the provider roles, escaped and JSON-quoted conversation data, carrier labels, cache stability, and how operators can discourage narration of internal context.
Why This Change Was Made
Native routing already landed in #163461 and #167698. One typed-carrier branch in the shared Responses converter bypassed the native-endpoint eligibility check used by adjacent operator messages. Reusing that check fixes both provider and transport entrypoints without changing carrier text, ordering, retention, transcript bytes, or the stable system prompt.
The maintainer's decision resolves the carrier-policy question in ask 1. The
appendOnlyRuntimeContextconfiguration switch requested in ask 2 was explicitly declined: role and retention remain capability-driven. This PR does not change stale-bot policy.Evidence
developer/system; they are nowuser. Native OpenAI retainsdeveloper. Canonical and legacy carrier metadata preserve content and order, and input history stays unchanged.qwen3:8bturns throughpnpm openclaw ... agent --local, exact requested answers, user-role carrier, byte-identical prior messages/tools, and 2,302 cached tokens on the second turn. This is baseline evidence, not a new live Responses-server test.node scripts/run-vitest.mjs packages/ai/src/transports/openai-responses-prompt-role.test.ts --maxWorkers=1, 7.55 s wrapper wall time (3.35 s Vitest).git diff --checkpass.openclaw/ci-gate: 46 successful jobs, 25 skipped. Node test steps took 1299 aggregate CI seconds across 18 selected jobs (27–139 s each; this includes sibling coverage, not just the changed file).pnpm prompt:snapshots:genregenerated seven files with no diff: zero prompt-token drift.Production LOC: +1/-1 (net zero). Tests: +69/-0. Docs: +37/-6.