Commit 434b50d
## Description
Resolves #9525.
`PermissionRequest` populates `session_context.summary` (plus
`tool_name` / `tool_input_preview`) so the tab can show e.g. *\"Wants to
run bash: …\"*. Nothing was clearing those fields when the permission
flow ended, so after the session reached `Success` the tab kept showing
the stale permission text — the bug the reporter hit on Claude Code +
[claude-code-warp](https://github.com/warpdotdev/claude-code-warp).
### Root cause
The title path under `AgentTabTextPreference::ConversationTitle` reads
`session_context.title_like_text()` directly, which is `summary`. So
even after `Stop` repopulates `query` and `response`, the tab keeps
showing whatever the last `PermissionRequest` set in `summary`.
```rust
// app/src/workspace/view/vertical_tabs.rs:3081
agent_text.cli_agent_title = session.session_context.title_like_text();
```
### Fix
Introduce `CLIAgentSession::clear_permission_scoped_state()` and call it
on the three transitions that close out the permission flow:
| Transition | Why |
|---|---|
| `Stop` | Session completed; permission state is no longer relevant —
primary repro path. |
| `PermissionReplied` | User answered; status returns to InProgress. |
| `PromptSubmit` | Defensive: the user starting a new turn invalidates
any leftover permission state (mirrors the existing `response = None`
reset already on this arm). |
`PermissionRequest` itself still populates these fields, so the
Blocked-state UI is unchanged.
## Linked Issue
- [x] The linked issue is labeled `ready-to-spec` or
`ready-to-implement`. (#9525 is `ready-to-implement`.)
Resolves #9525.
## Testing
Four new unit tests in
`app/src/terminal/cli_agent_sessions/mod_tests.rs`:
| Test | What it checks |
|---|---|
| `stop_clears_permission_scoped_state` | Primary GH-9525 regression:
`summary`/`tool_name`/`tool_input_preview` are cleared and
`query`/`response` are repopulated when `Stop` follows
`PermissionRequest`. |
| `permission_replied_clears_permission_scoped_state` | Covers the
user-replied path; status returns to InProgress with permission state
cleared. |
| `prompt_submit_clears_permission_scoped_state` | Covers the
abandoned-permission path; clears `response` (existing behavior) and the
permission fields (new behavior). |
| `permission_request_still_populates_summary_and_tool_fields` | Sanity:
the population path is unaffected — `PermissionRequest` still sets all
three fields and transitions to Blocked. |
Each test starts from a Blocked session with permission state populated
(factored into a `blocked_claude_session_with_permission_state()`
helper), applies the relevant event, and asserts the post-state.
## Agent Mode
- [ ] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
CHANGELOG-BUG-FIX: Tab titles for plugin-backed CLI agents (e.g. Claude
Code via claude-code-warp) no longer keep showing stale
permission-prompt text after a session completes. Thanks @lonexreb!
---------
Co-authored-by: harryalbert <harryalbert364@gmail.com>
1 parent 044d6eb commit 434b50d
2 files changed
Lines changed: 185 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
151 | 162 | | |
152 | 163 | | |
153 | 164 | | |
| |||
165 | 176 | | |
166 | 177 | | |
167 | 178 | | |
| 179 | + | |
168 | 180 | | |
169 | 181 | | |
170 | 182 | | |
| |||
176 | 188 | | |
177 | 189 | | |
178 | 190 | | |
| 191 | + | |
179 | 192 | | |
180 | 193 | | |
181 | 194 | | |
| |||
197 | 210 | | |
198 | 211 | | |
199 | 212 | | |
| 213 | + | |
200 | 214 | | |
201 | 215 | | |
202 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
0 commit comments