Skip to content

feat(source-control): commit, push, pull, and sync actions in panel - #1211

Merged
brennanb2025 merged 27 commits into
stablyai:mainfrom
mralexsaavedra:feat/source-control-commit-push-graph
May 6, 2026
Merged

brennanb2025 merged 27 commits into
stablyai:mainfrom
mralexsaavedra:feat/source-control-commit-push-graph

Conversation

@mralexsaavedra

@mralexsaavedra mralexsaavedra commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1170

Summary

  • Adds a Commit area to the Source Control panel with message input and Commit / Commit & Push buttons
  • Adds Push / Pull / Sync action buttons in the panel header with ahead/behind counts
  • Surfaces remote action failures as clean, actionable toast messages (no raw IPC text)

Changes

File Change
src/renderer/src/components/right-sidebar/SourceControl.tsx Commit area UI + remote action buttons (push/pull/sync/publish)
src/renderer/src/store/slices/editor.ts Push/pull/sync/publish branch actions + error toast normalization
src/main/git/remote.ts Git push/pull/sync IPC handlers
src/main/git/status.ts Ahead/behind count tracking
src/relay/git-handler.ts + split ops files Relay-side git operations
src/preload/api-types.d.ts + index.ts IPC bridge for new git actions
src/shared/types.ts Shared types for remote operations
*.test.ts / *.test.tsx Full unit coverage for all new paths

Test Plan

  • Unit tests pass (pnpm test)
  • Commit flow tested manually in Electron (staged files → commit message → commit)
  • Push / Pull / Sync tested against disposable local git remotes
  • Publish Branch failure, non-fast-forward push, and generic push errors all show clean toasts
  • Conflict-state Pull/Sync blocking verified

Made with Orca 🐋

@mralexsaavedra
mralexsaavedra force-pushed the feat/source-control-commit-push-graph branch 2 times, most recently from 1def37c to 2afcf2f Compare April 28, 2026 08:57
@mralexsaavedra

mralexsaavedra commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Screenshot

commit-push

@AmethystLiang

Copy link
Copy Markdown
Contributor

@brennanb2025 can you review this? It's a cool feature :-D

@mralexsaavedra
mralexsaavedra force-pushed the feat/source-control-commit-push-graph branch 2 times, most recently from 225cc9a to c0d82ea Compare May 2, 2026 08:37
@brennanb2025
brennanb2025 force-pushed the feat/source-control-commit-push-graph branch from c0d82ea to 8113d66 Compare May 3, 2026 19:43
nwparker and others added 9 commits May 3, 2026 17:14
…ai#1380)

Deleting an unselected, scrolled-past worktree snapped the sidebar back
toward the selected item. The virtualizer's viewport key includes row
count so it can remount cleanly when rows change (avoiding stale height
measurements that caused card overlap) — but the fresh mount started at
scrollTop 0.

Persist the scroll offset in a parent-owned ref, seed the new
virtualizer via initialOffset, and re-apply scrollTop in a
useLayoutEffect with a retry loop that tolerates the transient window
where the browser clamps scrollTop while the virtualizer is still
measuring rows.

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Alexander Saavedra <mralexsaavedra@gmail.com>
)

- Reduce titlebar-left height 42→36px (4px drag strip + 32px tab row)
- Replace border-bottom with inset box-shadow so flex content spans full
  36px; controls now center at y=18 matching native traffic lights
- Adjust TITLEBAR_CSS_CENTER 20→18 and traffic-light y offset
- Soften sidebar nav (Tasks/Search) idle contrast; add explicit colors
  for .sidebar-toggle-compact enabled/disabled states
- Tighten WorktreeCard gap 2.5→1.5

Co-authored-by: Orca <help@stably.ai>
Surface publish, push, pull, and sync controls in Source Control so branches can stay aligned with their upstream without leaving Orca.

Co-authored-by: Orca <help@stably.ai>
Keep remote git errors on the editor store toast path so publish and push failures show actionable feedback without crashing the sidebar.

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Raw IPC wrapper text was leaking into the push failure toast.
Extends resolveRemoteOperationErrorMessage with isPush flag to
map 'non-fast-forward' / 'Updates were rejected' to a clean
actionable message; other push errors get a generic fallback.

Co-authored-by: Orca <help@stably.ai>
- Non-fast-forward detection runs before publish/isPush split so
  both flows show the same actionable rejection message
- Generic push fallback uses extractPublishFailureDetail to surface
  fatal/remote git lines instead of hiding them
- Publish null-detail fallback returns friendly message instead of
  leaking raw error.message
- Tests added for publish+rejected, publish+generic, publish+fallback

