Skip to content

Merge Sprint 4 Multi-Agent Coordination work into main - #9

Merged
frankbria merged 8 commits into
mainfrom
004-multi-agent-coordination
Nov 7, 2025
Merged

Merge Sprint 4 Multi-Agent Coordination work into main#9
frankbria merged 8 commits into
mainfrom
004-multi-agent-coordination

Conversation

@frankbria

@frankbria frankbria commented Nov 7, 2025

Copy link
Copy Markdown
Owner

Summary

This PR merges the 004-multi-agent-coordination branch back into main, bringing in substantial completed work that was developed but not fully merged.

What's Included (26 commits, ~3,000+ lines)

Sprint 4 Multi-Agent Coordination - Complete Implementation

  • UI Components: AgentCard component (136 lines), enhanced Dashboard with multi-agent state (224 lines), TaskTreeView improvements
  • API Documentation: Complete docs/ directory with 2,000+ lines of API documentation
  • User Documentation: Multi-agent guide (803 lines), troubleshooting guides
  • Sprint 4 Completion Reports: SPRINT_4_COMPLETE.md and related documentation

Bug Fixes & Improvements

  • Thread-safe WebSocket broadcasts in worker agents
  • TypeScript compilation fixes in Dashboard
  • Missing git repository handling in LeadAgent
  • Real database queries replacing mock data
  • Frontend validation error handling
  • Test stability improvements

Speckit Integration (~1,850 lines)

  • 8 new slash commands (.claude/commands/speckit.*.md)
  • Supporting scripts and templates (.specify/ directory)
  • Constitution and memory system

Project Schema Refactoring Enhancements

  • Enhanced workspace manager with security improvements
  • API endpoint updates for project creation
  • Additional tests (test_project_api.py, deployment mode tests)

CI/CD Planning Documentation

  • Design documents for GitHub workflows
  • Release gate checklists

Why This Merge?

The 004 branch contains completed Sprint 4 work including UI components, comprehensive documentation, bug fixes, and the entire Speckit integration framework. Main has evolved independently with CI/CD workflows implemented. This merge brings both together.

Conflicts Expected

  • tests/test_health_endpoint.py - Both branches added this file with different implementations

Testing

All tests were passing on the 004 branch before this PR. Will need to verify:

  • Integration tests still pass
  • No regressions from merging CI/CD work
  • Health endpoint tests work correctly

Related Issues: Sprint 4 completion (cf-f03 through cf-k01 now closed in beads)

Summary by CodeRabbit

  • New Features

    • Added deployment mode support (self-hosted and hosted) with security controls restricting local filesystem access in hosted environments
    • Enhanced path safety validation with symlink resolution and sensitive directory protection
  • Tests

    • Added integration tests for project creation workflows and deployment mode validation
  • Documentation

    • Added comprehensive schema migration and test results documentation

frankbria and others added 8 commits October 27, 2025 22:35
- Add symlink resolution with strict=True to prevent symlink attacks
- Blacklist sensitive directories (.ssh, .aws, .gnupg, .config)
- Improve exception handling to catch all path-related errors
- Update docstring with comprehensive security policy

Co-authored-by: Frank Bria <frankbria@users.noreply.github.com>
Project Schema Refactoring - Flexible Source Types & Deployment Modes
@coderabbitai

coderabbitai Bot commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Sprint 4.5 implements a comprehensive project schema refactoring, introducing deployment mode validation to restrict local filesystem access in hosted environments, enhancing workspace path safety with symlink resolution and sensitive directory blacklisting, and adding integration tests to validate the complete project creation flow with rollback capabilities.

Changes

Cohort / File(s) Summary
Documentation & Results
AGILE_SPRINTS.md, claudedocs/project-schema-test-results.md
Added Sprint 4.5 section detailing project schema refactoring goals, tasks, and commits. New test results document cataloging 21 passing tests across database, models, workspace, API, and deployment modules, with schema migration summary, breaking changes, and security deployment mode details.
Deployment Mode Validation
codeframe/ui/server.py
Introduced DeploymentMode enum (SELF_HOSTED, HOSTED) with get_deployment_mode() and is_hosted_mode() helpers. Added hosted-mode guard in create_project endpoint to forbid local_path source type with HTTP 403.
Workspace Path Safety
codeframe/workspace/manager.py
Enhanced _is_safe_path() to resolve symlinks strictly, validate containment under home directory, and blacklist sensitive directories (.ssh, .aws, .gnupg, .config). Extended exception handling to RuntimeError and OSError.
Integration & Unit Tests
tests/integration/test_project_creation_flow.py, tests/ui/test_deployment_mode.py
Added integration tests for end-to-end project creation with workspace setup and rollback on failure. Added deployment mode validation tests covering hosted-mode local_path restriction and self-hosted mode allowance across source types.

Sequence Diagram

