Skip to content

Conversation

@seocombat
Copy link

Summary

Fixes "The command line is too long" errors on Windows when running the agent or spec creation.

On Windows, command line arguments are limited to ~8KB. This caused failures when:

  1. client.py passed **os.environ to MCP server config (PATH alone can exceed 2KB on Windows)
  2. spec_chat_session.py passed 18KB skill content as system_prompt

Changes

  • client.py: Remove env from MCP config, pass --project-dir as CLI argument instead
  • mcp_server/feature_mcp.py: Add argparse support for --project-dir (with fallback to PROJECT_DIR env var for backward compatibility)
  • server/services/spec_chat_session.py: Use short system_prompt, pass skill content in first message instead

Test plan

  • Tested on Windows 10 with long PATH environment variable
  • Agent starts successfully without "command line too long" error
  • Spec creation chat works without errors
  • MCP server still works with env var fallback (backward compatible)

🤖 Generated with Claude Code

seocombat and others added 9 commits January 6, 2026 23:09
On Windows, command line arguments are limited to ~8KB. This caused
"The command line is too long" errors when:

1. client.py passed **os.environ to MCP server config (PATH alone can
   exceed 2KB on Windows)
2. spec_chat_session.py passed 18KB skill content as system_prompt

Changes:
- client.py: Remove env from MCP config, pass --project-dir as CLI arg
- mcp_server/feature_mcp.py: Add argparse support for --project-dir
  (with fallback to PROJECT_DIR env var for backward compatibility)
- spec_chat_session.py: Use short system_prompt, pass skill content
  in first message instead

Tested on Windows 10 with long PATH environment variable.
- Use short system_prompt to avoid Windows command line limits
- Pass project context in first message instead (like spec_chat_session)
- Use absolute path for MCP server script to fix module resolution
- Add ROOT_DIR constant to client.py for consistent path handling

The long system_prompt (6331 chars) was causing Claude CLI
initialization to timeout on Windows. This follows the same
pattern as spec_chat_session.py which uses a short system_prompt
and passes content in the first message.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements a coordinator-worker pattern for running multiple agents in parallel:

- Add FeatureStatus enum (pending/in_progress/passing/conflict/failed)
- Add atomic feature claiming via SQLite CTE with RETURNING
- Add lease-based heartbeat for stale claim recovery (30min timeout)
- Add WorktreeManager for git worktree lifecycle management
- Add ParallelCoordinator for spawning/monitoring workers
- Add parallel_agent.py CLI entry point (--workers 1-10)
- Update process_manager to choose single vs parallel agent script
- Add UI worker count selector (cycles 1→3→5)
- Add ruff.toml config and fix lint errors

Usage:
  CLI: python parallel_agent.py --project-dir my-app --workers 5
  UI: Click users icon to select worker count before starting

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Critical fixes:
- Add init_database_direct() for DB initialization without MCP server
- Call init_database_direct() in coordinator before any MCP tool calls
- Add --worktree-path and --feature-id CLI args to autonomous_agent_demo
- Add work_dir parameter to separate code changes from DB access
- Add feature_get_by_id MCP tool for fetching specific features
- Add get_coding_prompt_parallel() with override instructions for bound feature
- Workers now use feature_get_by_id instead of feature_get_next

Major fix:
- Capture target branch at startup via git symbolic-ref
- merge_feature_branch() now uses explicit branch checkout, not HEAD
- Prevents detached HEAD issues during merge operations

Minor fix:
- Pass --model to worker subprocess (verified working)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Major fixes:
- Add feature_get_by_id to allowed tools in prompt templates
- Copy app_spec.txt to worktrees via WORKTREE_SYNC_FILES

Tests added (14 passing):
- Concurrent claim uniqueness (N workers → N distinct features)
- Heartbeat lease_lost behavior (wrong worker_id)
- Stale reclaim (claimed_at old → returns to pending)
- Merge serialization smoke test (asyncio.Lock blocks concurrent access)
- Migration forwards/backwards sanity (Enum storage + passes invariant)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- WORKTREE_SYNC_FILES now uses (src, dst) tuples to support path remapping
- prompts/app_spec.txt → app_spec.txt ensures agents can read spec
- Fixed misleading comment: "dest doesn't exist" not "source is newer"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add overwrite flag to WORKTREE_SYNC_FILES tuples
- prompts/app_spec.txt always overwrites root app_spec.txt (overwrite=True)
- Prevents stale specs when prompts/ version is updated

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.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.

1 participant