Skip to content

Commit exactly the staged changes from the Diff panel - #769

Merged
sak0a merged 1 commit into
mainfrom
fix/staged-only-commit
Oct 23, 2026
Merged

sak0a merged 1 commit into
mainfrom
fix/staged-only-commit

Conversation

@sak0a

@sak0a sak0a commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

What Changed

  • The Diff panel's Staged view has a new "Commit staged" button. It commits the index exactly as reviewed: hunks staged one by one stay as they are, and unstaged edits and untracked files stay in the working files.
  • git.runStackedAction accepts stagedOnly: { expectedRevision }. The schema refuses it together with filePaths. This path does not reset or re-add anything. It refuses an empty index and unmerged entries, and it runs commit hooks like the regular commit.
  • vcs.readLocalChanges also returns a stagedRevision. It covers the worktree, branch, HEAD and the staged modes and object IDs. It leaves out the unstaged patch, so agent edits to working files do not invalidate it.
  • The server checks stagedRevision before it reads the commit-message context, and checks HEAD, branch and staged content again right before git commit. A git add, commit or branch switch made after the review fails with the new GitStagedIndexChangedError, including one made while the message is being generated.
  • Feature-branch commits, push and PR actions take the same path on the server. Only the Diff panel uses it for now, with action commit.
  • Nodes advertise stagedOnlyCommit. The button only appears when the node has that flag, because older nodes drop stagedOnly and would commit every change.
  • The client-runtime local-changes controller owns the write: one write at a time, bound to the displayed snapshot, with a fresh review required after a failure. The web reports progress on the crown or in a toast, like the other commit actions.
  • The Staged review and the commit-message context now list staged submodule pointers even when the user's config ignores submodules, because the commit records them.
  • docs/source-control-comparison.md no longer tells users to commit outside Ryco. It has a new "Staged-only commit" section.

Why

Commit and Ship ran git reset plus git add -A -- paths, or git add -A, before committing. That threw away hunks a user had staged one by one in the Staged review. The panel said "Staging does not commit", and the docs told users to commit outside Ryco to keep their staging.

Neither reference ships this. T3 Code's staged-only commit is an open PR (pingdotgg/t3code#22298, with pingdotgg/t3code#19703 and pingdotgg/t3code#19941). T3 Code main and Synara both re-stage before they commit. Ryco also binds the commit to the reviewed index, so later staging cannot slip in.

Testing

  • bun run --cwd packages/contracts test -- src/git.test.ts src/environment.test.ts: 23 passed
  • cd apps/server && RYCO_TEST_MAX_WORKERS=4 bun run test -- src/vcs/GitIndexReview.test.ts: 19 passed. The new submodule-pointer test fails without the fix.
  • cd apps/server && RYCO_TEST_MAX_WORKERS=4 bun run test -- src/git/GitManager.test.ts -t staged-only: 9 passed. The new submodule message-context test fails without the fix.
  • cd apps/server && RYCO_TEST_MAX_WORKERS=4 bun run test -- src/git/GitManager.test.ts src/vcs/GitIndexReview.test.ts src/vcs/GitVcsDriverCore.test.ts src/environment/Layers/ServerEnvironment.test.ts src/agentControl/Mcp/hostedBoundaries.test.ts: 192 passed (before the review fixes)
  • bun run --cwd packages/client-runtime test -- src/state/comparison/localChanges.test.ts: 5 passed
  • bun run --cwd apps/web test:browser -- src/components/DiffPanel.staging.browser.tsx: 3 passed (after the rebase)
  • bun run --cwd apps/web test:browser -- src/components/DiffPanel.browser.tsx src/components/DiffPanel.identity.browser.tsx src/components/DiffLineBlame.browser.tsx: 17 passed, 1 failed. The failure is the "keeps unchanged renderers mounted..." identity test, which is flaky under load and also fails on unmodified main.
  • bun run check: format ok, 0 lint errors, typecheck:fast 12/12 ok (after the rebase)
  • bun run check:changed: exit 0. Format/lint, typecheck (TS7 + Effect), related tests (10/10) and every read-from-disk phase ok (after the rebase)

Follow-ups

  • A per-commit review or commit picker in the Diff panel. This needs a new endpoint or contract field, because readComparison only compares one ref against HEAD.
  • "Commit staged" in the git controls' commit menu and Crown Ship. The server already supports commit_push and commit_push_pr with stagedOnly.
  • The same action on mobile through createLocalChangesController.commitStaged, once mobile has a staged review screen.
  • Line-level staging. Only file and hunk staging exist today.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL labels Oct 22, 2026
@sak0a
sak0a changed the base branch from main to port/answered-questions-in-transcript October 23, 2026 16:19
@sak0a
sak0a force-pushed the port/answered-questions-in-transcript branch from 4436bd4 to 76d67b4 Compare October 23, 2026 16:20
@sak0a
sak0a force-pushed the fix/staged-only-commit branch from 496847e to 3159436 Compare October 23, 2026 16:20
sak0a added a commit that referenced this pull request Oct 23, 2026
Rebased for the merge train as one commit on top of #769: this PR's commits, including its review fix where it had one, with conflicts resolved against the PRs merged before it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sak0a
sak0a force-pushed the port/answered-questions-in-transcript branch from 76d67b4 to 749ed29 Compare October 23, 2026 16:58
Rebased for the merge train as one commit on top of #772: this PR's commits, including its review fix where it had one, with conflicts resolved against the PRs merged before it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sak0a
sak0a force-pushed the fix/staged-only-commit branch from 3159436 to 8b8c86d Compare October 23, 2026 16:58
@sak0a
sak0a changed the base branch from port/answered-questions-in-transcript to main October 23, 2026 16:59
@sak0a
sak0a merged commit 4c76bcc into main Oct 23, 2026
3 checks passed
sak0a added a commit that referenced this pull request Oct 23, 2026
Rebased for the merge train as one commit on top of #769: this PR's commits, including its review fix where it had one, with conflicts resolved against the PRs merged before it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
sak0a added a commit that referenced this pull request Oct 23, 2026
Rebased for the merge train as one commit on top of #769: this PR's commits, including its review fix where it had one, with conflicts resolved against the PRs merged before it.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added size:XXL and removed size:XL labels Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant