Skip to content

feat: Beads issue integration for workspace creation#47

Open
ckrough wants to merge 6 commits intomainfrom
friendly-einstein
Open

feat: Beads issue integration for workspace creation#47
ckrough wants to merge 6 commits intomainfrom
friendly-einstein

Conversation

@ckrough
Copy link
Owner

@ckrough ckrough commented Jan 12, 2026

Summary

Implements beads issue tracker integration with agentspaces workspace creation, enabling users to create workspaces directly from issue IDs.

Changes

  • Added issue_id field to workspace metadata (schema v3→v4)
  • Created beads infrastructure module for CLI integration
  • Added create_from_issue() service method
  • Added CLI flags: --next-issue and --issue-id
  • Updated TUI to display issue information
  • Added issue-specific output formatters
  • Comprehensive test coverage (12 integration + 14 unit tests)

Commands

# Create workspace from next ready issue
agentspaces workspace create --next-issue

# Create workspace from specific issue
agentspaces workspace create --issue-id=agentspaces-123

Test Results

  • 337 tests passing
  • 85.27% code coverage
  • All quality gates passed (ruff, mypy, bandit)
  • @Python-pro review approved

Backward Compatibility

  • v3 workspaces load correctly (issue_id defaults to None)
  • No migration required
  • Existing workspace creation unchanged

Implements data model, beads module, and service layer changes for
workspace creation from beads issues.

Changes:
- Bump metadata schema to v4 with issue_id field (backward compatible)
- Create beads infrastructure module for bd command integration
- Add workspace_name parameter to support custom workspace names
- Add create_from_issue() wrapper for issue-based workspace creation
- Update WorkspaceInfo to include issue_id field
- Add comprehensive tests for beads module (84% coverage)

Completed tasks:
- agentspaces-1io.1: Data model with issue_id field
- agentspaces-1io.2: Beads infrastructure module
- agentspaces-1io.4: Service layer integration
- agentspaces-1io.5: Custom workspace names support

Related: agentspaces-1io
…e 3)

Implements user-facing commands for creating workspaces from Beads issues.

Changes:
- Add --next-issue and --issue-id flags to workspace create command
- Add mutual exclusivity validation (attach/next-issue/issue-id)
- Add issue-specific formatters with rich panels
- Display copyable claude command with issue context
- Comprehensive error handling for all beads operations

Completed tasks:
- agentspaces-1io.3: CLI flags for issue-based creation
- agentspaces-1io.7: Issue-specific output formatters

Related: agentspaces-1io
Updates TUI to display and use the issue_id field while maintaining backward compatibility with workspaces that only have purpose.

Changes: Display issue_id in workspace details, update navigation commands to prefer issue_id field, update tab title to use issue_id field, maintain backward compatibility.

Completed: agentspaces-1io.6
Comprehensive integration tests for agentspaces-1io.8:
- 12 test cases covering create_from_issue() functionality
- Tests for issue_id persistence in metadata v4
- Tests for custom workspace names
- Tests for schema v4 round-trip and v3 backward compatibility
- Tests for duplicate workspace rejection
- Uses realistic beads issue ID format (agentspaces-1a2b)
- Adds assertions on git mock calls for verification

All tests pass. Coverage: 85.27% (above 80% target).
Fix 5 SIM117 linting violations by combining nested with statements
into single with blocks. This improves code readability and follows
Python best practices for context manager usage.

Changes:
- Combine pytest.raises() with patch() context managers
- Apply to all error test cases in test_beads.py
- All tests still passing (14/14)

Quality: ruff check passes with no issues.
@claude
Copy link

claude bot commented Jan 12, 2026

Code review

Found 1 issue that should be addressed:

Exit code inconsistency in workspace.py

Location: src/agentspaces/cli/workspace.py line 115

Issue: When no ready issues are found with --next-issue, the code calls print_error() but exits with code 0 (success) instead of 1 (error).

Current code:

if not issues:
    print_error("No ready issues found. Create with: bd create")
    raise typer.Exit(0)  # Should be Exit(1)

Why this is a bug:

  • The command fails to accomplish its intended task (create a workspace from an issue)
  • Exit code 0 indicates success, which is inconsistent with the error message
  • All other error conditions in this file consistently use typer.Exit(1) after print_error()
  • Scripts or CI pipelines checking exit codes would incorrectly interpret this as successful execution

Fix:

if not issues:
    print_error("No ready issues found. Create with: bd create")
    raise typer.Exit(1)  # Error condition should use exit code 1

Reference: See other error handlers in the same file at lines 100, 107, 139, 142, 162, etc. which all use typer.Exit(1) consistently.


Otherwise, the code looks good! The implementation follows CLAUDE.md conventions:

  • ✅ Type hints on all functions
  • ✅ Google-style docstrings
  • ✅ Proper error handling
  • ✅ Subprocess-based git operations
  • ✅ Structured logging with structlog
  • ✅ Good test coverage (85.27%)

Fix exit code inconsistency in workspace.py line 115. When no ready
issues are found with --next-issue flag, the command now correctly
exits with code 1 (error) instead of 0 (success).

This ensures consistent error handling across the CLI and prevents
scripts/CI from incorrectly interpreting the failure as success.

Addresses code review feedback from PR #47.
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.

1 participant

Comments