Remove pending status write-back after expert exit#65
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Removes the immediate “pending” status marker write-back that occurred right after sending /exit, and simplifies the shared exit helper API used by both the Tower UI and CLI reset flow.
Changes:
- Replace
exit_expert_and_set_pending(...)withexit_expert(...)and update call sites in Tower and CLI reset. - Remove the
ExpertStateDetector::set_marker(..., "pending")write-back from the exit helper. - Drop now-unneeded detector construction/imports in the affected flows.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/tower/app.rs | Updates expert restart flows to call exit_expert without forcing a pending marker. |
| src/commands/reset.rs | CLI reset now uses exit_expert and no longer constructs an ExpertStateDetector. |
| src/commands/common.rs | Renames/simplifies the shared exit helper and removes pending marker write-back. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+195
to
200
| /// Send Escape + /exit to an expert and wait for it to stop. | ||
| pub async fn exit_expert(claude: &ClaudeManager, expert_id: u32) -> Result<()> { | ||
| claude.send_keys(expert_id, "Escape").await?; | ||
| claude.send_exit(expert_id).await?; | ||
| tokio::time::sleep(std::time::Duration::from_secs(3)).await; | ||
| detector | ||
| .set_marker(expert_id, "pending") | ||
| .context("Failed to set expert status to pending")?; | ||
| Ok(()) |
Comment on lines
+196
to
200
| pub async fn exit_expert(claude: &ClaudeManager, expert_id: u32) -> Result<()> { | ||
| claude.send_keys(expert_id, "Escape").await?; | ||
| claude.send_exit(expert_id).await?; | ||
| tokio::time::sleep(std::time::Duration::from_secs(3)).await; | ||
| detector | ||
| .set_marker(expert_id, "pending") | ||
| .context("Failed to set expert status to pending")?; | ||
| Ok(()) |
Revert the set_marker("pending") call added in 8e3fe25 that was invoked
right after exiting an expert. Exit should only stop the expert; status
transitions are handled by the existing init-time seed and downstream
hooks/event handlers.
Rename the shared helper exit_expert_and_set_pending to exit_expert,
drop its detector argument, and update all five call sites (reset.rs
and four tower/app.rs flows: change_expert_role, reset_expert,
return_expert_from_worktree, launch_expert_in_worktree).
Helper consolidation and PreparedExpertFiles from 8e3fe25 are kept as-is.
7da0586 to
4908e16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
set_marker("pending")call introduced in 8e3fe25 (Fix expert status not resetting to pending on exit+relaunch flows #64) that forced expert status back topendingimmediately after/exit.exit_expert_and_set_pending→exit_expert, drop itsdetectorargument, and update all five call sites (reset.rs+ fourtower/app.rsflows:change_expert_role,reset_expert,return_expert_from_worktree,launch_expert_in_worktree).PreparedExpertFiles,prepare_expert_files_with_role) intact.Why
exit_expert_and_set_pendingmixed two concerns — sending/exitand writing the status marker. The pending write-back is now removed; status transitions are left to the init-time seed and downstream hooks/event handlers. Otherset_marker("pending")call sites unrelated to the exit flow (feature-execution cancel inhandle_feature_execution, feature-execution retry handler,init_sessionseeding) are untouched.Test plan
make fmt-checkmake lint(clippy-D warnings)make build(release)make test(813 passed)reset,change role,return from worktree,launch in worktree) still leave the expert in a correct visible state once downstream hooks fire.