Skip to content

fix(chat): sync live-stream fence strip regex with backend TOOL_TAGS#3994

Closed
michaelxer wants to merge 1 commit into
odysseus-dev:devfrom
michaelxer:fix-exec-fence-sync-3993
Closed

fix(chat): sync live-stream fence strip regex with backend TOOL_TAGS#3994
michaelxer wants to merge 1 commit into
odysseus-dev:devfrom
michaelxer:fix-exec-fence-sync-3993

Conversation

@michaelxer

@michaelxer michaelxer commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

The browser-side EXEC_FENCE_RE regex in chatRenderer.js only covered 6 tool names (web_search, read_file, write_file, create_document, edit_document, update_document). The backend strips all TOOL_TAGS from persisted round_texts via tool_parsing.py, but the live streaming path uses the narrower frontend regex. This mismatch causes executed fenced tool calls for email, cookbook, MCP, and other tools to remain visible in the live chat view until the session is reloaded.

This PR replaces the hardcoded EXEC_FENCE_RE with an EXEC_TOOL_TAGS array that mirrors src/agent_tools/__init__.py TOOL_TAGS (excluding bash, python, ls which are valid fenced-code language identifiers), and builds the regex from it.

Target branch

  • This PR targets dev, not main.

Linked Issue

Fixes #3993

Type of Change

  • Bug fix (non-breaking — fixes a confirmed issue)

Checklist

  • I searched open issues and open PRs — this is not a duplicate.
  • This PR targets dev
  • My changes are limited to the scope described above.
  • I actually ran the app and verified the change works end-to-end.

How to Test

  1. Start Odysseus with a local fenced-tool model (e.g. Ollama).
  2. Enable an email tool (e.g. list_emails) via agent tool config.
  3. Ask the agent to list emails so the model emits a fenced list_emails call.
  4. Watch the live streaming bubble during and after tool execution.
  5. Before fix: the raw fenced block remains visible until session reload.
  6. After fix: the fence is stripped from the live view immediately.

Regex verification:

  • EXEC_FENCE_RE.test("```list_emails\n{\"max_results\":10}\n```") -> true
  • EXEC_FENCE_RE.test("```python\nprint(\"hello\")\n```") -> false

Visual / UI changes

  • No visible UI change — this only affects text stripping logic in stripToolBlocks(). No new CSS, colors, fonts, or component patterns.

@github-actions github-actions Bot added needs work PR description incomplete — please update before review ready for review Description complete — ready for maintainer review and removed needs work PR description incomplete — please update before review labels Jun 11, 2026
@michaelxer
michaelxer marked this pull request as ready for review June 11, 2026 22:25
The browser-side EXEC_FENCE_RE only covered 6 tool names
(web_search, read_file, write_file, create_document,
edit_document, update_document) while the backend strips all
TOOL_TAGS from persisted round_texts. This caused executed
fenced tool calls (e.g. list_emails, send_email) to remain
visible in the live streaming view until session reload.

Replace the hardcoded regex with an EXEC_TOOL_TAGS array
sourced from the same set as src/agent_tools/__init__.py
(minus bash/python/ls which are valid code-block identifiers),
and build EXEC_FENCE_RE from it.

Fixes odysseus-dev#3993
@michaelxer

Copy link
Copy Markdown
Contributor Author

CI is all green, ready for review when you have a moment.

@michaelxer

Copy link
Copy Markdown
Contributor Author

Closing to keep the PR queue tidy. The fix is still valid if anyone wants to pick it up -- the frontend EXEC_FENCE_RE regex only covers 6 tool names while the backend strips all TOOL_TAGS, leaving email/cookcook/MCP tool calls visible during live streaming.

@michaelxer michaelxer closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready for review Description complete — ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Live chat leaves executed email tool fences visible until reload

2 participants