Skip to content

fix(compaction): tolerate slow summarizers and show live chat activity - #1115

Merged
chen-ran merged 2 commits into
felinics:mainfrom
ChrAlpha:fix/compaction-summarizer-client
Sep 4, 2026
Merged

fix(compaction): tolerate slow summarizers and show live chat activity#1115
chen-ran merged 2 commits into
felinics:mainfrom
ChrAlpha:fix/compaction-summarizer-client

Conversation

@ChrAlpha

@ChrAlpha ChrAlpha commented Aug 31, 2026

Copy link
Copy Markdown
Member

Automatic context compaction used the interactive HTTP client's 30-second response-header timeout, which could abort a healthy summarizer before its first response. Compaction now uses a dedicated client with a 3-minute header timeout and a 10-minute overall cap; interactive chat retains its existing timeout.

Long compactions also left chat users without visible feedback. The composer now shows a localized “Compacting context…” shimmer while manual or automatic compaction runs, and removes it when the work ends. It reuses the existing composer panel and reduced-motion styling.

The existing bot activity stream carries permission-filtered compaction snapshots on connection, on state changes, and with its heartbeat. Manual requests show feedback immediately and are deduplicated by bot/session. Reconnection replaces stale activity, and older frontends safely ignore the new event. Activity reflects the connected server process, consistent with the existing in-process event hub.

Validation:

  • 133 related frontend tests passed, covering chat state, activity snapshots, request deduplication, and stream cleanup.
  • go test -race ./internal/agent/context/compaction ./internal/handlers ./cmd/agent ./cmd/internal/core passed.
  • The commit hook also passed full go test ./... and Go lint.
  • Web production build and full mise run lint passed.
  • Browser component checks passed for light/dark themes, narrow layouts, English/Chinese/Japanese, reduced motion, completion cleanup, and continued typing.
  • Full Web typecheck still fails with 447 diagnostics; the untouched base also reports 447. This change does not resolve the existing type/path-configuration debt.
  • The timeout fix was previously validated with a live summarizer on the earlier head. The new activity UI has component/transport tests, but has not been exercised end-to-end against a real summarizer.

⚠️ No human QA — this PR has not been verified by a human yet. Remove this line once a human confirms the happy path.

@ChrAlpha
ChrAlpha requested a review from a team as a code owner August 31, 2026 05:54
The automatic compaction path injected the interactive non-streaming
client, whose 30s ResponseHeaderTimeout is far below the summarizer's
measured cold TTFB (60-93s on ~110k-token inputs): every automatic pass
died with 'timeout awaiting response headers' while manual /compact,
which never set a client, survived on the SDK default. Compaction now
uses its own transport with a 3m header deadline; interactive
non-streaming chat keeps the 30s policy.

Claude-Session: https://claude.ai/code/session_01BQNmA3AKE3nh6AnArrG54g
@chen-ran
chen-ran force-pushed the fix/compaction-summarizer-client branch from 74ce732 to 2c69db9 Compare September 4, 2026 18:28
@chen-ran
chen-ran requested review from a team as code owners September 4, 2026 19:22
@chen-ran chen-ran changed the title fix(compaction): give the summarizer a patient HTTP client fix(compaction): tolerate slow summarizers and show live chat activity Sep 4, 2026
@chen-ran
chen-ran merged commit 4ae8b0f into felinics:main Sep 4, 2026
19 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.

2 participants