Skip to content

fix: restore context for resumed sessions - #29

Closed
echoVic wants to merge 1 commit into
mainfrom
fix/issue-28-resumed-context
Closed

fix: restore context for resumed sessions#29
echoVic wants to merge 1 commit into
mainfrom
fix/issue-28-resumed-context

Conversation

@echoVic

@echoVic echoVic commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Fixes #28

What changed

  • Restore the latest provider context from legacy cumulative session.usage records when bootstrapping a recorded session.
  • Derive the context limit from the configured model window instead of hard-coding 128000.
  • Publish the restored surface snapshot immediately during history hydration.
  • Track typed context revisions so an unchanged surface snapshot cannot overwrite a newer provider context observation.

Root cause

Recorded sessions initialized the runtime surface with 0 / 128000, did not reconstruct legacy usage deltas on resume, and the TUI history path emitted HistoryLoaded without an initial typed surface projection.

Verification

  • cargo test -p orca-runtime -p orca-tui --lib -- --test-threads=1: runtime 1008/1009 passed with one existing ACP shutdown timing failure; the failed test passed on three exact reruns.
  • cargo test -p orca-tui --lib -- --test-threads=1: 1037 passed, 0 failed.
  • cargo test -p orca-runtime resumed_legacy_usage_restores_latest_provider_context --lib: passed.
  • cargo test -p orca-tui resumed_legacy_usage_projects_context_before_next_turn --lib: passed.
  • cargo test -p orca-tui provider_context_survives_same_revision_surface_sync_in_footer --lib: passed.
  • cargo check -p orca-runtime -p orca-tui --all-targets: passed.
  • git diff --check: passed.

The real reproduced session has cumulative input totals 929128 and 970611, restoring to 41483 / 1000000, displayed as context 4%.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 21bbf7c7-79ee-4250-9fba-7fdc2ed82001

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@echoVic

echoVic commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

Superseded by merged PR #27 and released in v0.3.7 (6088d85). The same context restoration fix is already on main; closing this duplicate draft PR.

@echoVic

echoVic commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

Closing as superseded by merged PR #27 / v0.3.7.

@echoVic echoVic closed this Aug 6, 2026
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.

[Bug]: Resumed legacy sessions keep context at 0%

1 participant