Remember commit selection, close stale diff tabs, and add ide browse#57
Conversation
Entering the commit view still selects every changed file, but leaving and coming back no longer wipes a manual selection. Re-entry only re-selects all when the remembered selection was empty or already the full set; a partial selection (say 14 of 15 after unchecking one) is preserved as-is. The all-or- none test is derived from the current set, so uncheck-then-recheck counts as 'all' again. After a successful commit, every open working-tree diff tab now closes. They all reflect the pre-commit tree, so they go stale the instant the commit lands and would otherwise linger showing 'N unchanged lines' with no content.
ide browse <path> opens a repo's web UI in the default browser instead of a
native window. If nothing is running yet it cold-starts the app headless (HTTP
server up, main window kept hidden) and gives the repo its own hidden session;
if an instance is already running it reuses it. Several repos can be browsed at
once, each on its own /{hash}/ URL, and closing a visible window leaves the
background sessions serving until the app is quit.
The launcher gains a browse subcommand that url-encodes the path and hands it to
a new loopback GET /browse?path= route, which ensures a (hidden) session exists
and 302-redirects to the repo's scoped SPA — so bash never has to reproduce the
Rust workspace hash. Window creation from the HTTP handler bridges to the main
thread via run_on_main_thread. open_launch_target_window gains a visible flag so
browse sessions build hidden and never steal focus.
📝 WalkthroughWalkthroughAdds ChangesBackground repository browsing
Git commit state
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant HTTPServer
participant TauriApp
participant Workspace
CLI->>HTTPServer: Request encoded browse path
HTTPServer->>Workspace: Resolve workspace and hash
HTTPServer->>TauriApp: Create hidden session if absent
TauriApp->>Workspace: Register workspace window
HTTPServer-->>CLI: Redirect to workspace route
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Code Review
This pull request introduces an ide browse <path> command that allows users to open a repository in the default browser, running the app headless in the background if it is not already active. It also updates the frontend to remember partial file selections when re-entering commit mode and to close stale diff tabs after a successful commit. The review feedback highlights a critical security vulnerability in the new /browse endpoint, which lacks authentication and could allow arbitrary file reads via CSRF. Additionally, it identifies a React anti-pattern in src/App.tsx where a state setter is called inside another state updater, recommending the use of queueMicrotask to defer the nested update.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR enhances the commit workflow UX and adds a new “browse in browser” launch mode by reusing the existing HTTP+scoped-session architecture in the Tauri backend.
Changes:
- Preserve commit-file selection across leaving/re-entering commit mode; add tests for partial/empty remembered selection.
- Close all working-tree diff tabs after a successful commit (including pinned) and add a regression test.
- Add
ide browse <path>support: a/browse?path=loopback route that ensures a session exists (hidden window when needed) and redirects to the scoped/{hash}/SPA; update CLI installer, runner validation, and docs.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/App.tsx | Remembers commit selection on re-entry and closes diff tabs post-commit. |
| src/App.test.tsx | Adds tests for selection memory and diff-tab cleanup after commit. |
| src-tauri/src/lib.rs | Adds browse-launch detection and supports hidden (non-visible) workspace windows. |
| src-tauri/src/http_server.rs | Adds /browse route to create/ensure sessions and redirect into scoped SPA. |
| scripts/validate-launch-runners.mjs | Extends launcher validation for the new browse branch. |
| scripts/install-cli-command.sh | Generates ide browse launcher logic and URL encoding utilities. |
| docs/development.md | Documents ide browse behavior and lifecycle. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src-tauri/src/http_server.rs`:
- Around line 331-339: Protect the /browse handler by requiring a
launcher-issued, unguessable short-lived capability and reject missing or
invalid capabilities before invoking browse. Pass the capability through the
existing BrowseQuery or request state, validate it at the route boundary, and
ensure only ide browse can issue valid capabilities while preserving normal
behavior for authorized requests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8fc7bcc4-ddbc-4be3-b030-09208169c463
📒 Files selected for processing (7)
docs/development.mdscripts/install-cli-command.shscripts/validate-launch-runners.mjssrc-tauri/src/http_server.rssrc-tauri/src/lib.rssrc/App.test.tsxsrc/App.tsx
Address reviewer comments: - Defer setActivePath out of the setOpenFiles updater (queueMicrotask) so the post-commit diff-tab cleanup stays pure (gemini) - Force byte-wise url_encode iteration (LC_ALL=C) and mask the signed-byte printf conversion (& 0xFF) so ide browse percent-encodes non-ASCII paths correctly under bash 3.2 (copilot)
|
@coderabbitai review |
✅ Action performedReview finished.
|
Address reviewer comments: - Move both setOpenFiles/setActivePath calls out of the updater entirely (reading the pre-commit list from openFilesRef instead) so no state setter runs inside another's updater, even deferred (copilot) - Skip a leading 'browse' argv token in resolve_explicit_launch_target before scanning for the target path, so a ./browse directory in cwd can't be mistaken for it (copilot)
|
@coderabbitai review |
✅ Action performedReview finished.
|
Address reviewer comments: - Reject a non-absolute path in the /browse handler before resolving it, matching the documented <abs> contract (copilot)
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a786f2ad8f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (pruned.size === 0 || pruned.size === validPaths.size) return validPaths; | ||
| return pruned; |
There was a problem hiding this comment.
Preserve select-all when new changed files appear
When commit mode is left with all current files selected and another changed file appears before the next status refresh/re-entry, pruned contains the old full set but pruned.size !== validPaths.size, so this returns pruned and silently leaves the new file unchecked. That regresses the default “all changes selected” behavior for users who never opted into a partial selection, and the next commit can omit newly changed files unless they notice the count.
Useful? React with 👍 / 👎.
Summary
Three changes to the commit flow and how a repo can be opened:
ide browse <path>opens a repo in the browser instead of a native window. If nothing is running yet it cold-starts the app headless — HTTP server up, main window kept hidden — and gives the repo its own hidden session; if an instance is already running it reuses it. Several repos can be browsed at once, each on its own/{hash}/URL, and closing a visible window leaves the background sessions serving until the app is quit. A new loopbackGET /browse?path=route ensures the session exists and redirects to the scoped SPA, so the launcher never has to reproduce the Rust workspace hash.Implementation notes
refreshGitStatus— prune the remembered set to still-valid paths, then collapse to all only when it's empty or full. No new state.setOpenFilesfilter, minus the pinned exception — a post-commit diff is stale whether or not it's pinned./{hash}/routing, and single-instance forwarding.open_launch_target_windowgains avisibleflag so browse sessions build hidden and never steal focus; window creation from the HTTP handler bridges to the main thread viarun_on_main_thread.Test plan
npm test(410) andcargo test(235) pass;cargo build,npm run build, andnpm run launch:checkare clean.ide browsestarts headless with no visible window; a second repo is browsable alongside the first;/browse?path=redirects to the scoped/{hash}/and the repo lists once.Summary by CodeRabbit
ide browse <path>to open a repository in the default browser, including headless cold-start when needed, URL-safe path handling, and reuse of an existing session to avoid focus theft. Background browse continues even if a visible IDE window is closed.ide browsebehavior under Local Run.