Two-session test: Agent A listens for questions and answers, Agent B
asks a question and captures the response. Also fixes missing
conversationRepository passthrough in tRPC adapter.
Three bugs fixed in auto-cleanup commit retry flow:
1. resumeForCommit now calls getDirtyWorktreePaths() to include specific
project subdirectory names in the prompt, so the agent knows which
dirs to cd into and commit (instead of running git from the non-repo
parent dir).
2. Removed finally block in tryAutoCleanup that reset the retry counter
after every call, making MAX_COMMIT_RETRIES ineffective. Counter is
now only cleaned up on success, max retries, or error.
3. resumeForCommit returns false early if no worktrees are actually
dirty, preventing unnecessary commit retries for clean agents.
Enables parallel agents to communicate through a CLI-based conversation
mechanism coordinated via tRPC. Agents can ask questions to peers and
receive answers, with target resolution by agent ID, task ID, or phase ID.
Preview deployments let reviewers spin up the app at a specific branch
in local Docker containers, accessible through a single Caddy reverse
proxy port. Docker is the source of truth — no database table needed.
New module: src/preview/ with config discovery (.cw-preview.yml →
compose → Dockerfile fallback), compose generation, Docker CLI wrapper,
health checking, and port allocation (9100-9200 range).
Setup tokens from `claude setup-token` can't query the usage API,
resulting in a useless "Usage API request failed" message. Now shows
the actual HTTP status and guides users to complete OAuth setup.
Also distinguishes warning state (yellow) from error state (red)
in the AccountCard UI.
DB log chunk insertion is now the sole trigger for agent:output events.
Eliminates triple emission (FileTailer, handleStreamEvent, output buffer)
in favor of: FileTailer.onRawContent → DB insert → EventBus emit.
- createLogChunkCallback emits agent:output after successful DB insert
- spawnInternal now wires onRawContent callback (fixes session 1 gap)
- Remove eventBus from FileTailer (no longer touches EventBus)
- Remove eventBus from ProcessManager constructor (dead parameter)
- Remove agent:output emission from handleStreamEvent text_delta
- Remove outputBuffers map and all buffer helpers from manager/handler
- Remove getOutputBuffer from AgentManager interface and implementations
- getAgentOutput tRPC: DB-only, no file fallback
- onAgentOutput subscription: no initial buffer yield, events only
- AgentOutputViewer: accumulates raw JSONL chunks, parses uniformly
Allow users to specify a custom branch when creating initiatives
(auto-generated if left blank). Add updateProject tRPC procedure
and /settings/projects page with inline-editable defaultBranch.
Planning tasks (research, discuss, plan, detail, refine) have their own
architect flow and should never enter the dispatch pipeline or clutter
agent context. Three changes:
1. Phase auto-queue skips planning-category tasks
2. Safety net in getNextDispatchable() skips planning tasks
3. gatherInitiativeContext() filters to execution tasks only
The dismiss mutation only invalidated `listAgents` but the hook reads
from `getActiveRefineAgent`, so the banner stayed visible after dismiss.
Added optimistic cache clearing and invalidation for `getActiveRefineAgent`.
Full rename across the codebase for clarity:
- breakdown (initiative→phases) is now "plan"
- decompose (phase→tasks) is now "detail"
Updates schema enums, TypeScript types, events, prompts, output handler,
tRPC procedures, CLI commands, frontend components, tests, and docs.
Also fixes 0022 migration multi-statement issue (adds statement-breakpoint markers).
Breakdown and decompose agents now receive all existing phases, tasks,
and pages as read-only context so they can plan with awareness of what
already exists instead of operating in a vacuum.
Check for refresh token availability before attempting credential refresh.
Setup tokens that expire without a refresh token now return a clear error
instead of attempting an invalid refresh operation.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Architect agent decomposed the "Data Display Components - Tables, Grids,
Nutrition Display" phase into 6 executable tasks for migrating admin app
from MUI to shadcn/ui + TanStack Table.
Tasks created:
1. Setup shadcn/ui infrastructure (foundation)
2. Migrate NutritionDisplay component (48-field responsive grid)
3. Migrate RecipeRankings and RecipeStatus components
4. Replace @mui/x-data-grid with TanStack Table
5. Test and verify all components (human checkpoint)
6. Remove unused MUI dependencies
Output files written to .cw/output/ for orchestration system.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Decomposed 'Layout & Navigation - Sidebar, Header, Responsive Wrapper' phase
into 6 executable tasks for migrating MUI components to shadcn/ui and Radix.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Decomposed "Data Display Components - Tables, Grids, Nutrition Display"
phase into 6 executable tasks for migrating MUI components to shadcn/ui:
1. Setup shadcn/ui infrastructure (foundation)
2. Migrate NutritionDisplay component (48-field grid)
3. Migrate RecipeRankings and RecipeStatus components
4. Replace @mui/x-data-grid with TanStack Table
5. Test and verify (checkpoint for human review)
6. Remove MUI dependencies and clean up
Tasks follow logical dependency chain with parallel execution where
possible. Includes comprehensive verification checklist before cleanup.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Check for refresh token availability before attempting credential refresh.
Setup tokens that expire without a refresh token now return a clear error
instead of attempting an invalid refresh operation.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Allow manual account registration using a setup token from `claude setup-token`.
The --token option requires --email and creates/updates account credentials
with the provided token.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Updated checkAccountHealth to handle setup tokens with null expiresAt:
- Changed currentExpiresAt type from number to number | null
- Use conditional for tokenExpiresAt ISO string conversion
This completes the OAuth setup token support across all credential
reading and validation functions.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add validation to check for refresh token availability before attempting
token refresh. Setup tokens that expire without a refresh token now
return a clear error message instead of attempting an invalid refresh.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Make refreshToken and expiresAt optional in usage credential validation.
Aligns with changes in default-credential-manager.ts.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Updated readCredentials and isTokenExpired to support setup tokens:
- Removed refreshToken requirement check
- Use nullish coalescing for refreshToken and expiresAt fields
- Treat tokens without expiresAt as non-expired
Completes OAuth credential handling for setup tokens across all
credential management functions.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Make refreshToken and expiresAt optional in OAuth credential validation.
Setup tokens without expiry are now treated as non-expired.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Updated DefaultAccountCredentialManager to handle setup tokens:
- Removed refreshToken requirement in validation check
- Use nullish coalescing for refreshToken and expiresAt
- Treat tokens without expiresAt as non-expired (setup tokens)
Completes the setup token support changes.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Modified OAuthCredentials interface to support setup tokens that don't
have refresh tokens or expiry times:
- refreshToken: string | null
- expiresAt: number | null
Updated in both src/agent/accounts/usage.ts and
src/agent/credentials/types.ts for consistency.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Pipeline view groups phases by dependency depth with DAG visualization.
Phase detail panel with Tiptap rich content editor and auto-save.
Code review tab with diff viewer and comment threads (dummy data).
Centralized live updates hook replaces scattered subscription boilerplate.
Extract agent output parsing into shared utility. Inbox detail panel,
account cards, and agent action components.
PROBLEM:
- Agents completing with questions were incorrectly marked as "crashed"
- Race condition: polling handler AND crash handler both called handleCompletion()
- Caused database corruption and lost pending questions
SOLUTION:
- Add completion mutex in OutputHandler to prevent concurrent processing
- Remove duplicate completion call from crash handler
- Only one handler executes completion logic per agent
TESTING:
- Added mutex-completion.test.ts with 4 test cases
- Verified mutex prevents concurrent access
- Verified lock cleanup on exceptions
- Verified different agents can process concurrently
FIXES: residential-cuckoo and 12+ other agents stuck in crashed state
Replaces file completion detection with a superior approach that reads only
complete JSONL lines and tracks file position. This eliminates race conditions
without any delays or polling.
Key improvements:
- Read up to last complete line, avoiding partial lines during writes
- Track file position per agent for incremental reading
- Process only valid, complete JSON lines
- Clean up position tracking on completion/crash
- No hardcoded delays or polling required
This approach is more robust, responsive, and elegant than timing-based solutions.
The race condition where agents were marked as crashed is now completely resolved.
Fixes race condition where agents were incorrectly marked as crashed when
output files took longer than 500ms to complete writing.
Changes:
- Replace hardcoded 500ms delay with polling-based file completion detection
- Add signal file validation to ensure JSON is complete before processing
- Make status updates atomic to prevent race conditions
- Update cleanup manager to pass outputFilePath for proper timing
This resolves the issue where successful agents like "abundant-wolverine"
were marked as crashed despite producing valid output.
Tasks completed: 2/2
- Run full build verification (TypeScript, Vite, tests)
- Full integration smoke test (human-verified, approved)
SUMMARY: .planning/phases/21-polish-integration/21-06-SUMMARY.md
Add 21-05-SUMMARY.md documenting route-based code splitting results
(582 KB -> 454 KB main chunk + route-level chunks) and PlanTasksFetcher
useEffect fix. Update STATE.md to plan 5/6 with new decisions.
Replace the setState-during-render pattern in PlanTasksFetcher with a
useEffect hook. The onTasks callback was being called directly in the
render body when tasksQuery.isSuccess was true, which could cause
infinite re-render loops when the parent state update triggered a
re-render. Now data flows through useEffect with proper dependencies.