Co-authored-by: Orca <help@stably.ai>
@brennanb2025
brennanb2025 force-pushed the feat/source-control-commit-push-graph branch from 8113d66 to d43de3b Compare May 4, 2026 00:49
brennanb2025 and others added 4 commits May 3, 2026 21:01
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
@brennanb2025
brennanb2025 force-pushed the feat/source-control-commit-push-graph branch from d43de3b to 8a32551 Compare May 4, 2026 07:02
brennanb2025 and others added 5 commits May 4, 2026 00:24
# Conflicts:
#	src/preload/api-types.ts
#	src/relay/git-handler.test.ts
#	src/relay/git-handler.ts
#	src/renderer/src/components/right-sidebar/CommitArea.test.tsx
#	src/renderer/src/components/right-sidebar/SourceControl.tsx
Fetching from the split-button dropdown flipped isRemoteOperationActive
true, which painted a spinner on the primary button. When the primary
was "Commit" (or any commit-family label), users read the spinner as
"my commit is running" even though only a background fetch was in
flight. Gate the spinner by action kind: commit-family primaries track
isCommitting only; pure remote primaries track isRemoteOperationActive.

Co-authored-by: Orca <help@stably.ai>
…ases

The previous attempt scoped the spinner too tightly — Commit & Push
would stop spinning the moment the commit phase ended, so the push
phase ran silently. Compound commit_* kinds now spin on either
isCommitting or isRemoteOperationActive so the spinner stays lit
through the full commit→remote handoff. Plain Commit and pure remote
primaries keep their single-flag scoping.

Co-authored-by: Orca <help@stably.ai>
… remote action

Drop the compound "Commit & Push" / "Commit & Sync" / "Commit & Publish"
labels from the primary button. Whenever there are staged files with a
message, the primary reads just "Commit". After the commit lands, the
primary naturally rotates to the appropriate single remote action
(Push / Sync / Publish Branch / Pull) based on the new upstream state.
Compound flows remain available as dropdown items for users who want
the one-click path.

This also simplifies the spinner logic — the primary is always either
'commit' (spin on isCommitting) or a pure remote kind (spin on
isRemoteOperationActive), with no compound OR-branch to reason about.

Co-authored-by: Orca <help@stably.ai>
… arms

After the PR 1211 primary-button collapse, the primary can only emit
'commit' | 'push' | 'pull' | 'sync' | 'publish' — compound commit_*
kinds live in DropdownActionKind only. The union still listed them,
which left three dead case arms in handlePrimaryClick (one of them
calling runCompoundCommitAction('publish')) and forced the
isRemoteOperationActive tooltip to check kind.startsWith('commit')
against a non-existent compound case.

Narrow the union to the kinds the primary actually emits. TypeScript's
exhaustiveness check lit up the dead arms; dropping them also means
runCompoundCommitAction no longer takes a 'publish' parameter it never
receives.

Co-authored-by: Orca <help@stably.ai>
brennanb2025 and others added 3 commits May 4, 2026 14:39
- git-remote-error: broaden credential-URL redaction to cover ssh://, git://,
  git+ssh:// schemes (not just http(s)); prevents credential leakage on SSH
  remotes through error toasts
- editor slice: drop duplicated stripGitCredentials in favor of shared
  stripCredentialsFromMessage, eliminating security-regex drift hazard
- main/git/upstream + relay/git-handler: normalize error rethrow in
  upstreamStatus catch to match gitPush/gitPull/gitFetch; stops leaking
  raw execFile preamble and local paths to the renderer
- source-control-dropdown-items: correct tooltip copy for commit_push /
  commit_sync on unpublished branches — the old 'Use Commit & Publish'
  text referenced an action that does not exist; now mirrors the
  push/sync row wording ('Publish the branch first to push/sync commits')
- source-control-primary-action: when a remote op is running AND there
  are unresolved conflicts, surface 'Resolve conflicts before committing'
  instead of the generic 'Remote operation in progress…' so the tooltip
  points at the thing the user can actually act on
- SourceControl: replace dead 'catch (error) { void error }' in
  runRemoteAction with a bare 'catch {}' matching the repo convention

