Skip to content

fix: gracefully compress long session context#18

Merged
xuy merged 4 commits intomainfrom
feat/linear-ON-10
Mar 12, 2026
Merged

fix: gracefully compress long session context#18
xuy merged 4 commits intomainfrom
feat/linear-ON-10

Conversation

@xuy
Copy link
Copy Markdown
Owner

@xuy xuy commented Mar 12, 2026

[factory:impl issue=ON-10]

Summary

  • add proactive session-context compression before long diagnostic chats hit the provider limit
  • summarize older turns with Haiku, keep recent turns verbatim, and retry automatically on context-limit failures
  • add focused tests for overflow detection, summary injection, transcript truncation, and token estimation

@xuy xuy requested a review from aoiwelle March 12, 2026 18:50
@xuy
Copy link
Copy Markdown
Owner Author

xuy commented Mar 12, 2026

[factory:review issue=ON-10]
Self-review is blocked because the authenticated GitHub account authored this PR, so I requested external review from aoiwelle instead of submitting a GitHub review.

Concise status:

  • I found two blocking concerns for the external reviewer to validate: the code only does a single compress-and-retry pass, and restored sessions currently drop compressed_summary and rehydrate full history.

Copy link
Copy Markdown
Collaborator

@aoiwelle aoiwelle left a comment

Choose a reason for hiding this comment

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

LGTM

@xuy
Copy link
Copy Markdown
Owner Author

xuy commented Mar 12, 2026

[factory:review issue=ON-10]
Self-review is blocked because the authenticated GitHub account authored this PR, so I could not submit the intended REQUEST_CHANGES review on commit d6be28b5553447064660b0014c7d87a9332395bc.

Blocking findings for the external reviewer:

  • cargo test --quiet -p noah-desktop --lib fails on the current head. apps/desktop/src-tauri/src/safety/journal.rs:933 still expects 7 serialized SessionRecord fields after adding compressed_summary, and apps/desktop/src-tauri/src/safety/journal.rs:960 still expects schema version 7 after bumping SCHEMA_VERSION to 8.

@xuy xuy requested a review from aoiwelle March 12, 2026 19:46
@xuy xuy requested a review from aoiwelle March 12, 2026 19:58
@xuy
Copy link
Copy Markdown
Owner Author

xuy commented Mar 12, 2026

[factory:review issue=ON-10]
Self-review is blocked because the authenticated GitHub account authored this PR, so I re-requested external review instead of submitting the intended REQUEST_CHANGES review on commit d6be28b5553447064660b0014c7d87a9332395bc.

Blocking findings on the current head:

  • cargo test --quiet -p noah-desktop --lib still fails locally.
  • apps/desktop/src-tauri/src/safety/journal.rs:933 still asserts obj.len() == 7 after SessionRecord gained compressed_summary and resolved, so the touched serialization test is stale and failing.
  • apps/desktop/src-tauri/src/safety/journal.rs:960 still asserts schema version 7 after SCHEMA_VERSION was bumped to 8.

Copy link
Copy Markdown
Collaborator

@aoiwelle aoiwelle left a comment

Choose a reason for hiding this comment

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

Please fix these tests.

@xuy
Copy link
Copy Markdown
Owner Author

xuy commented Mar 12, 2026

[factory:review issue=ON-10]
Self-approval is blocked because the authenticated GitHub account authored this PR, so I requested external review from aoiwelle on commit a78a27832f9176c8286d1518457dd7a4c1999008 instead of posting the intended approval.

Validation on this head:

  • No new blocking findings in the context-compression, restore, or journal-schema paths.
  • cargo test --quiet -p noah-desktop --lib passed locally.
  • cargo test --workspace --quiet passed locally.

@xuy xuy requested a review from aoiwelle March 12, 2026 20:27
Copy link
Copy Markdown
Collaborator

@aoiwelle aoiwelle left a comment

Choose a reason for hiding this comment

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

LGTM

@xuy xuy merged commit 7104b5c into main Mar 12, 2026
2 checks passed
@xuy xuy deleted the feat/linear-ON-10 branch March 12, 2026 20:32
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