Skip to content

fix(tui): the dock's GIT, FILES and NOTES views are real, on one git probe (#6565 C) - #6636

Merged
1 commit merged into
mainfrom
fix/6565-dock-views
Sep 28, 2026
Merged

1 commit merged into
mainfrom
fix/6565-dock-views

Conversation

@Hmbown

@Hmbown Hmbown commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Summary

Third #6565 follow-up: the dock's GIT, FILES and NOTES views are real, and the git badge, the Git view and the model's per-turn git line all share one git probe. It is independent of #6634 and #6635.

One probe instead of three parsers

  • git_status::probe_status replaces symbolic-ref, rev-list and status --porcelain with one git status --porcelain=v2 --branch -z. The new parse_porcelain_v2 reads head, upstream, ahead/behind, and staged, modified, untracked and conflicted counts with paths. Its classification is the one the composer badge always used.
  • One rev-parse --git-dir --git-common-dir gives both the repository name and linked-worktree detection. log -5 --format=%h%x1f%s%x1f%cr gives recent commits.
  • Git older than 2.11 (no porcelain v2) falls back to the old three calls.
  • workspace_context no longer runs git of its own. The badge reads the shared snapshot through context_line, and an explicit refresh after a tool forces a probe. The engine's per-turn git line (workspace_context::collect, engine.rs) is now one status call through the same parser and formatter.
  • Net: 6 git processes per chrome probe instead of 7-8. The badge's own 2-3 processes every 15s are gone, and the engine turn line uses 1 process instead of 2-3. The module doc's invocation list is updated.
  • Probe gate: chrome keeps the existing gate. In addition, while the Git view is showing, the probe runs during turns and agent runs too (git_probe_allowed), on the same 2s TTL, off-thread, with GIT_OPTIONAL_LOCKS=0.

Views

  • GIT:
    • the branch with ↑ahead ↓behind, "up to date", or "no upstream", plus the forge slug
    • a changes summary, with the changed paths (first 20) in the inspector
    • linked worktrees, including agent worktrees
    • the last 5 commits
    • empty states that say what is true: "reading git status…" before the first probe, "not a git repository" only when the probe found none, and "git unavailable: " when git failed
  • FILES: the edited files, each with +A −D and its change evidence in the inspector, then the files read. It reads the settled_file_activity that project() already computes each frame, now stored on WorkSurfaceState, so there is no second history scan and no new cache.
  • NOTES: one row per /note note, and Enter runs /note show n. The notes file is read off the render path with the workspace context on its existing tick, through the note command's own resolver (commands::notes_path / read_notes). A /note command refreshes it at once. The empty hint is "/note add to keep a note".

Design corrections, stated here as the design asked

  • The design said the TUI badge should "derive from cached_status()". Read naively, an explicit refresh (after a shell or exec tool that changed the branch) would show a 2s-stale cache. So an explicit refresh forces the probe, and the TTL-driven refresh reads the cache.
  • The invocation count is asserted by construction and by the real-repository probe test, which goes through the single status call. I did not add a fake-git-on-PATH counting test.

Scope

Refs #6565. Does not close it. Still open: PR D (agent progress on the mobile page, and sub-agent cache in session totals). #6634 (names and results) and #6635 (notices, shells, stalls) are in review.

Testing

  • CARGO_BUILD_JOBS=3 scripts/dev-cargo.sh test -p codewhale-tui --lib -- git_status workspace_context work_surface git_probe note engine::tests tui::ui:: worktree history: 1786 passed, 0 failed, 4 ignored.
  • cargo fmt --all -- --check: pass.
  • clippy with the CI flags on codewhale-tui: clean.
  • The three budget scripts and scripts/split/module_graph.py --check: pass.
  • Changelog checks all pass: sync-changelog, the web derive scripts, check-versions, contributor-credit and public-copy vitest (6 passed).

New tests:

  • The porcelain v2 fixture: ordinary, renamed (with its extra record), unmerged, untracked and ignored entries, a path with a space, detached and unborn heads.
  • v1 output is rejected so the caller falls back, and the v1 parser handles that fallback.
  • The log parse.
  • A probe of a real temporary repository fills the branch, the changes, the commits and the badge string, and workspace_context::collect agrees with it.
  • The Git view's state rows: before the probe, another workspace, not a repository, git unavailable.
  • The Git view's full rows: upstream, no upstream, detached, worktrees, commits, and the inspector paths.
  • FILES rows and the tab count, NOTES rows and the Enter action.
  • The git probe is allowed mid-turn only while the Git view is showing.
  • The existing badge TTL tests were updated to the shared probe.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings September 26, 2026 11:12
@Hmbown Hmbown added this to the v0.10.1 milestone Sep 26, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…probe

The GIT, FILES and NOTES views were stubs. GIT always said "not a git
repository" (#6565). The fix is below.

One git probe:
- `git_status::probe_status` replaces `symbolic-ref`, `rev-list` and
  `status --porcelain` with one
  `git status --porcelain=v2 --branch -z`, parsed by
  `parse_porcelain_v2` (head, upstream, ahead/behind, and staged,
  modified, untracked and conflicted counts with paths).
- One `rev-parse --git-dir --git-common-dir` gives the repository name
  and whether this is a linked worktree. `log -5` gives recent commits.
- Git older than 2.11 falls back to the old calls.
- The composer badge no longer runs git of its own. It reads the
  shared snapshot (`context_line`), and an explicit refresh after a
  tool forces a probe.
- The engine's per-turn git line (`workspace_context::collect`) is one
  status call through the same parser and formatter.
- Net per probe: 6 git processes instead of 7-8. The badge's own 2-3
  every 15s are gone, and the engine turn line uses 1 instead of 2-3.
- While the Git view is showing, the probe also runs during turns and
  agent runs, on the same 2s TTL, off-thread, with optional locks off.

Views:
- GIT: the branch with ↑↓ against its upstream, or "no upstream"; the
  forge slug; changes with their paths in the inspector; linked
  worktrees; the last 5 commits. Before the first probe it reads
  "reading git status…". It says "not a git repository" only when the
  probe found none, and "git unavailable: <err>" when git failed.
- FILES: the files this session edited, each with +/− and its change
  evidence in the inspector, then the files it read. It reads the
  settled activity `project()` already computes, stored on the surface
  state, so there is no second history scan.
- NOTES: one row per `/note` note. Enter runs `/note show n`. The
  notes file is read off the render path with the workspace context,
  through the note command's own resolver, and a `/note` change
  refreshes it at once. The empty hint is "/note add <text> to keep a
  note".

Tests: codewhale-tui focused (git_status workspace_context
work_surface git_probe note engine::tests tui::ui:: worktree history):
1786 passed, 0 failed, 4 ignored. cargo fmt --check, clippy (CI flags)
on codewhale-tui, the three budget scripts and module_graph --check
all pass. sync-changelog, the web derive scripts, check-versions,
contributor-credit and public-copy vitest (6 passed) all pass.

Refs #6565

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Hmbown
Hmbown force-pushed the fix/6565-dock-views branch from 51987eb to abca3fa Compare September 27, 2026 02:55
@Hmbown Hmbown closed this pull request by merging all changes into main in 0bfe04e Sep 28, 2026
@Hmbown
Hmbown deleted the fix/6565-dock-views branch September 28, 2026 08:40
pull Bot pushed a commit to soitun/CodeWhale that referenced this pull request Sep 28, 2026
# Conflicts:
#	CHANGELOG.md
#	crates/tui/CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants