Skip to content

fix(agentic): reject tool-invocation syntax in Write content generation#902

Merged
bobleer merged 1 commit into
GCWing:mainfrom
bobleer:fix/write-content-tool-invocation-sanitizer
May 26, 2026
Merged

fix(agentic): reject tool-invocation syntax in Write content generation#902
bobleer merged 1 commit into
GCWing:mainfrom
bobleer:fix/write-content-tool-invocation-sanitizer

Conversation

@bobleer
Copy link
Copy Markdown
Collaborator

@bobleer bobleer commented May 26, 2026

Summary

  • Add write_content_sanitizer to detect and strip DSML / nested tool-call artifacts from Write file-body generation.
  • Retry streamed Write content generation once when the model returns tool-invocation syntax instead of raw file content; fail with guidance after the retry budget is exhausted.
  • Validate and sanitize inline Write tool content before persisting to disk.

Context

Models sometimes emit DSML blocks (<||DSML||tool_calls>, <invoke>, etc.) or nested tool-call XML inside Write content streams. This PR prevents that syntax from being written to disk and gives the agent a clear retry/failure path.

Test plan

  • cargo test -p bitfun-core write_content_sanitizer
  • cargo test -p bitfun-core sanitization_strips_dsml
  • cargo check -p bitfun-core

Strip DSML and nested tool-call artifacts from Write file-body generation,
retry once on streamed content, and validate inline Write payloads before write.
@bobleer bobleer merged commit d68d3f4 into GCWing:main May 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant