Skip to content

feat: truncate oversized event payloads in session response#524

Merged
pancacake merged 1 commit into
HKUDS:devfrom
xiongjnu:feat/session-truncation
May 27, 2026
Merged

feat: truncate oversized event payloads in session response#524
pancacake merged 1 commit into
HKUDS:devfrom
xiongjnu:feat/session-truncation

Conversation

@xiongjnu

Copy link
Copy Markdown
Contributor

RAG tool results can return KB document content exceeding 1MB per event, causing the frontend TraceSurface to run out of memory when loading large sessions. Truncate tool_result and observation payloads at 1MB in the get_session endpoint, marking truncated events with _truncated: true.

The LLM context builder reads from a separate content-only store and is unaffected by this truncation.

Test plan

  • Create a session with RAG tool results exceeding 1MB → events are truncated, _truncated: true is set
  • Small sessions (<1MB events) → no truncation occurs
  • LLM context building → unaffected (uses separate data path)

RAG tool results can return KB document content exceeding 1MB per event,
causing the frontend TraceSurface to run out of memory when loading large
sessions. Truncate tool_result and observation payloads at 1MB in the
get_session endpoint, marking truncated events with _truncated: true.

The LLM context builder reads from a separate content-only store and
is unaffected by this truncation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@pancacake pancacake changed the base branch from main to dev May 27, 2026 12:20
@pancacake pancacake merged commit c1932dc into HKUDS:dev May 27, 2026
@pancacake

Copy link
Copy Markdown
Collaborator

Thanks for your contribution!

pancacake added a commit that referenced this pull request May 27, 2026
Security: lock down the TutorBot tool sandbox (shell exec is opt-in, all
filesystem/shell access confined to the bot workspace) and isolate per-user
resources, closing #518, #517, #516, #515, #514 and #506 (first hardened in
#507).

Bug fixes: chat input disabled after the first turn (#520), KB embedding
failure on long documents (#521 / #509), profile creation under Docker
(#512 / #513), Qwen reasoning models failing native tool calling (#527 / #528),
the GPT-5 init-wizard token parameter (#508), and oversized session-event
truncation (#524).

Features: HTTP/SSE API for multi-turn chat with a specific TutorBot (#511),
multimodal image fallback for vision-capable providers without a capability
entry, safe ZIP knowledge upload, and a /settings/network page with model
fetching (community PRs #522 and #523 reimplemented locally).

Also bumps __version__ to 1.4.1, adds the v1.4.1 release notes, updates the
README Releases section, and ships the Astro + Starlight docs site under site/.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
anideebee7 added a commit to intelli-verse-x/DeepTutor that referenced this pull request Jun 6, 2026
The upstream v1.4.2 sync brought tests/api/test_sessions_truncation.py but its
implementation was lost during the original fork merge, leaving the test red
and (because it errored at collection) masking the rest of the smoke suite.
Restore _truncate_oversized_events + MAX_EVENT_PAYLOAD + _TRUNCATION_NOTICE and
wire it into GET /sessions/{id} so oversized tool-result/observation payloads
are trimmed in the history response.

Co-authored-by: Cursor <cursoragent@cursor.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.

2 participants