Co-authored-by: Orca <help@stably.ai>
- Scheme-aware credential scrubbing: preserve required SSH user-info
  (e.g. ssh://git@host) while still redacting user:pass@ on any scheme
  and lone user@ on http(s) (token PATs).
- normalizeGitErrorMessage now takes an operation arg so the
  'Push rejected / pull first' copy only fires for push; pull, fetch,
  and upstream fall through to a generic tail-line message.
- Scrub credentials once at the top of normalizeGitErrorMessage so
  every branch operates on sanitized text (future-proofing).
- isNoUpstreamError requires a fatal: prefix in addition to the
  no-upstream phrases, so corrupt-repo / unborn-HEAD / ambiguous-ref
  errors stop being silently reported as 'no upstream'.
- getUpstreamStatus and relay upstreamStatus now throw on
  malformed rev-list output instead of silently reporting ahead:0,
  behind:0 (which was indistinguishable from a real in-sync state).
- git:push IPC handler coerces args.publish === true at the boundary,
  matching the relay, so non-boolean payloads can't silently enable
  --set-upstream mode.

Co-authored-by: Orca <help@stably.ai>
Three small bug fixes surfaced during end-to-end Electron testing of the
new commit/push/pull/sync panel:

- isNoUpstreamError now treats a missing HEAD@{u} tracking ref as
  no-upstream. Previously every git status poll on a branch with stale
  upstream config produced an unactionable 'git <command> [<revision>...]
  -- [<file>...]' error in main + renderer logs every 3s.
- Primary action tooltip distinguishes 'unstaged changes exist, stage
  something first' from 'truly clean and in sync'. Previously the
  tooltip claimed 'Branch is up to date' while the panel listed
  uncommitted changes.
- Fetch dropdown row no longer requires hasUpstream. git fetch --prune
  works on any repo with an origin remote regardless of whether the
  current branch is published, matching the underlying gitFetch
  behavior.

Co-authored-by: Orca <help@stably.ai>
@brennanb2025

brennanb2025 commented May 5, 2026 •

Copy link
Copy Markdown
Contributor

Manual end-to-end verification

Tested the source-control flow against a real demo-project worktree:

  • Commit & Push — verified the commit lands locally, the push lands on the remote, and the primary button rotates back to "Commit".
  • Sync — with the branch both ahead and behind, verified pull-then-push leaves the worktree at 0/0 and the remote receives both the merge commit and the local commit.
  • Pull — with the branch behind by 1, verified Pull enables, consumes the remote commit cleanly, and the primary returns to "Commit".
  • Post-commit UI — the "Committed on Branch" section doesn't flicker during the commit → push window.

1784/1784 tests pass; tc:web + tc:node clean.

@brennanb2025

Copy link
Copy Markdown
Contributor

Thanks @mralexsaavedra for this PR! I separated out the commit message part of this PR to make it easier for me to review, but the remote-action ladder (publish/sync/pull/push based on upstream state), the refcounted in-flight tracking, the toast normalization for non-fast-forward and publish failures, and the upstream ahead/behind plumbing, are going to be shipped largely unchanged.

The only meaningful pivot was the UI shape: header button → split-button next to the commit textarea, with a dropdown to expose compound Commit & Push / Commit & Sync and explicit Fetch. Same state machine logic, just collapsed into one control next to where the user is already typing.

Really appreciate the PR! Going to land it very soon!

Three bugs surfaced when manually testing Sync against a worktree branch
whose upstream tracks a base ref (origin/main) — Orca's standard
`git worktree add --track -b <name> <dir> <baseRef>` setup:

- Bare `git push` was rejected by `push.default=simple` because the
  local branch name didn't match its upstream branch name. The fatal
  message ("upstream branch... does not match the name of your current
  branch") got stripped to a tail line that didn't begin with `fatal:`,
  so extractPublishFailureDetail returned null and the toast fell
  through to a generic "Push failed. Check your connection..." with no
  real diagnostic. Pushing via the explicit `origin HEAD` refspec works
  regardless of push.default and bypasses the mismatch check, so the
  branch publishes to a same-named remote ref. Mirrored in both the
  local handler and the SSH relay.

- The primary split button kept its stale "Push" label with a spinner
  whenever any remote op was running, so picking Sync from the dropdown
  visually claimed Push was in flight. Added inFlightRemoteOpKind to
  the editor slice (recorded by beginRemoteOperation, cleared when
  depth hits 0) and threaded it through resolvePrimaryAction so a
  primary-eligible in-flight kind takes over the label, while Fetch
  (dropdown-only) leaves the natural label intact and CommitArea's
  kind-mismatch check suppresses the spinner.

- The failure toast read "Push failed" even for sync since sync's inner
  push catch reused the push-shaped formatter. resolveRemoteOperation
  ErrorMessage now accepts an isSync flag so sync surfaces "Sync
  failed..." (and "Sync failed — remote moved while syncing. Try
  again." for non-fast-forward, since sync just pulled).

Co-authored-by: Orca <help@stably.ai>
brennanb2025 and others added 5 commits May 6, 2026 14:18
Worktrees Orca creates with `git worktree add --track -b <name> <dir>
<baseRef>` track the BASE ref (e.g. origin/main) on creation. Without
--set-upstream, the local branch keeps that tracking after the first
push, so ahead/behind via @{u} measures "ahead of base" rather than
"ahead of remote branch" — and the primary button never rotates from
"Push" to "Commit" after a successful push.

The `publish` flag is now redundant under this strategy. Kept in the
signature for IPC compatibility but no longer load-bearing. On an
already-published branch --set-upstream is a no-op for the tracking
config and a regular push otherwise.

Branch-vs-base reporting (the "Committed on Branch" section) is
unaffected because it uses branchCompare against an explicit baseRef
from worktree config, not the upstream relationship.

Existing worktrees that were tracking the base will self-heal on their
next push.

Co-authored-by: Orca <help@stably.ai>
…utations

pushBranch / pullBranch / syncBranch / fetchBranch each used to await a
post-op git status + fetchUpstreamStatus chain inside the mutation.
That stretched the latency between the IPC's success and the next step
in compound flows (runCompoundCommitAction → runRemoteAction), and
overlapped redundantly with the existing 3s git-status poll and 5s
branchCompare poll.

Now each mutation does only its core git operation, sets/clears
isRemoteOperationActive, and exits. A fire-and-forget
fetchUpstreamStatus runs after the busy flag clears so the primary
button label rotates from "Push" to "Commit" within the upstream IPC's
own round-trip without blocking the mutation's promise.

Drops three obsolete tests that asserted error swallowing of the now-
removed post-op refresh chain. Updates two end-to-end success-path
tests to drop assertions about the post-op IPC mocks being called.

Co-authored-by: Orca <help@stably.ai>
…cons

Three related Source Control polish items:

1. Close the "No changes on this branch" flash after Commit. The
   empty-state guard reads
     !hasUncommittedEntries && branchSummary.status === 'ready' &&
     branchEntries.length === 0
   and used to hold true between setGitStatus clearing the uncommitted
   list and the next 5s branchCompare poll landing the new commit. Flip
   branchSummary to 'loading' synchronously and fire-and-forget
   refreshBranchCompare so the "Committed on Branch" section
   repopulates as soon as the IPC returns.

2. Spin the chevron whenever a commit or remote op is in flight that
   the primary button isn't already spinning for. Fixes silent feedback
   on dropdown-only actions (Fetch is the canonical case): spinner
   confirms the click did something even when no toast fires and
   counts don't change.

3. Anchor each primary-action label with a directional icon — Commit
   (check), Push (up arrow), Pull (down arrow), Sync (down/up arrow),
   Publish (cloud-up). The split button slot rotates labels frequently;
   the icon makes the verb's direction read at a glance. Decorative —
   labels and title attributes still carry meaning for assistive tech.

Drops the now-unused setGitStatus store accessor from the component;
slice mutations no longer need a manual post-op refresh trigger from
the UI layer.

Splits the chevron-spinner and primary-icon tests into sibling files
to keep CommitArea.test.tsx under the project's max-lines budget.

Co-authored-by: Orca <help@stably.ai>
PR stablyai#1448 added an `&& hasUncommittedEntries` render gate on CommitArea,
which made sense in the older Commit-only design — when nothing was
staged, the lone "Commit" button was unactionable and hiding it cleaned
up the empty state.

But this branch's CommitArea is a split button that rotates the primary
through Push / Pull / Sync / Publish on a clean tree, disabling Commit
with a "Nothing to commit. Branch is up to date." tooltip when nothing
is staged. The gate landed via main during the rebase and unmounts the
whole action surface on clean worktrees, plus tears it down mid-commit
when the staged list clears post-success.

Drop the gate. The primary's own state machine (resolvePrimaryAction)
already handles the "nothing to commit" case correctly.

Co-authored-by: Orca <help@stably.ai>
@brennanb2025
brennanb2025 merged commit 9f8bf81 into stablyai:main May 6, 2026
2 checks passed
@mralexsaavedra
mralexsaavedra deleted the feat/source-control-commit-push-graph branch May 7, 2026 06:40
@mralexsaavedra

Copy link
Copy Markdown
Contributor Author

Hey @brennanb2025, it was a pleasure collaborating with you on the source control workflow! Really happy with how the commit/push flow turned out in v1.3.37. Great teamwork! 🚀

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#1211)

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Alexander Saavedra <mralexsaavedra@gmail.com>
Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: brennanb2025 <brennankbenson@gmail.com>
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.

[Feature]: Source Control panel — commit, push/pull, and sync

4 participants