Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Problem

When SSH workspace deletion is blocked due to unpushed commits, users only see:

Workspace contains unpushed commits. Use force flag to delete anyway.

This lacks critical context about what commits would be lost, making it hard to decide whether to force delete.

Solution

Enhanced the unpushed commits error to include the actual commit list (up to 10 commits) in standard git log format.

Implementation approach:

  • Capture git log --branches --not --remotes --oneline output to stderr in the deletion check
  • Include stderr directly in error message (no parsing - simpler and more robust)
  • Update ForceDeleteModal warning text to be more specific when unpushed commits detected
  • Add test verifying commit details appear in error

UX Impact

Before:

Git Error
Workspace contains unpushed commits. Use force flag to delete anyway.

After:

Git Error  
Workspace contains unpushed commits:

a1b2c3d Fix critical bug in validation
d4e5f6g Add user authentication
h7i8j9k Update documentation

⚠️ This action cannot be undone
Force deleting will permanently remove the workspace and discard
the unpushed commits shown above. This action cannot be undone.

Users can now see exactly which commits they're about to lose, making informed decisions about force deletion.

Testing

  • ✅ New test verifies commit list appears in error message
  • ✅ All 15 deletion tests pass (7 local + 5 SSH + 3 SSH-only)
  • ✅ Typecheck passes
  • ✅ Formatting correct

Generated with cmux

- Add unpushed refs check to SSHRuntime.deleteWorkspace()
- Only checks when git remotes are configured (no remote = no concept of unpushed)
- Rejects deletion when unpushed commits exist unless force=true
- Optimize: combine all pre-deletion checks into single bash script
- Reduces SSH round trips from 5 to 2 (60% reduction)
- Add tests for unpushed refs protection (force=false and force=true cases)

Generated with `cmux`
- Extract SSH-specific unpushed refs tests into separate describe block
- Removes conditional type checks inside tests (cleaner test structure)
- Test output now clearly separates SSH-only tests from matrix tests
- Follows same pattern as local-only submodule tests
When SSH workspace deletion is blocked due to unpushed commits, now shows:
- List of unpushed commits (up to 10) in git log --oneline format
- Commit hashes and messages in the error modal
- More specific warning text when unpushed commits are detected

Implementation:
- Capture git log output to stderr in deletion check script
- Read stderr and include in error message (no parsing needed)
- Update ForceDeleteModal to detect and show better message
- Add test verifying commit details appear in error

Users can now see exactly what they're about to lose before force deleting.

Generated with `cmux`
@ammario ammario added this pull request to the merge queue Oct 29, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 29, 2025
@ammario ammario added this pull request to the merge queue Oct 29, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 29, 2025
@ammario ammario added this pull request to the merge queue Oct 29, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Oct 29, 2025
@ammario ammario added this pull request to the merge queue Oct 29, 2025
Merged via the queue into main with commit ca16308 Oct 29, 2025
13 checks passed
@ammario ammario deleted the unpushed-refs branch October 29, 2025 16:46
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