Skip to content

fix(ui): Prevent stale Git branch and working directory in agent sessions#9970

Open
PratikRai0101 wants to merge 2 commits intowarpdotdev:masterfrom
PratikRai0101:fix/stale-agent-branch
Open

fix(ui): Prevent stale Git branch and working directory in agent sessions#9970
PratikRai0101 wants to merge 2 commits intowarpdotdev:masterfrom
PratikRai0101:fix/stale-agent-branch

Conversation

@PratikRai0101
Copy link
Copy Markdown

@PratikRai0101 PratikRai0101 commented May 3, 2026

Description

This PR addresses Bug 1 from issue #9958. It ensures that the Git branch and working directory displayed in the vertical tabs and status bar remain fresh during active CLI agent sessions.

Key Changes

  • Data Preference: Updated current_git_branch() and display_working_directory() to prioritize live filesystem/process data over potentially stale shell prompt chips.
  • Subscription Logic: Modified should_subscribe_to_git_status() in view.rs to be unconditional when a repository is detected. This ensures that git_status_metadata() is actually populated even if the GitDiffStats toolbar chip is disabled.
  • Resource Safety: Subscriptions remain safe as they are gated by the existence of a valid repo_path and are managed by GitStatusUpdateModel which handles deduplication and automatic teardown.

Linked Issue

Addresses Bug 1 in #9958

Screenshots / Videos

screenrecording-2026-05-03_16-03-59.mp4
screenshot-2026-05-03_16-02-17

Testing

Verified that branch and CWD updates are reflected immediately in the UI even when the CLI agent is active and prompt chips are not refreshing. Verified that disabling toolbar chips no longer breaks the live branch update.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Changelog Entries for Stable

CHANGELOG-BUG-FIX: Fixed an issue where the terminal sidebar and status bar could show stale Git branch and working directory information during an active CLI agent session.

@cla-bot cla-bot Bot added the cla-signed label May 3, 2026
@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 3, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 3, 2026

@PratikRai0101

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@PratikRai0101 PratikRai0101 changed the title # fix(ui): Prevent stale Git branch and working directory in agent sessions fix(ui): Prevent stale Git branch and working directory in agent sessions May 3, 2026
oz-for-oss[bot]
oz-for-oss Bot previously requested changes May 3, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR changes terminal tab metadata to prefer live working-directory and git-status data over potentially stale prompt chips.

Concerns

  • The changed metadata is visible in the sidebar/status bar, but the PR does not include a screenshot or video demonstrating the updated behavior end to end. For faster review, please upload screenshots or a video of the feature working end to end.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 3, 2026

@PratikRai0101

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

oz-for-oss[bot]
oz-for-oss Bot previously requested changes May 3, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR changes terminal tab metadata so working directory and Git branch display prefer live terminal/repo state over prompt chip snapshots, addressing stale UI during active agent sessions.

Concerns

  • current_git_branch() now prefers git_status_metadata(), but the Git status subscription is still gated by GitDiffStats configuration rather than branch consumers, so branch-only toolbar/prompt configurations can still fall back to the stale ShellGitBranch chip.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/terminal/view/tab_metadata.rs
@PratikRai0101
Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 3, 2026

@PratikRai0101

I'm re-reviewing this pull request in response to a review request.

I reviewed this pull request and requested human review from: @warpdotdev/oss-maintainers.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot dismissed stale reviews from themself May 3, 2026 11:14

Oz no longer requests changes for this pull request after the latest automated review.

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR updates terminal tab metadata to prefer live working-directory and git-status model data over prompt chip values, and broadens git status subscription so branch/diff metadata remains available even when toolbar chips are disabled.

Concerns

  • No blocking correctness, security, or error-handling concerns found in the changed lines.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot requested review from a team and alokedesai and removed request for a team May 3, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant