[AIDE-99] Worktree Card Cleanup - #79
Merged
Merged
Conversation
- Combine workflow and command quick actions into a single row with a separator that hides when the groups wrap - Add group-by-agent/repository toggle and persist it along with the worktree filters in localStorage
Show the dirty badge when a worktree has staged changes, not only unstaged ones, so cards and table rows reflect the full repo state.
Add five new worktree highlight/tag colors (lavender, maroon, brown, olive, navy) with matching Tailwind theme colors, tag classes, swatches, and card surfaces. Swatches no longer wash out to gray on hover or selection, and clear-highlight moved from the toggle group into a button beside the menu label. Translate the AgentJob_codebaseId_active_key unique violation into CodebaseBusyError in agent-control so the workflow runtime retries a busy codebase instead of leaking a raw Prisma P2002 to the UI; the conflict helper now lives in lib/codebase-busy.
A stop request for a run between attempts called cancelJob on a job the agent had already reported back on (or that never existed), leaving the run stuck in CANCELLING forever. Treat terminal job statuses as non-cancellable and close the run out directly instead.
Commands run detached so their whole process tree can be signalled as one group, which also means they survive an agent that was killed rather than asked to stop. A restarted run would then collide with the original — a server holding its port, a build holding its lock. Match leftover command scripts with pgrep by their temp-directory prefix, signal each process group, and escalate to SIGKILL after a grace period. Run once at startup before any job is claimed, and centralize the script prefix constant so the matcher can never drift from the runner.
- Reap orphaned command processes only for the agent's own enrollment via a hashed marker, leaving development or second agents under the same OS account untouched - Add DB triggers excluding command runs from sharing a codebase with git/worktree jobs in both insertion orders - Support statuses filtering on commandRuns and agent/worktree filtering on commandRunsChanged, and use them in quick actions
Show the queue reason and the runs competing for a run's target on the run detail page. The explanation is derived on read from the same rows the dispatcher consults, so it cannot drift from the decision the dispatcher will actually make: WAITING_FOR_AGENT and AGENT_OFFLINE distinguish a job nobody claimed from an agent that is offline, and TARGET_BUSY/QUEUED_BEHIND name the exact runs being waited on. The page re-polls while a run waits so the explanation stays current.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Overhauls command run management and cleans up the worktrees page. Command runs now have three concurrency modes —
EXCLUSIVE,NON_EXCLUSIVE,EXCLUDED— that behave like a reader-writer lock over a target (a worktree or an agent home), so runs sharing a target no longer blindly overlap. Runs that cannot start yet explain exactly why, and the UI shows the full queue competing for the target. Agent-side, orphaned command processes left behind by a killed agent are reaped at startup, and stop requests whose agent job already ended are finished locally instead of hanging inCANCELLING. The worktrees page gets a group-by-repository view, persisted filters, new highlight colors, and tighter badges.Changes
CommandConcurrencyenum (EXCLUSIVE / NON_EXCLUSIVE / EXCLUDED), persisted onCommandDefinitionand snapshotted onto eachCommandRunvia migration; dispatcher admission (admitCommandRun) acts as a reader-writer lock with queue-order tie-breaking so exclusive runs can't starve behind a stream of shared work.dispatchChain) so two interleaved dispatches cannot both see a free target and both claim it.evaluateCommandRunQueuederives a run's wait reason (TARGET_BUSY,QUEUED_BEHIND,AGENT_OFFLINE,WAITING_FOR_PREDECESSOR,RESTART_DELAY, etc.) from live rows, so the explanation can't drift from what the dispatcher will actually decide; surfaced as aqueuefield onCommandRunplus a new GraphQL subscription filter (commandRunsChangedby agent/worktree).reapOrphanedCommandProcessesruns once at agent startup, signalling leftover process groups so a restarted agent doesn't collide with a still-running server/build.CANCELLING.AgentJob_codebaseId_active_keyconflict is now recognized (isActiveCodebaseJobConflict) and translated toCodebaseBusyError; command dispatch keeps the run queued and retries instead of failing on a busy codebase.QuickActionsRowthat puts workflow and command quick actions on one responsive line.Ticket: AIDE-99