Repository navigation
Conversation
|
Codex review: needs real behavior proof before merge. What this changesThis PR records tool-result media trust and removes unverified managed-media references from assistant text replayed into channel history. Example: An assistant names media://inbound/forged.png without a trusted tool producing that reference in its turn.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep open: this PR contains useful replay-grounding work absent from current main, with no new correctness finding established; its compatibility policies still need an owner decision. Priority: P2 Decision needed
Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe transcript writer records run-local media trust; the snapshot reader collects earlier same-turn references, and the media-store owner verifies them before channel history enters a model request. flowchart LR
A[Tool results] --> B[Guarded transcript writer]
B --> C[Session transcript]
C --> D[Snapshot reader]
D --> E[Replay grounding]
F[Managed media store] --> E
E --> G[Channel history]
G --> H[Model request]
Technical reviewBest possible solution: Keep trust decisions in the existing transcript writer, collect same-turn facts in the snapshot reader, and ground replay through the media owner under an approved compatibility policy. Do we have a high-confidence way to reproduce the issue? Current-main source returns assistant references without grounding, and the contributor supplies before/after production-boundary output; this read-only review executed no target code. Is this the best way to solve the issue? The implementation uses the existing writer, snapshot reader, and media resolver owners and preserves canonical transcript bytes. The substantial parser machinery addresses demonstrated resolver spellings; the independent history limits and URI compatibility changes require owner acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 451ec41c26c6. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +1708, Tests +2593, Other +18. Total +4319 across 23 files. Added test files: 4. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
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 HistoryReview history (50 earlier review cycles; latest 8 shown)
Reviewed October 27, 2026, 3:51 PM ET / 19:51 UTC (Revision 51). |
There was a problem hiding this comment.
Pull request overview
This PR adds a grounding pass for assistant-authored transcript text before it is replayed into later session context, redacting absolute managed-media paths that do not resolve to real media on disk. The goal is to prevent fabricated “attachment” references from becoming self-reinforcing during prompt replay, while leaving user-authored text untouched by this redaction step.
Changes:
- Add
redactUngroundedMediaRefsto deterministically redact unverified managed-media absolute paths in assistant text. - Wire grounding into
parseRecentConversationText(assistant branch only) so replay readers inherit the behavior. - Add unit + reader-level tests covering redaction behavior and the reported incident shape.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/config/sessions/transcript.ts | Grounds assistant-visible text via redactUngroundedMediaRefs during transcript replay parsing. |
| src/config/sessions/transcript-grounding.ts | Implements managed-media path token detection + existence probing + redaction placeholder. |
| src/config/sessions/transcript-grounding.test.ts | Adds unit cases for token handling and a regression test for replay grounding behavior. |
|
Follow-up: the "not yet fleet-deployed" gap in the proof section is now closed. Live proof on a production host (macOS gateway, installed build at Input assistant turn: Output after replay through the installed dist: The fabricated ref is redacted, the verified real-file ref and all prose survive. Both production gateways have been running this build with Telegram serving normally. Also verified the sibling transcript readers are deliberately out of scope, not missed: |
f1858cf to
89e387d
Compare
|
@clawsweeper re-review Since the last review pass:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
89e387d to
83fc457
Compare
|
Pushed Symlink probe fix (the open P2/P1 finding). CI fix for Local proof (hydrated worktree,
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
83fc457 to
082f9ce
Compare
|
Addressed the ClawSweeper P2 (path traversal) and rebased onto latest Containment fix — Previously a token that starts with the managed-media root but uses Now, before trusting the probe, the matched token is verified to stay contained in the managed media root via Regression tests —
Both escaping tests fail on the pre-fix code and pass after; full file green. Proof: New head SHA: |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
f5997a6 to
596d44d
Compare
…removed Main's test lifecycle now fails a file whose agent or state database outlives its fixture directory, and openclaw#163045 moved the active-stats read this branch's snapshot test used into a test-support module. After the merge that left three of the branch's own suites red: - transcript-grounding.test.ts and session-accessor.sqlite-conversation-snapshot.test.ts passed their cases and then failed teardown with "Agent database close failed" (ENOENT on the removed state/openclaw.sqlite). Both now await the agent and state database closes in afterEach, as session-accessor.sqlite-active-events.test.ts does. - The snapshot test called readSessionTranscriptActiveStats, which no longer exists; it reads the same count through readActiveTranscriptStats. - embedded-agent-subscribe.tools.media.test.ts closed its databases synchronously. Its case stores now sit under one suite root from useSessionStoreTempDirs, drained once before removal (openclaw#161871). No assertion changes.
|
Merged
So I took the review's suggestion literally: a drive root is now a filesystem root that keeps its drive apart, and candidates fold through With
Measured at
The red jobs at The type error came in with #156221 ( Still open: the three owner decisions in #101866 (comment), and the running-gateway authority proof. Neither changed in this push. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…s onto another file
With only file:///<state>/media/inbound/ok.png authorized, replay kept
"file:///<state>/media/inbound/ok.png<TAB>.fake" unchanged. The media
resolver hands that spelling to the URL parser, which deletes the tab, and
opens inbound/ok.png.fake. The deleted-character scan only looked inside
the managed-root range, so it never saw a tab after the authorized alias,
and the store read contract accepts any safe single-component id, so the
writer's UUID names do not rule the joined name out.
The lexical scan cannot decide this alone: "ok.png<LF>next line" is the
same shape and is ordinary prose. So the scan now reports, for every
authorized alias followed by tab, LF or CR and more of the same token, the
raw spellings a reader could stop at (each later run, the boundary, and
before trailing punctuation). The replay owner hands them to a new media
owner probe, findUnverifiedJoinedMediaSpellings, which resolves each one
through the same path prepareManagedMediaGrounding uses (now shared as
verifiedManagedPath). A spelling that opens a managed file whose real path
no authorized reference verified is refused, and replay rescans with it, so
the alias is redacted like any other unverified reference. A joined name
the store does not hold stays prose. Probes are capped at
MAX_GROUNDING_PATHS per entry, and an alias whose joined token runs past
MAX_GROUNDING_TOKEN_CHARS or offers more than eight places to stop is
refused; all three fail closed, and the last keeps the scan linear, since
every spelling is a string the probe set hashes in full. A run directly
after the alias followed by "/" or "\" is not probed unless the rest of
the token, read with the run deleted, holds a ".." segment: without one
it names a path beneath the authorized file, which is a regular file, and
it is how a list of paths one per line looks. With one ("/.<LF>./x" reads
"/../x") it is probed like any other spelling. A scan with no joined
spelling costs nothing new.
Tested: tab, LF and CR after a file: alias, a line break inside a ".."
that climbs out of the authorized file, and a tab after a media://inbound
alias (the URL parser deletes it there too, and
parseInboundMediaUri then yields ok.png.fake). Because the probe hands the
raw slice to the resolver, a percent-escaped continuation, punctuation
between the alias and the run, and a plain or ~ path alias followed by a
character the resolver keeps in the name go through the same check; those
are not separately tested. Not covered: a name that continues across a
boundary the resolver keeps, such as a space or a quote ("ok.png .fake"),
whose extent prose cannot bound, and a directory named the authorized file
name plus a trailing tab or line break, which a plain path keeps.
The regression stores ok.png and ok.png.fake, authorizes ok.png through a
trusted same-turn tool result, checks that resolveInboundMediaReference
opens ok.png.fake for each spelling, and replays the session.
…ng String and RegExp calls Review rev 44 flagged two assertions that pin implementation choices. "does not rescan prefixes when a bounded prompt has no managed root" spied on String.prototype.slice and required zero calls for a 32 KiB prompt of "x". With the count gone, what is left is that a prompt without a root comes back unchanged, which every benign case in this file already shows, so the test is removed. The source comment that cited it now states the property without naming a test. "keeps one token's extent across the redactions inside it" summed every RegExp.prototype.test call and every sliced character in the process and compared them with 16 times the token length. It now redacts 16,000 comma-separated managed paths in one token (about 464 KiB) and lets the 10 s timeout be the assertion, as the other floods in this file do. At 4,000 paths on an M4 Pro the case took 11 to 15 ms, and 2,885 ms with reanchorToken forced to discard the extent, which is the regression it guards; 4,000 was too few for the timeout to catch it, so the flood is four times longer.
Conflict in src/config/sessions/transcript.ts with main's openclaw#167952 (320d57b). Main moved readRecentUserAssistantTextForSession off synchronous main-thread reads: the session entry is now read in a worker (withSessionEntryReadOnlyInWorker), the store path can be an incognito actor's, every page comes from readSessionTranscriptBoundedMessageTailPageAsync, and readRestoredSessionTranscript takes the owner's assertCurrent. This branch had replaced the same read with a synchronous one-snapshot selection (readSessionTranscriptConversationSnapshot) followed by async grounding. Resolution: main's entry read, scope and assertCurrent stay as they are. The selection keeps this branch's contract (newest entries first, each assistant entry with the media from its own turn's earlier tool results, at most 1,000 rows of turn and 64 references) but now runs in selectRecentConversationRows on main's async tail-page reader, so it works off the Gateway thread and for incognito sessions. Offsets count from the end, so a write between pages would shift the next page onto rows already read and could lend a later tool result to an earlier reply; each page's projection snapshot (generation, indexed seq, boundary) must match the first, and a mismatch restarts the read. The third read that sees a change keeps paging, as replay did before, and returns every row with no references, so replay redacts their managed media rather than shortening the window. Grounding still runs after the cold-storage retry. The synchronous readSessionTranscriptConversationSnapshot, its type, its session-accessor re-export and its accessor test are removed; those three accessor files are main's again. Two new regressions land rows between pages: one write, where a reply's later tool result must not become its provenance, and a write in each of three reads, where the last read re-reads that tool result into the reply's turn and must still drop it and still reach the oldest row.
|
Pushed Merge. Check deleted characters through the authorized URL's full extent (P2). Fixed in The fix is the store probe I offered in that comment. Text alone cannot tell Regression, The "before" column restores Siblings of the same shape:
Resolve security concern: Actual plugin trust handoff remains unproven. Not closed by this push, and I'm leaving it as a follow-up rather than growing this PR. No link needs a live channel, but the last one,
So the proof needs a mock-provider behavior that calls Add data-model compatibility proof. Done on an M4 Pro, with an isolated state dir and no Gateway. Phase 1 ran from the v2026.9.9 tag's source ( Phase 2 ran on this branch merged with Marker-free rows keep the release's core-name trust, which is why Tests. Both notes are addressed in CI. CI on
The ninth is Gates on The The three maintainer decisions (replay budgets, marker-free trust, port-bearing URIs) are unchanged. |
|
CI on
No change to the branch for either. |
- src/agents/session-tool-result-guard-wrapper.ts: keep upstream's prompt-image metadata and tool-result truncation imports alongside the local-media replay authorization import. - src/config/sessions/transcript.ts: take upstream's recent-text types from transcript-recent-text.ts, declare boundReplayBytes on the grounded read options, and keep the replay grounding read on top of the moved extractor. - src/config/sessions/transcript-recent-text.ts: export extractRecentConversationText for the grounding selector. - src/agents/embedded-agent-subscribe.tools.media.test.ts: prepare the runtime config the session history worker now requires.
…shot reader Upstream now selects recent conversation text inside one transcript snapshot in the worker kernel, the read-only reader and the memory actor. Replace the replay grounding's own paging selector (snapshot compare, three retries, provenance drop) with an opt-in includeTurnMediaReferences option on that reader: each selected assistant entry carries the managed media its own turn's trusted tool results named, collected from the same snapshot, and reading continues past the limit until the oldest selected reply reaches its turn start (at most 1,000 rows). Callers that do not request references get upstream's result unchanged. The recent-text result type carries the optional field through the worker and actor protocols, transcript.ts requests it and grounds assistant text after the read, and the public SessionRecentConversationText shape is unchanged. Add the reference collector's eager imports to the PR wrapper inventory.
Merges upstream main at b90b2cf. - scripts/pr-lib/wrapper-components.txt: keep main's new inventory entries and this branch's 18 reference-collector imports; no entry is duplicated. - src/agents/embedded-agent-tool-media.ts: keep main's pushUniqueMessagingMediaUrl return value (openclaw#175022). collectStructuredMedia keeps this branch's capped, acceptMediaUrl-gated push, which already keys attachment metadata by the normalized accepted URL. - src/agents/session-tool-result-guard-wrapper.ts: main's openclaw#176804 gives each run its own transcript context and rebuilds it when a guarded manager is reused. The local-media trust set now lives on that context: the trustedLocalMediaToolNames option seeds it, setTrustedLocalMediaToolNames replaces it on the current context, and a reuse that passes no set inherits the previous context's, so a same-run helper keeps the run's trust and an accepted write keeps the set of the context it captured.
|
@clawsweeper re-review Merged main
Focused tests at the merge on an M4 Pro: 25 files, 403 passed, 1 skipped, 0 failed. CI on this head passes typecheck, lint and the baseline ratchets. Three jobs fail:
|
|
🦞👀 Re-review progress:
|
Merges upstream main at 3cd9bdd. No textual conflicts. - src/media/media-reference.ts: main moved relativePathEscapesBase to infra/path-guards as relativePathEscapesRoot and dropped this file's node:fs/promises import (openclaw#180175). The grounding helpers this branch added still call both, so they now use relativePathEscapesRoot and the import is restored.
…onto another file An authorized alias ends at a space, quote or bracket, but the resolver keeps those characters in a file name. With ok.png authorized and ok.png .fake also stored, file:///.../inbound/ok.png .fake replayed unchanged while the resolver opens ok.png .fake for it; the bare path and media://inbound/ok.png .fake did the same. A plain path also keeps a tab before "/", so .../ok.png<TAB>/x.png names a file in a directory called "ok.png<TAB>". The scan now records each authorized alias it keeps. For each one that more text follows, the media owner (findRefusedMediaContinuations) lists the alias's directory once. If a stored name there extends the alias's file name, each place a reader could end the name is placed with the resolver's own parsers, and a spelling that lands on another listed name, or outside the directory, is resolved the way same-turn references are verified. If it opens a managed file no same-turn reference verified, a rescan redacts the alias. With no extending name nothing is probed, so prose replays as written. A failed listing, text running more than 4,096 characters past the alias, or the 1,024-spelling and 64-probe caps refuse. The spelling enumeration sits with the replay orchestration in transcript-recent-grounding.ts, which keeps transcript-grounding.ts under its 700-line cap.
Keep replay byte bounds with upstream delivered-message context. Preserve media grounding probes with the current classifier declarations. This merge includes upstream history-cache pressure-channel retention from openclaw#179399.
|
@clawsweeper re-review The P2 and the matching security finding (a space-continued reference keeping an authorized alias) are fixed in
Still open in this push: the authority-chain proof (a trusted path against a core-named plugin at the final channel request, then trust withdrawal) and the upgrade-from-10.5 data proof. |
|
🦞👀 Re-review progress:
|
|
Added the authority-chain and upgrade proof to the Evidence section. Both run
The same final request also carries the session's own earlier assistant messages with their paths unchanged. This PR grounds the channel-history block only, and the body says so. Still open: the maintainer decisions, and main @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @amittell for the detailed investigation and proof. Closing this implementation because the narrow provider-replay failure was not reproduced on current main, and the remaining provenance policy needs a maintainer-owned design. On Main separates inbound text from context in #140859. As your latest proof also notes, this PR leaves canonical earlier assistant messages unchanged. A follow-up should define handling of trusted generated media versus fabricated/missing references across both history surfaces, preserve stable conversation bytes, and begin with a final-provider-request regression demonstrating the concrete failure. The same-turn provenance cases and the related #168611 QA work are useful inputs to that follow-up. |
What Problem This Solves
Fixes: in later turns, the model treats managed-media paths the assistant wrote itself as verified attachments, even when no trusted tool produced the file in that turn.
Related gaps this also closes:
BashorWeb_Searchinherited local-media trust on replay...discards, a root whose own path contains a space, a tab, LF or CR inside afile:URL (the URL parser deletes them), an authorized path followed by/../..,~/..., on Windows a drive path the URL parser andpath.win32read differently (~/..., a rooted path with no drive,C://..., a#or?in a segment a later..discards), and an authorizedfile:ormedia://inboundreference followed by a tab, LF or CR that the resolver joins onto another stored file (ok.png<TAB>.fakeopensok.png.fake).Grounding does not rewrite user-authored text or stored transcript rows. The channel replay byte budget also applies to retained user entries, as described below.
User Impact
Later model turns no longer see fabricated managed-media paths as verified attachments. Exact trusted paths survive. Case-colliding tool results do not inherit trust. A reused manager honors both removal and restoration of trusted tools. A 100,000-element duplicate or rejected structured-media array stops after 64 raw inspections. Configured history limits above 128 keep working.
Three compatibility changes need maintainer acceptance; each is listed under "Open for maintainers" below:
media://inbound:<port>/..., a baremedia://inbound:/...and empty userinfo (media://@inbound/...) no longer resolve. Non-empty userinfo was already refused onmain.There is no SQLite schema version, migration, config/default or Gateway protocol change. The internal recent-text read of the session-history worker and the memory actor gains an optional request flag (
includeTurnMediaReferences) and an optional result field (turnMediaReferences). The publicSessionRecentConversationTexttype is unchanged.Why This Change Was Made
Authority stays with the production transcript writer, and verification stays with the media and replay owners. Before persisting, the guarded writer records the run's local-media authorization decision, using the trust set that the prepared agent session carries (
attempt-session-runtime-prepare.tshands it over). Before a local path enters channel history, replay checks it against that recorded decision, same-turn provenance and the managed media store.Whether a spelling names a managed file is decided by the resolver's own parsers rather than a hand-written fold: WHATWG
URLfor a URI root,path.win32.normalizefor a Windows drive root andpath.posix.normalizefor any other filesystem root, after expanding a leading~the wayresolveUserPathdoes. That includes spellings that run past a token boundary. The same boundary walk decides where an authorized path ends. Forfile:URLs, the matcher also reads the text with tab, LF and CR deleted, as the URL parser does, keeps only the redactions that a deleted character makes possible, and maps them back to the original offsets.Where an authorized reference is followed by a tab, LF or CR and more of the same token, text alone cannot say whether it is prose (
ok.png<LF>next line) or another file (ok.png<TAB>.fake, which the URL parser reads asok.png.fake). The scan reports the raw spellings a reader could stop at, and the media owner (findUnverifiedJoinedMediaSpellingsinmedia-reference.ts) resolves each one through the same path that verifies same-turn references. If one opens a managed file no same-turn reference verified, the alias is redacted; a joined name the store does not hold stays prose. Probes are capped at 64 per entry, and an alias whose joined token runs past 4,096 characters or offers more than 8 places to stop is redacted. A run directly after the alias followed by/or\is not probed unless the rest of the token, read with the run deleted, holds a..segment: without one it is a path beneath the authorized regular file, which is how a list of paths one per line looks.An authorized alias followed by more text is also checked for names the resolver keeps, including
ok.png .fakeand a directory namedok.png<TAB>.findRefusedMediaContinuationsreads the alias's directory, probes plausible other names, and refuses the alias when the listing fails or the placement/probe budget runs out. The resolver-to-replay case opens the other files, verifies redaction, removes those files, and verifies the same text then survives as prose.The shared extractor has separate limits for accepted references and for raw structured candidates, and writer authorization and replay both apply the existing 64-reference policy to each.
Channel replay (
mergeSessionTranscriptContext) opts into a byte budget applied after grounding: 32 KiB per retained entry and 128 KiB per read. Provenance readers do not.session-upstream-monitor.tscompares complete prompt text, and the plugin-SDK export returns complete text, as onmain.Selection is
main's single-snapshot reader,readRecentTranscriptConversationText(#169619). It runs inside one transcript snapshot in the session-history worker, the read-only reader and the memory actor, so it runs off the Gateway thread and through the actor that holds an incognito session. This PR adds an opt-inincludeTurnMediaReferencesoption to it.The reader walks the snapshot newest first. Each selected assistant entry collects the earlier rows of its own turn, stopping at the turn's user row and keeping at most 1,000 rows. The managed media that those rows' trusted tool results named come back on the entry as
turnMediaReferences, capped by the same 64-reference policy. If the requested entries are already found but the oldest selected reply has not reached its turn start, the reader keeps paging until it does. Rows and their provenance therefore come from one snapshot. There is no page-to-page snapshot comparison, no retry and no provenance drop. Readers that do not set the option getmain's result unchanged.The collector lives in
transcript-turn-media-references.ts.transcript-recent-grounding.tskeeps grounding and the replay budget.transcript.tsrequests the references throughmain's worker-read entry andassertCurrent, then grounds.mainmoved the reader out oftranscript.ts, which is now 639 counted lines againstmain's 628, and the line-cap ratchet passes.Evidence
Shipped Gateway proof at
d929366aca6c, October 26Built
d929366aca6c0a79b980ffdd2d3225e9a6925520on macOS arm64 with Node24.22.1, pnpm12.15.0,pnpm install --frozen-lockfileandpnpm build qaRuntime, followed by the full rebuildscripts/run-node.mjsstarted on its own (dist is stale: missing_private_qa_dist);dist/index.jsSHA-256b94167b331b542449a2775ac3d44bb7ffb353bc9bfa71a51b5cf036557848254. The checkout also carried #168611's fourqa-labfiles, which this Gateway does not load:plugins.allowistelegramplus the fixture below. Every run had its own throwaway HOME, state and config, startednode dist/index.js gateway run --bind loopback, and drove the real Telegram plugin against a loopback Bot API stub, with a loopback scripted Responses provider as the model. No credentials or external endpoints.A run-owned, non-bundled fixture plugin registers a speech provider, so the core
ttstool runs and writes undermedia/tool-speech-synthesis/. The same plugin registersmusic_generate. No music provider is configured, so that tool is the plugin's, under a core name.Trusted path, core-named plugin and trust withdrawal. 18:32:17 to 18:36:24 UTC, 10 of 10 checks passed. Five DMs in one Telegram session:
ttsandmusic_generate, then replies with both managed paths and an unmanaged control path.tools.deny: ["tts"]is written to the config file. The running Gateway accepts the revision without a restart, and turn C's provider requests carry nottstool.music_generatereturns the file A'sttscall wrote, and the reply names it twice.ttsagain, and it writes a new file.The channel-history block ("Conversation context") of turn E's provider request, file names shortened:
Turn B's request already showed A's line exactly as above. The persisted tool results, read from the stopped Gateway's database:
The trusted path survives the final request. The core-named plugin's path does not. A result written while
ttswas withdrawn gets no authority, even for the file a trusted call produced in an earlier turn, and that earlier row keeps its own authority through the withdrawal and the restoration.The withdrawal is an operator
tools.deny. The plugin tool registry refuses a plugin tool whose name collides with a core tool that exists (plugin tool name conflict), and corettsis always constructed, so I found no shipped way to keep the samettsname callable while it loses trust.Scope: the same final request also carries the session's own earlier assistant messages as
assistantinput items, unchanged. Items 6 and 12 of turn E hold the A and C replies with every path as written. This PR grounds the channel-history block and does not rewrite stored transcript rows, as described above.Upgrade from latest stable 2026.10.7. 17:56:09 to 18:09:07 UTC.
npm view openclaw dist-tagsreportedlatest: 2026.10.7on October 26. Installed the published package into a throwaway prefix. npm 11.19.1 skipped dependency install scripts, so I ran the package's ownscripts/postinstall-bundled-plugins.mjs(exit 0);koffi's native install did not run.node openclaw.mjs gateway run) ran turn UPG-1, with the same tools plus a forged managed path (a real file inmedia/inbound/that no tool produced), and turn UPG-2. Its own replay kept all four paths as written. It left agent schema 25, global schema 20, 16 transcript rows and 1 session, and did not change the config file (SHA-2560d5596706adcbefore and after).openclaw doctor --fix --non-interactiveexited 0 and migrated agent schema 25 -> 33 and global schema 20 -> 31.agents.defaults.modelPolicy.allow,agents.entries.main,channels.telegram.accounts.proof.groupAllowFrom: ["*"],messages.queue.allowCollaborativeSteering: false, and four disabledskills.entries. The harness's whole-file equality check reports FAIL for that reason; the other 9 checks passed.music_generatepath replays because rows without the marker fall back to the core-name rule, one of the open decisions below. The forged path is redacted because no tool result in its turn named it.A first attempt skipped doctor. On the unmigrated 2026.10.7 state the PR head's Gateway did not answer
/readyzwithin 600 s and loggedSessions remain unavailable. Stop the Gateway, run "openclaw doctor --fix". This PR changes nothing undersrc/state, and base794d6500f382already declares agent schema 33.openclaw qa suite --channel-driver crablinewith an equivalent scenario did not get past Gateway startup here: the QA harness's 120 s listen deadline expired twice at load average 150 to 320, so the runs above use a 600 s readiness wait instead. Both runs used harnessproof-101866-gateway.mjs, SHA-256601a1a62e0efc521cba2bfb238c11615da5fbe3393181d5c29ca9db3eeb7b41f. Raw harness logs: authority87cb7047de800e0e2a244b6772a46a6b9723f76342211e986348fee20e5f3d17, upgrade98ae49f309bf62a2122b7a38ad8d1fd215388e792d75d6b5302c7087f6de400d. Every Gateway exited 0 on SIGTERM.Current-head validation
At
d929366aca6c, merged main794d6500f382311cab58f5d474a9ef248598e5f2without rebasing. The merge keepsboundReplayByteswith main's delivered-message context flags and keeps the media-grounding probes with main's classifier declarations. Tree:aa78156fab9d9b6b0b39a17d19b130816a077b89.The Bun history-cache failure is present on the exact CI base without this PR. The same five-file group, Node
24.22.1, Bun1.4.4-canary.1+ef37c31de, pnpm12.15.0, frozen installs, Linux x64, one worker:70b25401a70afe25917ce312aaaed15a63d212cbd7e301ea1098622ce6eb88e99f240a758814bb36d929366aca6c0a79b980ffdd2d3225e9a6925520The candidate uses main's lockfile, including Vitest
5.0.5; the historical controls use5.0.3. This comparison measures the complete integration.Both failures are
session-accessor.sqlite-history-cache.test.ts:157,expected [] to have a length of 1 but got +0, matching job 120036958812. All tracked source blobs matched the selected trees before running. Main already contains the cache's retained pressure channel in ca3f7433914a; this merge carries that fix, with no separate cache patch.Current-head focused results: 276 passed, 1 skipped across 14 files. The groups were the CI configuration group (67), grounding and turn provenance (137), media helpers/comparison (25), channel context (9), and guarded-writer/session preparation (38). The skipped case is
normalizeMediaReferenceForComparison > matches Windows network file URLs across scheme casing, restricted byit.runIf(process.platform === "win32"). These runs were on Linux; they do not establish Windows behavior.The space-continuation regression passes. Disabling only the continuation store probes makes that same case fail at line 310: the three
ok.png .fakespellings and the tab-named directory replay verbatim instead of being redacted. The prose controls remain unchanged. Restored the production file and verified its SHA-256 returned tocc9c6abaa1dd4d7b10ac67df45633007aa81668cf5bdd36a23b1690fdf1b9970.Reproduction of the five-file comparison, from each named tree with its frozen dependencies and the pinned Bun fork selected:
The other groups used the same wrapper, Bun selection, and worker flags with these files:
Oxfmt/Bun parity and scoped oxlint pass for the two conflict resolutions. Core typecheck passes:
node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo. Independent source review against794d6500f382311cab58f5d474a9ef248598e5f2found no P0-P2 findings; it did not execute the project. All 59,191 tracked blobs matched the reviewed tree after validation and mutation restoration.Hosted CI run 40123672646 completed: 79 successful jobs, 26 skipped, 0 failed. The CI gate job and the separate
openclaw/ci-gate,openclaw/dependency-review, andopenclaw/security-sensitive-reviewcommit statuses are successful. At 19:31 UTC on October 24, all 18 workflows on this head were terminal: 16 successful and 2 skipped; all 161 check-runs were terminal: 105 successful, 55 skipped and 1 neutral.The preflight checked out merge
4efc146f92780a56604d80565c3b2d6d04c0a35b, treeb80612f193e208ad5870d32a6ba4aa3fa47be2e4, with parents main820c30a3a0101abd0a739406a116a95e1e99429dand this head. That base is newer than the main commit used for the focused local validation. The complete CI log archive is 9,191,036 bytes, 944 members, CRC verified, SHA-2561239613479a3242f4fe70f099216bc946bb3008b975e6535ad7819999832832b. In job 120960718369, Bun passedSQLite transcript history cache > reuses recent payloads with fresh result ownership until append or rewriteandreadRecentUserAssistantTextForSession grounding > refuses an authorized reference a space continues onto another stored file.The compatibility decisions below remain open. Current security requirements are evaluated by the security-review workflow.
Earlier measurements, on the older heads named below:
Head
0ff83d79b6con an M4 Pro, with each file run on its own. The head mergesmaine69e34001fb5at62dd1ca78a2, then moves selection ontomain's single-snapshot reader. Dependencies come from the frozen lockfile, installed with pnpm 12.10.1 because the local install of the pinned 12.11.1 was broken.openclaw-agent-execution-incognito.history.test.tsis gone frommain(#170712). The memory-actor recent-text route is covered bysession-transcript-memory-read.test.ts,transcript.memory.test.tsand the actor case intranscript-turn-media-references.test.ts. The last five rows aremain's tests of the three reader backends.transcript-grounding.test.ts> "bounds every retained entry and the complete replay prompt after grounding" failed 2 of 9 whole-file runs before the merge withdatabase is lockedwhile opening the state database (openNativeStateDatabase->requireRollbackJournalMode); on the merge it passed 6 of 6 at load average 9 to 23. The new probe never runs in that test and reads no SQLite. Not changed. On the redesign, the file passed 5 of 5 whole-file runs. Two of those runs came before the type-only lint fixes.embedded-agent-subscribe.tools.media.test.tsholds only this PR's cases now: main deleted the rest of that file (#158721, #160205, #166619). Its fixture now sets an empty runtime config snapshot.main's session-history worker reads the prepared runtime config and throwsRuntime config is not preparedwithout one.Fail-before, pass-after, run with the new tests against the production files from before each fix:
1b81028477e(tab/LF/CR infile:URLs): the 6 new matcher cases and the resolver-to-replay test fail. Without the fix, the threefile:spellings replay verbatim even thoughresolveInboundMediaReferenceopens each of them to the realmedia/inbound/x.png. A prose-boundary control test passes both before and after. Mutating any one of the fix's three rules fails exactly the test that pins it.b77491c03dd(authorized path run-on and~): 7 new matcher cases fail, as does a resolver-to-replay test for two~/...spellings thatresolveInboundMediaReferenceopens withOPENCLAW_HOMEset to a temp dir. A control test for~spellings that reach no root passes both before and after.9faa6bd04d4(Windows drive roots): withtranscript-grounding.tsfrom the merge commit, 11 of the 111 unit cases fail. Ten win32 spellings replay verbatim andC:/Users/Bot/.openclaw/%6dedia/x.pngis redacted. Injected Windows groundings only; not run on Windows.0ff83d79b6c(provenance inside the single-snapshot reader). Each mutation was applied to the head and reverted. They were measured on the redesign before two type-only lint fixes.transcript-recent-grounding.ts: 13 of 15transcript-grounding.test.tscases fail, and so do both channel-context cases inembedded-agent-subscribe.tools.media.test.ts.transcript.tsnot requestingincludeTurnMediaReferences: the 6 grounding cases and 2 channel-context cases that need a trusted reference to survive fail.transcript-turn-media-references.test.tsand 3 intranscript-grounding.test.ts.The two page-read tests from
ef8a251fe9aare replaced:2d2b895f508(joined names): withtranscript-grounding.ts,transcript-recent-grounding.tsandmedia-reference.tsfroma2e8eca58cf, the resolver-to-replay test "refuses an authorized reference the resolver joins onto another stored file" fails in 5 of 5 runs (the spellings replay verbatim althoughresolveInboundMediaReferenceopensok.png.fakefor each), and the unit case "keeps prose boundaries around file URLs and reports the names a resolver could join" fails. Both pass on the head;ok.png<LF>next lineand a one-per-line path list stay verbatim.Gates at
0ff83d79b6c,--base e69e34001fb5. These pass:config:docs:check,plugins:inventory:checkand the deprecated-API guard;session-history-read.imports.test.ts) and the PR-wrapper inventory (eager-import-closure.test.ts);Two fail identically on
e69e34001fb5alone, in files this PR does not touch: the max-lines ratchet (new suppressions in threeui/files) and the env-var budget (456OPENCLAW_*names against 452). Not rerun at this head: the core tsgo graph boundary and the dead-export scan.Grounding cost is linear in input size. An M4 Pro at load average 17 to 22, before the tab/LF/CR fix:
The tab/LF/CR scan runs only when the text holds both
file:and one of those characters. At1b81028477e, on a MacBook Air at load average 50 to 60 (read the ratios, not the absolute times), afile:///managed/state/x y/../me<TAB>dia/xflood took 229/457/961/2182 ms before and 653/1281/2572/5211 ms after, at 64/128/256/512 KiB.The extent flood test now redacts 16,000 comma-separated paths in one token (474 KiB) with a 10 s timeout as the assertion: 41-43 ms at the head, and a timeout at 46,351 ms with
reanchorTokenforced to discard the extent.The older in-process runtime run at
6876d240238, the v2026.9.9 upgrade transcript and the earlier "no Gateway run" note are superseded by the shipped Gateway proof above.Not run locally: the full suite.
Open for maintainers:
includeTurnMediaReferencesonmain's recent-text reader is off by default, and other readers' results are unchanged. The reader now eagerly importstranscript-turn-media-references.ts, which importsembedded-agent-tool-media.ts. Soscripts/pr-lib/wrapper-components.txtgains 18 files: the collector, plus the 17 files of its eager import closure that the inventory lacked. One of those,media-grounding-limits.ts, was already missing before the redesign: at the merge commit62dd1ca78a2the inventory check failed on exactly that file, because this PR'smedia-reference.tsimports it.parseInboundMediaUrinow refusesmedia://inbound:<port>/..., a baremedia://inbound:/...and empty userinfo. Non-empty userinfo was already refused onmain. All in-tree writers usemedia://inbound/${...}, so only a hand-written or model-written form like these in an existing transcript stops resolving. No real transcripts were scanned.src/worker/embedded-agent.runtime.tsguards without a trust set. A worker's tool results persist without the marker and replay under the core-name rule, as all tool results do onmain. Not changed here.git merge-treeofd929366aca6cwith maina48aabc669b65212a088714985995d70b3363095(October 26, 18:27 UTC) conflicts inattempt-session-runtime-prepare.test.ts,transcript-recent-text.tsandmedia-reference.ts. Not resolved in this update.