fix(renderer): keep the restored run's frames, candidates and publication lines (4/4) #229
<!-- codex-pull-request-review-summary -->
<!-- codex-review-state:v1 {"code_review":{"commit_sha":"5785e61d8b178a0af7c629a81df8b182ca730b66","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->
<details>
<summary><strong>Codex Review Summary</strong>: ✅ Completed</summary>
This comment shows the latest Codex review activity on this pull request.
| Review | Status | Commit | Review trigger |
| --- | --- | --- | --- |
| 📝 Code Review | ✅ Completed <relative-time datetime="2026-11-30T13:53:20.778154Z">2026-11-30T13:53:20.778154Z</relative-time> | 5785e61 | PR opened |
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
</details>
</details>
<sub><sub>!P2 Badge</sub></sub> Sequence requests across the screen-to-outgoing transition
When a run starts candidates fetch A while on screen, then a new launch moves it to outgoingRunRef and a later candidates event starts fetch B, A has keptRequest === null while B increments latestKeptCandidatesRequestRef. If B resolves first and A resolves afterward, this predicate still accepts A because the screen request counter never changed, allowing the older inventory to overwrite B; if the launch is refused, the restored run therefore shows stale candidates (and an older rejection can similarly surface after a newer success). Include pre-launch requests in the outgoing request ordering once their run moves off screen.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<!-- codex-review-receipt:v1 -->
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5785e61d8b
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Your 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".
</details>
Thanks. This ordering needs two candidates events for the same run: the first starts the screen fetch, and the second starts the kept fetch. The shell emits that event once per run, from the run-end inventory (src-tauri/src/ipc/commands.rs:984). So a second fetch cannot start for a run whose first fetch is still in flight. We are leaving the counters as they are and have noted this as later work, in case the shell ever emits the event more than once.
constant1n0
Later work left by the reviews of #222–#225: after a refused Start or restart, the restored run keeps its later frames, its candidates and its publication lines.
Chain context
size:exceptionis requested. About 490 lines are tests.What changes
- The table is read through a ref, not from the click's render.
- A
candidatesevent from the outgoing run while the launch is pending is fetched, kept aside, and restored on refusal with the outgoing run's adapter.- That fetch has its own sequence counter, so it cannot cancel the new run's fetch.
- A fetch started before the click is kept the same way.
- Lines go to the run that was on screen when Publish was clicked.
- While a launch is pending they are kept with that run's transcript, and they come back on refusal.
- Once a launch is accepted they are dropped, as before.
showCandidates. The outgoing record type is nowOutgoingRun.Checks
npm --prefix renderer test: 1,037 passed. Lint andtsc -bare clean.- restored-run frames;
- the outgoing run's candidates event;
- a fetch started before the click;
- the click's render;
- publication lines.
Risk
Out of scope (later work)
misplacedevent from the outgoing or restored run does not refresh the wrong-root section.