sequenceDiagram
    actor User
    participant API as create_project endpoint
    participant DeployMode as Deployment Mode Guard
    participant DB as Database
    participant WorkspaceManager as Workspace Manager
    participant SafetyCheck as Path Safety Check

    User->>API: POST create_project (source_type, source_location)
    API->>DeployMode: is_hosted_mode()?
    
    alt Hosted Mode + local_path
        DeployMode-->>API: true
        API-->>User: HTTP 403 (local_path forbidden)
    else Allowed Configuration
        DeployMode-->>API: false OR non-local_path
        API->>DB: Create project record
        DB-->>API: project_id
        API->>WorkspaceManager: create_workspace(workspace_path)
        
        WorkspaceManager->>SafetyCheck: _is_safe_path(workspace_path)?
        
        alt Path is Safe
            SafetyCheck-->>WorkspaceManager: true
            WorkspaceManager->>WorkspaceManager: resolve symlinks, setup .git
            WorkspaceManager-->>API: workspace_path
            API->>DB: Update project with workspace_path
            DB-->>API: success
            API-->>User: HTTP 200 (project created)
        else Path is Unsafe
            SafetyCheck-->>WorkspaceManager: false
            WorkspaceManager-->>API: error
            API->>DB: Delete project (rollback)
            API-->>User: HTTP 400/403 (failed)
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Security-sensitive path safety logic: The symlink resolution (strict=True) and blacklist-based validation in _is_safe_path() requires careful verification of edge cases and exception handling coverage.
  • Deployment mode enforcement: Verify that the hosted-mode guard correctly intercepts all relevant endpoints and that the environment variable configuration is properly validated.
  • Integration test correctness: Confirm that the rollback logic in test_create_project_rollback_on_failure properly cleans up database state and that fixture setup/teardown doesn't leave dangling state.

Poem

🐰 Schemas refactored with care and grace,
With symlinks resolved to their rightful place,
Deployment modes guard each hosted space,
Tests verify flow from start to finish,
The workspace grows safe—no risk to diminish! 🌿

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title mentions 'Multi-Agent Coordination work' but the raw summary shows this PR primarily contains project schema refactoring, deployment mode validation, workspace management improvements, and test coverage—not multi-agent coordination features. Clarify the title to reflect the actual primary changes, such as 'Add project schema refactoring with deployment mode validation and workspace security improvements' or confirm whether multi-agent work is the main focus.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 004-multi-agent-coordination

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/ui/test_deployment_mode.py (1)

12-67: Consider parametrizing fixtures to reduce duplication.

The two fixtures test_client_hosted and test_client_self_hosted have nearly identical code. Consider using pytest's @pytest.fixture(params=[...]) to reduce duplication:

@pytest.fixture(params=["hosted", "self_hosted"])
def test_client(request):
    """Test client with configurable deployment mode."""
    temp_dir = Path(tempfile.mkdtemp())
    db_path = temp_dir / "test.db"
    workspace_root = temp_dir / "workspaces"

    db = Database(db_path)
    db.initialize()
    app.state.db = db
    app.state.workspace_root = workspace_root

    from codeframe.workspace import WorkspaceManager
    app.state.workspace_manager = WorkspaceManager(workspace_root)

    os.environ["CODEFRAME_DEPLOYMENT_MODE"] = request.param
    client = TestClient(app)
    
    yield client, request.param
    
    del os.environ["CODEFRAME_DEPLOYMENT_MODE"]
    db.close()
    shutil.rmtree(temp_dir)

However, the current explicit approach is also clear and acceptable, especially if you prefer test clarity over DRYness.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6fc2c9d and 99aee7c.

