GeezerVison is showing github.com — fix(server): do not replace Claude session while live tasks run by macodev00 · Pull Request #13080 · pingdotgg/t3code
Conversation
macodev00
commented
Sep 22, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
What
- Defer Claude session replacement while live subagent/background tasks are running; keep the current process instead of calling
startSession over it.
- Treat a missing cached Claude model selection as not requiring a restart (avoids replace-while-live on the common first-follow-up path).
- If a restart predicate is true but
thread.backgroundLiveness is set, reuse the live session.
Why
Fixes #12694
ensureSessionForThread restart + startSession while tasks were live suppressed exit and silently stopped background work.
UI
N/A — server session lifecycle; may surface a runtime.warning when replacement is deferred.
Checklist
- I read CONTRIBUTING.md and kept this small / bug-only
- What + why explained above
- Followed AGENTS.md documentation rules (no new docs)
- No unrelated changes
- CLA / AI-reviewed standing override for macodev00 auto-contrib
Summary by CodeRabbit
- Bug Fixes
- Prevented active provider sessions from being replaced while background tasks are still running.
- Added runtime warnings and request errors when a session replacement is blocked.
- Preserved the existing session and its access mode after blocked turn or compaction operations.
- Improved session reuse when provider options change during background work.
- Ensured deferred provider changes are applied after background activity finishes.
- Corrected Claude session handling so model-selection changes reliably trigger a restart when appropriate.
Supersedes #12723 (GitHub PR tip was stuck behind the fork branch; reopened so CodeRabbit/Macroscope see the latest commits including compaction live-session fix + docstring coverage).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Claude startSession replaced a live thread session without emitting
session.exited, which silently stopped in-flight subagent tasks. Defer
replacement while liveTaskIds is non-empty, skip Claude restarts on a
model-selection cache miss, and reuse the session when projected
background work is still live.
Deferred session reuse left the next turn on the previous permission
callback. Fail the turn until background work ends, block startSession
when live tasks remain, and compare Claude options against the thread
selection on a cache miss.
Keep formatter wrapping and assert the live session was retained
without comparing a stale start-time resume cursor.
Do not cache a requested model selection when session replacement is
deferred for live background work. The next turn can still restart to
apply restart-only options such as fastMode.
A blocked Claude replacement stamped the requested runtime mode onto the
orchestration session before startSession applied it. The next turn then
treated that record as current and sent on the previous permission callback
while background work was still live. Compare the provider session mode,
keep that mode until replacement succeeds, and reject instead of reusing
the process.
A runtime-mode change during live background work failed the turn by
marking the provider session as error. Record that failure and leave the
session status in place. Move the Effect callback docs onto the functions
CodeRabbit counts.
Co-authored-by: maco <[email protected]>
Compaction marked the provider session as error and cleared the active turn
when ensureSession rejected a runtime-mode change while background work was
still live. Record the compaction failure and leave that session in place.
Give the failure handlers named declarations with JSDoc so docstring coverage
can see them.
Co-authored-by: maco <[email protected]>
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
macroscopeapp[bot] reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Sorry, I'm unable to act on this request because you do not have permissions within this repository.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Not approved
Macroscope's review found this PR not approvable — The PR changes existing server session lifecycle behavior across orchestration and the Claude provider, including when restarts are deferred or rejected while background tasks run. Despite strong targeted tests, the cross-component runtime gating and permission/session implications warrant human review.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
superseded — redoing from scratch for Macroscope (eligibility Not approved: cross-component session lifecycle / permission gating warrants human review; Correctness clean). Narrower bug-only redo from upstream main incoming.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Sep 22, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
⚠️ Action not completed
Pull request is closed.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Sep 22, 2026
This was referenced Nov 2, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:L
100-499 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|