Skip to content

Conversation

@ThomasK33
Copy link
Member

Implement click-to-rebase on commits-behind indicator. Automatically fetches, stashes, rebases onto trunk, and restores changes. Only works when agent is idle. Injects conflict messages into chat when needed.

Generated with cmux

Change-Id: Ic1ad7698b612f4cb0ae03aad34da17c4c0c41f02
Signed-off-by: Thomas Kosiewski [email protected]

🤖 Enhance rebase error handling with agent diagnostics

When git rebase operations fail (including assertion errors), the system now captures comprehensive diagnostic information and injects it into the agent's chat for resolution.

Key improvements:

  • Catch ALL errors including assertion failures
  • Track operation step at each stage
  • Gather git diagnostics (branch, status, rebase state, stash)
  • Inject detailed error message with:
    • Operation context (workspace, trunk, step)
    • Full error message and stack trace
    • Current git state
    • Actionable resolution steps
  • Agent can investigate and resolve issues using bash tool

This makes the rebase feature much more resilient - instead of silently failing or leaving the workspace in a bad state, the agent gets full context to diagnose and fix the problem.

Generated with cmux

Change-Id: I197ce7ebdb4cf7c9e35cd8899bf50c5bf4e401c2
Signed-off-by: Thomas Kosiewski [email protected]

🤖 Add refresh icon on hover for rebase indicator

Show refresh icon (🔄) when hovering over the commits-behind indicator to make it clearer that it's clickable. The ↓N changes to 🔄 on hover when the agent is idle.

Also fixed migration timing to run after config is loaded in loadServices().

Generated with cmux

Change-Id: I02b5325db4a2110ff1394c9d8117287a76e5eb75
Signed-off-by: Thomas Kosiewski [email protected]

🤖 Add comprehensive assertions and e2e tests for rebase

Defensive programming improvements:

  • Added type assertions for all function inputs (string checks)
  • Added output validation assertions for all return paths
  • Assert result.success matches expected value
  • Assert result.status matches expected state
  • Assert required fields are present (error, conflictFiles)

E2E test coverage (5 test scenarios):

  1. Show behind count when upstream has commits
  2. Successfully rebase with no conflicts
  3. Stash and restore uncommitted changes
  4. Detect and report conflicts with chat injection
  5. Fail gracefully when rebase already in progress

Each test validates:

  • Git state before and after operations
  • Correct ahead/behind counts
  • File content preservation
  • Conflict detection and reporting
  • Error message injection into chat
  • Proper cleanup of git state

This follows the defensive programming guidelines:

  • Assert all inputs (type, length, existence)
  • Assert all outputs (success, status, required fields)
  • Crash fast and loud on invalid state
  • Comprehensive test coverage for all paths

Generated with cmux

Fixes the gaps you identified - now we have assertions on EVERYTHING and comprehensive test coverage.

Change-Id: Ib5e9451fccb0d146f88176e2d7fe26cbe5c486ad
Signed-off-by: Thomas Kosiewski [email protected]

🤖 Add comprehensive e2e tests for visual rebase feature

Added Playwright e2e tests that actually open the app and test the visual UI:

Test Coverage (5 scenarios):

  1. Behind indicator visibility and click-to-rebase
  2. Refresh icon (🔄) appears on hover
  3. Stash/restore uncommitted changes during rebase
  4. Conflict detection with chat message injection
  5. Indicator not clickable while agent streaming

What these tests verify visually:

  • ↓N indicator appears when workspace is behind
  • Hover changes ↓N to 🔄 (refresh icon)
  • Cursor changes to pointer when clickable
  • Clicking performs actual git rebase
  • Uncommitted files preserved through rebase
  • Conflict messages appear in chat transcript
  • Indicator disabled during agent streaming

Run with:
bun x playwright test tests/e2e/scenarios/gitRebase.spec.ts
bun x playwright test tests/e2e/scenarios/gitRebase.spec.ts --headed

These are TRUE e2e tests - they test the full user experience, not just backend logic.

Generated with cmux

This is what you asked for - tests that verify the feature works visually, not just logically.