📒 Files selected for processing (6)
  • AGILE_SPRINTS.md (1 hunks)
  • claudedocs/project-schema-test-results.md (1 hunks)
  • codeframe/ui/server.py (3 hunks)
  • codeframe/workspace/manager.py (2 hunks)
  • tests/integration/test_project_creation_flow.py (1 hunks)
  • tests/ui/test_deployment_mode.py (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-26T01:37:34.924Z
Learnt from: CR
Repo: frankbria/codeframe PR: 0
File: docs/CLAUDE.md:0-0
Timestamp: 2025-10-26T01:37:34.924Z
Learning: Applies to docs/**/AGILE_SPRINTS.md : Update AGILE_SPRINTS.md with each commit to reflect true codebase state

Applied to files:

  • AGILE_SPRINTS.md
🧬 Code graph analysis (3)
tests/ui/test_deployment_mode.py (2)
codeframe/persistence/database.py (2)
  • initialize (19-39)
  • close (560-564)
codeframe/workspace/manager.py (1)
  • WorkspaceManager (13-249)
tests/integration/test_project_creation_flow.py (3)
codeframe/persistence/database.py (5)
  • initialize (19-39)
  • close (560-564)
  • update_project (640-672)
  • get_project (380-385)
  • delete_project (674-682)
codeframe/workspace/manager.py (2)
  • WorkspaceManager (13-249)
  • create_workspace (25-70)
codeframe/ui/models.py (1)
  • SourceType (11-16)
codeframe/ui/server.py (1)
codeframe/ui/models.py (1)
  • SourceType (11-16)
🪛 LanguageTool
claudedocs/project-schema-test-results.md

[duplication] ~92-~92: Possible typo: you repeated a word.
Context: ...pi/projectsnow requiresdescriptionfield -project_typefield renamed tosource_type` with new value...

(ENGLISH_WORD_REPEAT_RULE)


[duplication] ~96-~96: Possible typo: you repeated a word.
Context: ...ace_path` (managed internally) ### For Tests - Tests using old database schema need updates ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Ruff (0.14.3)
tests/ui/test_deployment_mode.py

111-111: Probable insecure usage of temporary file or directory: "/tmp/test"

(S108)

tests/integration/test_project_creation_flow.py

90-90: Do not assert blind exception: Exception

(B017)

codeframe/workspace/manager.py

235-235: Consider moving this statement to an else block

(TRY300)

🔇 Additional comments (7)
codeframe/ui/server.py (2)

25-50: LGTM! Clean deployment mode implementation.

The DeploymentMode enum and helper functions provide a clear, maintainable way to distinguish between self-hosted and hosted SaaS deployments. The environment variable approach with a sensible default ensures backward compatibility.


289-294: LGTM! Effective security guard for hosted deployments.

The hosted mode check is correctly placed before any database operations, preventing local filesystem access in hosted SaaS environments. The HTTP 403 response with a clear error message provides good user feedback.

tests/ui/test_deployment_mode.py (1)

102-116: Test coverage is appropriate.

The test correctly verifies that self-hosted mode allows local_path source type. The static analysis warning about /tmp/test (line 111) is a false positive—it's just a test value that won't actually be accessed since the test only verifies the HTTP status code.

AGILE_SPRINTS.md (1)

1964-2047: Excellent sprint documentation.

Sprint 4.5 documentation is comprehensive and follows the established format. It clearly tracks all implementation tasks, schema changes, and test results. The completion status and commit references make it easy to trace the work done.

Based on learnings

tests/integration/test_project_creation_flow.py (1)

11-30: Well-structured integration test fixture.

The integration_env fixture properly sets up all necessary components (database, workspace manager) and ensures comprehensive cleanup. Good use of a temporary directory to isolate tests.

codeframe/workspace/manager.py (1)

206-238: Excellent security improvements to path validation.

The enhanced _is_safe_path method significantly strengthens the security posture:

  1. Symlink resolution (strict=True) prevents path traversal attacks by requiring the path to exist and resolving all symbolic links.
  2. Sensitive directory blacklist prevents access to credential stores (.ssh, .aws, .gnupg, .config).
  3. Broader exception handling catches additional edge cases like permission errors and non-existent paths.

These changes are essential for the hosted deployment mode where filesystem access must be carefully controlled.

Note: The static analysis suggestion to move line 235 to an else block can be safely ignored—the current structure with early returns is clear and idiomatic.

claudedocs/project-schema-test-results.md (1)

1-131: Comprehensive test results documentation.

This document provides excellent visibility into the project schema refactoring effort:

  • Clear breakdown of all 21 new tests by category
  • Comprehensive schema changes summary
  • Breaking changes documentation for developers
  • Security implications explained

The LanguageTool warnings about word repetition (lines 92, 96) are false positives from the markdown formatting and can be safely ignored.

Comment on lines +89 to +95
# Try to create workspace (should fail)
with pytest.raises(Exception):
workspace_manager.create_workspace(
project_id=project_id,
source_type=SourceType.GIT_REMOTE,
source_location="invalid-url"
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use more specific exception type in assertion.

The test catches a blind Exception, which is too broad and could mask unexpected failures. Based on the WorkspaceManager implementation, invalid git URLs raise RuntimeError.

Apply this diff to make the assertion more specific:

-    # Try to create workspace (should fail)
-    with pytest.raises(Exception):
+    # Try to create workspace (should fail with RuntimeError)
+    with pytest.raises(RuntimeError, match="Failed to create workspace"):
         workspace_manager.create_workspace(
             project_id=project_id,
             source_type=SourceType.GIT_REMOTE,
             source_location="invalid-url"
         )

This makes the test more precise and helps catch unexpected exception types.

🧰 Tools
🪛 Ruff (0.14.3)

90-90: Do not assert blind exception: Exception

(B017)

🤖 Prompt for AI Agents
In tests/integration/test_project_creation_flow.py around lines 89 to 95, the
test currently uses pytest.raises(Exception) which is too broad; replace that
with pytest.raises(RuntimeError) so the test asserts the specific exception type
thrown for invalid git URLs by WorkspaceManager.

@frankbria
frankbria merged commit 23fb128 into main Nov 7, 2025
4 of 5 checks passed
@frankbria
frankbria deleted the 004-multi-agent-coordination branch November 7, 2025 04:28
frankbria added a commit that referenced this pull request Nov 22, 2025
Merge Sprint 4 Multi-Agent Coordination work into main
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