Skip to content

fix(agent): keep section ids in saved tool messages - #74

Merged
Rl0007 merged 4 commits into
mainfrom
fix/agent-tool-ids
Oct 6, 2026
Merged

Rl0007 merged 4 commits into
mainfrom
fix/agent-tool-ids

Conversation

@Rl0007

@Rl0007 Rl0007 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
  1. When the assistant created or split a section, the new section's id was often missing from the saved chat, so on the next message the assistant no longer knew which section it had just made.
  2. The assistant now keeps the id of every section it creates, splits or lists, across the whole conversation.

You can visit an import's Review screen, open the assistant and ask it to create a section, then ask a follow-up about that section to see it.

Fixes #34

Verification
  • Cause: tool results wrapped ids as <p7nnm9g8fb>; saving a chat message HTML-sanitizes it, so an id starting with a letter was read as a tag and removed. Ids are now wrapped in backticks in every tool/context text that prints them (and the prompt hints), which the sanitizer leaves alone. Turning sanitization off for the field was rejected: it needs a DocType change and drops XSS filtering on PDF-derived text.
  • New test test_new_section_ids_survive_saving_the_tool_message (test_section_surgery): fails on main (stored row Created section '5. Epsilon' .), passes on this branch. One existing assertion in test_rag_api updated to the new format.
  • Full suite on the devbox: 486 tests, 475 passed, 11 skipped, 0 failures (baseline 474/11 on 485, plus the new test).
  • Devbox: ran the create-section tool in a [test] assistant session on a test import; the stored tool row kept the id (... '[test] fix-34 created section' `phfttbpobg`.); section and session deleted afterwards. No LLM involved.
  • Code review: approved.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@Rl0007
Rl0007 merged commit 5d7a8fa into main Oct 6, 2026
4 of 9 checks 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.

Assistant loses the id of a section it just created or split

1 participant