fix(session): preserve recursive state on resume - #257
Conversation
|
@codex review @coderabbitai review |
|
Warning Review limit reached
Next review available in: 19 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
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. Comment |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 495f044b4f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
| Filename | Overview |
|---|---|
| n00n-ui/src/components/messages/mod.rs | Core UI change: store_snapshot, rebake_stale_snapshots, and anchor-preservation helpers are all extended to recurse through nested compaction entries; new free functions are clean and well-tested. |
| n00n-agent/src/headless.rs | record_turn now saves transcript via history.transcript().to_vec(); spawn_interactive uses History::restored_with_transcript; two new round-trip tests added. |
| src/sdk_mode.rs | resolve_session now returns a third Vec<TranscriptEntry>; all three resume branches correctly populate or default the transcript. |
| n00n-acp/src/server.rs | spawn_session gains an initial_transcript parameter; session/resume path extracts stored.transcript and forwards it; session/new passes Vec::new(). |
| n00n-ui/src/event_loop.rs | SessionRequest::New now calls prepare_new_session_prompt before pushing the runtime, cancelling on error instead of silently swallowing the outcome. |
| n00n-ui/src/chat.rs | transcript_to_display_at now collects child_restore_items from recursive Compaction arms; new test verifies each nested tool ID appears exactly once. |
| n00n-ui/src/app/queue.rs | Adds prepare_new_session_prompt helper that validates Idle status before submitting, mapping Queued to the same error as Busy. |
Sequence Diagram
sequenceDiagram
participant Caller
participant EventLoop
participant App
participant HeadlessSpawn
participant SessionStore
participant MessagesPanel
Note over Caller,MessagesPanel: Session Resume Flow
Caller->>EventLoop: "session/resume or sdk --session=ID"
EventLoop->>SessionStore: StoredSession::load(id)
SessionStore-->>EventLoop: (messages, transcript)
EventLoop->>HeadlessSpawn: spawn_interactive(initial_history, initial_transcript)
HeadlessSpawn->>HeadlessSpawn: History::restored_with_transcript()
Note over EventLoop,App: TUI new-session path
EventLoop->>App: prepare_new_session_prompt(prompt)
alt app is Idle
App-->>EventLoop: Ok(actions)
EventLoop->>MessagesPanel: dispatch(actions)
else Busy or blank prompt
App-->>EventLoop: Err(error)
EventLoop->>HeadlessSpawn: handles.cancel()
EventLoop-->>Caller: Err(error)
end
Note over HeadlessSpawn,SessionStore: After each turn
HeadlessSpawn->>SessionStore: "record_turn(&history)"
SessionStore->>SessionStore: save messages + transcript
Note over MessagesPanel: Nested tool snapshot restore
MessagesPanel->>MessagesPanel: store_snapshot(tool_id)
MessagesPanel->>MessagesPanel: message_contains_tool() recursive
alt nested in compaction
MessagesPanel->>MessagesPanel: full cache rebuild
MessagesPanel->>MessagesPanel: preserve_anchor_at()
else top-level
MessagesPanel->>MessagesPanel: rebuild_tool_segment()
end
Reviews (4): Last reviewed commit: "fix(ui): retain backlogged restore snaps..." | Re-trigger Greptile
There was a problem hiding this comment.
Criterion
Details
| Benchmark suite | Current: 749ef98 | Previous: f5be3f3 | Ratio |
|---|---|---|---|
fib/jit_mlua_hook |
6684338 ns/iter (± 58726) |
6706525 ns/iter (± 219479) |
1.00 |
fib/jit_watchdog |
2301550 ns/iter (± 5389) |
2219583 ns/iter (± 14307) |
1.04 |
fib/jit_none |
2455227 ns/iter (± 52341) |
2239509 ns/iter (± 27791) |
1.10 |
fib/interp_mlua_hook |
8895550 ns/iter (± 146069) |
8135074 ns/iter (± 37211) |
1.09 |
fib/interp_watchdog |
4337891 ns/iter (± 29950) |
4448055 ns/iter (± 100679) |
0.98 |
fib/interp_none |
4337747 ns/iter (± 12214) |
4319187 ns/iter (± 114185) |
1.00 |
buffer_rw/jit_mlua_hook |
584776 ns/iter (± 13819) |
590949 ns/iter (± 1780) |
0.99 |
buffer_rw/jit_watchdog |
192066 ns/iter (± 385) |
192128 ns/iter (± 1436) |
1.00 |
buffer_rw/jit_none |
191900 ns/iter (± 312) |
192181 ns/iter (± 2373) |
1.00 |
buffer_rw/interp_mlua_hook |
1045822 ns/iter (± 11610) |
1048648 ns/iter (± 15563) |
1.00 |
buffer_rw/interp_watchdog |
582661 ns/iter (± 4165) |
584712 ns/iter (± 44593) |
1.00 |
buffer_rw/interp_none |
582710 ns/iter (± 4531) |
583360 ns/iter (± 2330) |
1.00 |
splash_render_120x40 |
80037 ns/iter (± 1600) |
58719 ns/iter (± 6499) |
1.36 |
splash_render_200x60 |
112800 ns/iter (± 5746) |
175680 ns/iter (± 14314) |
0.64 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@codex review @coderabbitai review |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bab2744231
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba6a47e445
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Validation
Dependency
Independent fix, but may require a small rebase after #254 because both harden session runtime paths.