mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2641] [Issue]: sanitizeTextAgentResponse misses the message_id-attributed <committed_tracker_state> tag #1300
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1300
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Romuromylus on GitHub (Jun 19, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2641
Originally assigned to: @Romuromylus on GitHub.
Summary
Severity: Low — leak (self-injection of tracker JSON into the main prompt).
sanitizeTextAgentResponsestrips only the attribute-less<committed_tracker_state>tag, butbuildCommittedTrackerStateContextnow emits<committed_tracker_state message_id="...">whenincludeMessageIdsis true. An echoed attributed block therefore survives sanitization and is injected back into the prompt.Expected behavior
The sanitizer should strip the committed-tracker-state block regardless of attributes on the opening tag, so an echoed tracker block never re-enters the main prompt.
Actual behavior
packages/server/src/services/agents/agent-executor.ts:1910:This matches only the bare tag, while
buildCommittedTrackerStateContext(1357–1359) emits<committed_tracker_state${messageIdAttr}>wheneveroptions.includeMessageIdsis true (set fromedit_messages === true, line 1080). The text/sanitize path is taken only when the agent response is not JSON, which requires a custom agent withresultType=context_injection. So a custom agent withresultType=context_injectionandedit_messages=true, whose model echoes the attributed tracker block as bare content, bypasses the sanitizer and re-injects that block.Steps to reproduce
settings.resultType = 'context_injection'andcapabilities.edit_messages = true.<committed_tracker_state message_id="...">...</committed_tracker_state>block in its response.Environment
staging @ 3dc062e2Logs, screenshots, or video
Static source audit, cited to file:line above.
Additional context
Fix sketch: tolerate attributes on the opening tag —
/<committed_tracker_state\b[^>]*>[\s\S]*?<\/committed_tracker_state\s*>/gi— and apply the same to the adjacent<assistant_response>strip on the next line.Regression notes: not a regression —
main's sanitizer (agent-executor.ts:1382) is the identical bare-tag-only regex, and the attribute-bearing emission is new to staging, somainnever had the attributed form to leak. Low impact: the leaked content is the model's own read-only tracker JSON re-entering its prompt (continuity noise / token waste), not cross-user or secret data. Found via static audit.Template check