Change-Id: I028246b7c203cf6210f5d87051d080a74a4edf7f
Signed-off-by: Thomas Kosiewski [email protected]

🤖 Fix integration tests - add git remote setup and use setupWorkspaceWithoutProvider

Fixed failing integration tests:

  • Added setupGitRemote() helper to configure workspace with origin remote
  • Tests now use setupWorkspaceWithoutProvider() instead of setupWorkspace()
    (rebase tests don't need API calls)
  • Fixed message content extraction to check parts[0].text
  • Tests now properly set up git fetch/rebase environment

Status: 4/6 tests passing, 2 need minor fixes for conflict handling

Generated with cmux

Change-Id: I4356a4036a3dc59aa2602c4853d6192e53210ca8
Signed-off-by: Thomas Kosiewski [email protected]

fix: Replace emoji with SVG refresh icon

Change-Id: I61b476b862c714ead11d2e8132bf1b197ef0d032
Signed-off-by: Thomas Kosiewski [email protected]

🤖 Add pulsating animation when rebasing, keep icon visible

After clicking rebase, the refresh icon stays visible and pulsates to show progress. This prevents double-clicks and provides continuous feedback even when not hovering.

Changes:

  • Refresh icon stays visible during rebase (isRebasing state)
  • Pulsating animation (scale + opacity) runs during rebase
  • Cursor changes to 'wait' during rebase
  • StatusIndicators hidden when rebasing
  • Dirty indicator (*) always visible outside the swap area

Visual states:

  • Normal: ↑2 ↓5 *
  • Hover: 🔄 * (refresh icon)
  • Rebasing: 🔄 * (pulsating, cursor:wait)
  • After: ↑2 ↓0 * (or hidden if caught up)

Generated with cmux

Change-Id: If70a5d5d549b4db4754fc0beabd58b37dc0ca50a
Signed-off-by: Thomas Kosiewski [email protected]

🤖 Remove browser title tooltip to prevent multiple popups

The custom tooltip (showing git history) is sufficient. The browser's native title tooltip was creating a duplicate grey popup in the background.

Generated with cmux

Change-Id: Ib2d0b18a08e13d1b417d32f1f59d41323273fff2
Signed-off-by: Thomas Kosiewski [email protected]

🤖 Fix refresh icon persistence during rebase

The refresh icon now stays visible during the entire rebase operation, even when hovering away. Added !props.isRebasing condition to hover logic so rebasing state overrides hover state.

Generated with cmux

Change-Id: I3eb7d346b4c153a0494d34aff5b70d1dcdc34cd8
Signed-off-by: Thomas Kosiewski [email protected]

🤖 Use git rebase --autostash instead of manual stash/pop

Simplified rebase logic by using Git's built-in --autostash flag instead of manually stashing and popping. This is cleaner, handles edge cases better, and reduces code complexity.

Changes:

  • Removed manual stash push/pop logic
  • Added --autostash flag to git rebase command
  • Updated all documentation to reflect new approach
  • Marked stashed field as deprecated (always false now)
  • Removed ~30 lines of manual stash handling code

Benefits:

  • Git handles stash lifecycle automatically
  • No more 'stash pop failed' edge cases
  • Cleaner, simpler implementation
  • Follows Git best practices

Generated with cmux

Change-Id: Idde06d4a68c0a2f0d27133e3a3d16d8051fdd239
Signed-off-by: Thomas Kosiewski [email protected]

WORKSPACE_GET_INFO: "workspace:getInfo",
WORKSPACE_EXECUTE_BASH: "workspace:executeBash",
WORKSPACE_OPEN_TERMINAL: "workspace:openTerminal",
WORKSPACE_REBASE: "workspace:rebase",
Copy link
Member

Choose a reason for hiding this comment

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

curious about why IPC this vs. using executeBash to trigger the rebase? I used executeBash for the other git operations in an effort to keep the IPC tiny. Also tiny IPC will make it easier to go SaaS / implement remote workspaces.

Implement click-to-rebase on commits-behind indicator. Automatically fetches, stashes, rebases onto trunk, and restores changes. Only works when agent is idle. Injects conflict messages into chat when needed.

_Generated with cmux_

Change-Id: Ic1ad7698b612f4cb0ae03aad34da17c4c0c41f02
Signed-off-by: Thomas Kosiewski <[email protected]>

🤖 Enhance rebase error handling with agent diagnostics

When git rebase operations fail (including assertion errors), the system now captures comprehensive diagnostic information and injects it into the agent's chat for resolution.

Key improvements:
- Catch ALL errors including assertion failures
- Track operation step at each stage
- Gather git diagnostics (branch, status, rebase state, stash)
- Inject detailed error message with:
  * Operation context (workspace, trunk, step)
  * Full error message and stack trace
  * Current git state
  * Actionable resolution steps
- Agent can investigate and resolve issues using bash tool

This makes the rebase feature much more resilient - instead of silently failing or leaving the workspace in a bad state, the agent gets full context to diagnose and fix the problem.

_Generated with cmux_

Change-Id: I197ce7ebdb4cf7c9e35cd8899bf50c5bf4e401c2
Signed-off-by: Thomas Kosiewski <[email protected]>

🤖 Add refresh icon on hover for rebase indicator

Show refresh icon (🔄) when hovering over the commits-behind indicator to make it clearer that it's clickable. The ↓N changes to 🔄 on hover when the agent is idle.

Also fixed migration timing to run after config is loaded in loadServices().

_Generated with cmux_

Change-Id: I02b5325db4a2110ff1394c9d8117287a76e5eb75
Signed-off-by: Thomas Kosiewski <[email protected]>

🤖 Add comprehensive assertions and e2e tests for rebase

Defensive programming improvements:
- Added type assertions for all function inputs (string checks)
- Added output validation assertions for all return paths
- Assert result.success matches expected value
- Assert result.status matches expected state
- Assert required fields are present (error, conflictFiles)

E2E test coverage (5 test scenarios):
1. Show behind count when upstream has commits
2. Successfully rebase with no conflicts
3. Stash and restore uncommitted changes
4. Detect and report conflicts with chat injection
5. Fail gracefully when rebase already in progress

Each test validates:
- Git state before and after operations
- Correct ahead/behind counts
- File content preservation
- Conflict detection and reporting
- Error message injection into chat
- Proper cleanup of git state

This follows the defensive programming guidelines:
- Assert all inputs (type, length, existence)
- Assert all outputs (success, status, required fields)
- Crash fast and loud on invalid state
- Comprehensive test coverage for all paths

_Generated with cmux_

Fixes the gaps you identified - now we have assertions on EVERYTHING and comprehensive test coverage.

Change-Id: Ib5e9451fccb0d146f88176e2d7fe26cbe5c486ad
Signed-off-by: Thomas Kosiewski <[email protected]>

🤖 Add comprehensive e2e tests for visual rebase feature

Added Playwright e2e tests that actually open the app and test the visual UI:

Test Coverage (5 scenarios):
1. Behind indicator visibility and click-to-rebase
2. Refresh icon (🔄) appears on hover
3. Stash/restore uncommitted changes during rebase
4. Conflict detection with chat message injection
5. Indicator not clickable while agent streaming

What these tests verify visually:
- ↓N indicator appears when workspace is behind
- Hover changes ↓N to 🔄 (refresh icon)
- Cursor changes to pointer when clickable
- Clicking performs actual git rebase
- Uncommitted files preserved through rebase
- Conflict messages appear in chat transcript
- Indicator disabled during agent streaming

Run with:
  bun x playwright test tests/e2e/scenarios/gitRebase.spec.ts
  bun x playwright test tests/e2e/scenarios/gitRebase.spec.ts --headed

These are TRUE e2e tests - they test the full user experience, not just backend logic.

_Generated with cmux_

This is what you asked for - tests that verify the feature works visually, not just logically.

Change-Id: I028246b7c203cf6210f5d87051d080a74a4edf7f
Signed-off-by: Thomas Kosiewski <[email protected]>

🤖 Fix integration tests - add git remote setup and use setupWorkspaceWithoutProvider

Fixed failing integration tests:
- Added setupGitRemote() helper to configure workspace with origin remote
- Tests now use setupWorkspaceWithoutProvider() instead of setupWorkspace()
  (rebase tests don't need API calls)
- Fixed message content extraction to check parts[0].text
- Tests now properly set up git fetch/rebase environment

Status: 4/6 tests passing, 2 need minor fixes for conflict handling

_Generated with cmux_

Change-Id: I4356a4036a3dc59aa2602c4853d6192e53210ca8
Signed-off-by: Thomas Kosiewski <[email protected]>

fix: Replace emoji with SVG refresh icon

Change-Id: I61b476b862c714ead11d2e8132bf1b197ef0d032
Signed-off-by: Thomas Kosiewski <[email protected]>

🤖 Add pulsating animation when rebasing, keep icon visible

After clicking rebase, the refresh icon stays visible and pulsates to show progress. This prevents double-clicks and provides continuous feedback even when not hovering.

Changes:
- Refresh icon stays visible during rebase (isRebasing state)
- Pulsating animation (scale + opacity) runs during rebase
- Cursor changes to 'wait' during rebase
- StatusIndicators hidden when rebasing
- Dirty indicator (*) always visible outside the swap area

Visual states:
- Normal: ↑2 ↓5 *
- Hover: 🔄 * (refresh icon)
- Rebasing: 🔄 * (pulsating, cursor:wait)
- After: ↑2 ↓0 * (or hidden if caught up)

_Generated with cmux_

Change-Id: If70a5d5d549b4db4754fc0beabd58b37dc0ca50a
Signed-off-by: Thomas Kosiewski <[email protected]>

🤖 Remove browser title tooltip to prevent multiple popups

The custom tooltip (showing git history) is sufficient. The browser's native title tooltip was creating a duplicate grey popup in the background.

_Generated with cmux_

Change-Id: Ib2d0b18a08e13d1b417d32f1f59d41323273fff2
Signed-off-by: Thomas Kosiewski <[email protected]>

🤖 Fix refresh icon persistence during rebase

The refresh icon now stays visible during the entire rebase operation, even when hovering away. Added !props.isRebasing condition to hover logic so rebasing state overrides hover state.

_Generated with cmux_

Change-Id: I3eb7d346b4c153a0494d34aff5b70d1dcdc34cd8
Signed-off-by: Thomas Kosiewski <[email protected]>

🤖 Use git rebase --autostash instead of manual stash/pop

Simplified rebase logic by using Git's built-in --autostash flag instead of manually stashing and popping. This is cleaner, handles edge cases better, and reduces code complexity.

Changes:
- Removed manual stash push/pop logic
- Added --autostash flag to git rebase command
- Updated all documentation to reflect new approach
- Marked stashed field as deprecated (always false now)
- Removed ~30 lines of manual stash handling code

Benefits:
- Git handles stash lifecycle automatically
- No more 'stash pop failed' edge cases
- Cleaner, simpler implementation
- Follows Git best practices

_Generated with cmux_

Change-Id: Idde06d4a68c0a2f0d27133e3a3d16d8051fdd239
Signed-off-by: Thomas Kosiewski <[email protected]>
Change-Id: I0ed1e02bbf9e2400a7bd15e7a2954d21351719cf
Signed-off-by: Thomas Kosiewski <[email protected]>
- Fixed main.ts split into main-desktop.ts and main-server.ts
- Added migration call for workspace trunk branches
- Fixed all assert import statements (changed from default to named export)
- Added getWorkspacePath method to Config
- Fixed WorkspaceCreationResult property names (path -> workspacePath)
- Added getIndicatorColor helper function
- Fixed JSX closing tags in GitStatusIndicatorView

Known issues:
- GitStatusIndicatorView.tsx uses styled-components syntax without proper types
- Some mock APIs missing rebase method
- These are from the auto-rebase branch WIP state and need cleanup

Change-Id: Icb3f2b5867fdc14da45a5c8ae407fe5bbf2eb0fb
Signed-off-by: Thomas Kosiewski <[email protected]>
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