Repository navigation
fix #441: preserve long user prompts in event stream - #527
rohantiwari9573 wants to merge 1 commit into
Conversation
|
@rohantiwari9573 Thank you for the contribution! Is this PR still a draft? By the way, we still need the file pointer to avoid large output action overflowing the event stream, but without the truncation causing context lost. Open for discussion. |
@zfoong Thanks for the feedback. I’ve revised the implementation to preserve the file-pointer mechanism rather than keeping long user messages inline. |
95076ad to
4761d13
Compare
…messages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Rohan <rohantiwari166@gmail.com>
4761d13 to
366a3ad
Compare
What
Long user messages are still saved to a file behind a pointer, as before; what changes is that the agent now reliably gets the original text back.
..resolved first), opens the resolved path, and checks length and SHA-256 against what was saved.grep_files/read_fileretrieval.Why
A synced session sends only new events, so for a long message the model received only the pointer, not the request. The generated pointer instructed the agent to retrieve the saved content, but the available retrieval tools could not reliably return the complete original message. read_file truncated very long lines, while grep_files returned only matching lines.
How to test
pytest tests/test_long_user_messages.py tests/test_context_overflow_run_end.py -qruff check .andruff format --check .(ruff 0.16.1)python -m compileall -q app agent_core agents decorators skillsA fake model behind the real
LLMInterfacerecords the messages handed to the provider. With a 26,014-character message marked at its beginning, middle and end, it received all three markers exactly once in new chats, established chats, session and stateless continuations, and batches (upstreamdev: none, in an established chat).Results: 47 new tests pass (1 symlink test skips without the privilege to create symlinks), and 14 deliberate mutations are all caught. The full suite gives 4,976 passed, 1 failed, 41 skipped. The one failure,
test_mini_browser_agent_integration.py::test_agent_md_copies_identical_and_mention_mini_browser, fails identically on unmodifieddev.Notes
read_file's 2,000-character line cut, and its endless paging on lines over 80,000 characters, still affect tool-output pointers; I can open a separate issue.