Skip to content

fix #441: preserve long user prompts in event stream - #527

Draft
rohantiwari9573 wants to merge 1 commit into
CraftOS-dev:devfrom
rohantiwari9573:fix/issue-441-long-prompt-processing
Draft

rohantiwari9573 wants to merge 1 commit into
CraftOS-dev:devfrom
rohantiwari9573:fix/issue-441-long-prompt-processing

Conversation

@rohantiwari9573

Copy link
Copy Markdown

What

  • Preserve long user messages in the event stream instead of replacing them with file pointers.
  • Ensure complete user prompts reach the LLM in new and established sessions without unnecessary duplication.
  • Handle context-window overflow as a terminal, user-visible error for the affected run.
  • Prevent repeated retries of requests that cannot fit the model's context.
  • Safely set aside messages that were not processed so subsequent valid requests can continue.
  • Handle subagent context overflow appropriately.

Why

Long user messages exceeding the event stream's 16,000-character threshold were replaced with file-pointer instructions.

Established sessions send only newly added events to the LLM. Consequently, the model could receive the pointer rather than the actual user request, even though the complete message remained visible in the chat interface.

This change preserves the actual request and improves context-overflow recovery.

How to test

  • pytest tests/test_long_user_messages.py tests/test_context_overflow_run_end.py -q
  • Relevant existing event-stream, router, context-budget, session and subagent tests.
  • ruff check .
  • ruff format --check .
  • python -m compileall -q app agent_core agents decorators skills

Automated validation reported:

  • 4,344 passed.
  • 9 failed.
  • 39 skipped.
  • 25 new regression tests passed.
  • 431 related existing tests passed.
  • All five deliberate mutation scenarios were detected.

The nine full-suite failures were reproduced against the original upstream/dev implementation and are documented as pre-existing issues.

Screenshots / Logs

This is a backend and agent-execution change, so automated test results and execution-path evidence are provided instead of UI screenshots.

Known limitations

Real-model behaviour has not yet been independently verified. The complete prompt was verified at the provider interface using a fake LLM.

The lower-level LLM logging system still records full prompts and responses; that privacy concern is outside this change.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Rohan <rohantiwari166@gmail.com>
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