Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

fix errors dispatch branch

Jeromef1879b8d73e3
diff --git a/.claude/agents/merger.md b/.claude/agents/merger.md
index 697632e1..099a5354 100644
--- a/.claude/agents/merger.md
+++ b/.claude/agents/merger.md
@@ -127,7 +127,8 @@ cd $CLAUDE_PROJECT_DIR && flock $CLAUDE_PROJECT_DIR/.promote.lock bash -c '
[ -z "$DEFAULT" ] && { git show-ref --verify --quiet refs/heads/master && DEFAULT=master || DEFAULT=main; }
git reset --hard HEAD # drop working-tree debris on whatever branch we are on
git checkout "$DEFAULT" || exit 1 # promotion target is the session fork-base branch, NOT $CLAUDE_PROJECT_DIR HEAD
- /entrypoint-helpers/apply-app-variant.sh # checkout reverts App.tsx variant — re-apply it
+ # Docker-only helper: re-applies the App.tsx variant that checkout reverts. Absent in a local checkout — skip it there.
+ [ -x /entrypoint-helpers/apply-app-variant.sh ] && /entrypoint-helpers/apply-app-variant.sh
git merge --no-ff session/<SESSION_SHORT_ID> -m "merge(session): <SESSION_SHORT_ID>" \
|| { git merge --abort; exit 1; }
'
@@ -164,7 +165,8 @@ cd $CLAUDE_PROJECT_DIR && flock $CLAUDE_PROJECT_DIR/.promote.lock bash -c '
[ -z "$DEFAULT" ] && { git show-ref --verify --quiet refs/heads/master && DEFAULT=master || DEFAULT=main; }
git reset --hard HEAD
git checkout "$DEFAULT" || exit 1
- /entrypoint-helpers/apply-app-variant.sh
+ # Docker-only helper: re-applies the App.tsx variant that checkout reverts. Absent in a local checkout — skip it there.
+ [ -x /entrypoint-helpers/apply-app-variant.sh ] && /entrypoint-helpers/apply-app-variant.sh
git merge --no-ff <BRANCH_NAME> -m "rollback(<SESSION_SHORT_ID>): undo via agent" \
|| { git merge --abort; exit 1; }
'
diff --git a/.claude/agents/orchestrator.md b/.claude/agents/orchestrator.md
index 3c73775e..dbfb23ae 100644
--- a/.claude/agents/orchestrator.md
+++ b/.claude/agents/orchestrator.md
@@ -355,13 +355,13 @@ In ONE assistant message, dispatch a foreground developer for every ticket in th
Agent({
subagent_type: "developer",
description: "Implement TASK-XXX",
- prompt: "ROLE: developer\nTASK_ID: TASK-XXX\nTICKET_FILE: <TICKETS_DIR>/TASK-XXX.json\nWORKTREE_PATH: <WORKTREE_BASE>/TASK-XXX\nBRANCH_NAME: <SESSION_SHORT_ID>/<branch_name (must start with TASK-XXX)>"
+ prompt: "ROLE: developer\nTASK_ID: TASK-XXX\nTICKET_FILE: <TICKETS_DIR>/TASK-XXX.json\nWORKTREE_PATH: <WORKTREE_BASE>/TASK-XXX\nBRANCH_NAME: <SESSION_SHORT_ID>/TASK-XXX"
})
```
(No `run_in_background`, no `isolation`, no `name`.)
-Substitute the actual ticket id and the concrete `<TICKETS_DIR>` / `<WORKTREE_BASE>` / `<SESSION_SHORT_ID>`. For `BRANCH_NAME`, use the ticket's `branch_name` when it starts with the ticket id (`TASK-XXX-...`); otherwise build `TASK-XXX-<slug>` (short kebab-case from the title). The `setup-worktree` hook rejects any branch not matching `<SESSION_SHORT_ID>/TASK-XXX[-suffix]` — never carry over a planner `feature/...`/`fix/...` prefix. **The `WORKTREE_PATH` and `BRANCH_NAME` lines are required and must follow the template verbatim**: `setup-worktree` runs on THIS dispatch (PreToolUse/Agent), reads `WORKTREE_PATH`/`BRANCH_NAME`/`TASK_ID`, and creates the worktree (forked from `session/<SESSION_SHORT_ID>`, node_modules provisioned) before the developer starts. `enforce-dev-dispatch` blocks the dispatch if `WORKTREE_PATH` is missing or if you add `isolation: "worktree"`.
+Substitute the actual ticket id and the concrete `<TICKETS_DIR>` / `<WORKTREE_BASE>` / `<SESSION_SHORT_ID>`. `BRANCH_NAME` is always exactly `<SESSION_SHORT_ID>/TASK-XXX` — slug-free. `setup-worktree` derives the branch it creates solely from `TASK_ID` (`<SESSION_SHORT_ID>/TASK-XXX`) and ignores any descriptive suffix; carrying a slug (or a planner `feature/...`/`fix/...` prefix) only makes the merger's `BRANCH_NAME` disagree with the branch that actually exists, so don't add one. **The `WORKTREE_PATH` and `BRANCH_NAME` lines are required and must follow the template verbatim**: `setup-worktree` runs on THIS dispatch (PreToolUse/Agent), reads `WORKTREE_PATH`/`BRANCH_NAME`/`TASK_ID`, and creates the worktree (forked from `session/<SESSION_SHORT_ID>`, node_modules provisioned) before the developer starts. `enforce-dev-dispatch` blocks the dispatch if `WORKTREE_PATH` is missing or if you add `isolation: "worktree"`.
**Never add a `name:` field to any STATE B dispatch.** The Agent tool schema has `additionalProperties: false` with no `name` property, so a `name:` fails input validation before the subagent starts. Use `description:` for labels; foreground-vs-background is controlled solely by `run_in_background` (absent/false → dispatches block).
@@ -393,12 +393,12 @@ After re-developing, **re-review** it. **Loop Stage 2 until every still-live tic
#### Stage 3 — MERGE (sequential — do NOT batch)
-Per-ticket mergers all merge into the shared `session/<SESSION_SHORT_ID>` branch inside the single `_session` worktree, with no lock on Stage A — concurrent mergers would race on the branch and `.git/index.lock`. Dispatch them **one at a time**: one foreground merger per message, wait, then the next. `<branch>` is the `branch=` value from this ticket's stored `dev_output` (NOT the planner's suggestion):
+Per-ticket mergers all merge into the shared `session/<SESSION_SHORT_ID>` branch inside the single `_session` worktree, with no lock on Stage A — concurrent mergers would race on the branch and `.git/index.lock`. Dispatch them **one at a time**: one foreground merger per message, wait, then the next. `BRANCH_NAME` is always `<SESSION_SHORT_ID>/TASK-XXX` — the canonical branch `setup-worktree` created for this ticket. Do NOT use the `branch=` value echoed in the developer's `dev_output` (it reflects the prompt's `BRANCH_NAME`, which may carry a phantom slug) nor the planner's suggestion — both can disagree with the branch that actually exists and make the merge fail with "not something we can merge":
```
Agent({ subagent_type: "merger",
description: "Merge T",
- prompt: "ROLE: merger\nTASK_ID: T\nBRANCH_NAME: <SESSION_SHORT_ID>/<branch>\nWORKTREE_PATH: <WORKTREE_BASE>/T\nSESSION_SHORT_ID: <SESSION_SHORT_ID>\nTICKETS_DIR: <TICKETS_DIR>" })
+ prompt: "ROLE: merger\nTASK_ID: T\nBRANCH_NAME: <SESSION_SHORT_ID>/T\nWORKTREE_PATH: <WORKTREE_BASE>/T\nSESSION_SHORT_ID: <SESSION_SHORT_ID>\nTICKETS_DIR: <TICKETS_DIR>" })
```
Per result: `DONE: T commit=…` → `stage = DONE`; `FAILED:`/malformed → `stage = FAILED`. (The `block-merger-without-review` hook gates each merger dispatch on the recorded quality-reviewer `APPROVED` verdict.)
diff --git a/.claude/agents/planner.md b/.claude/agents/planner.md
index 29e283e0..fd4c32fd 100644
--- a/.claude/agents/planner.md
+++ b/.claude/agents/planner.md
@@ -105,7 +105,7 @@ Rules:
Normal feature tickets (type / component / config prop) → `parallel_safe: true`.
-**`branch_name`**: filesystem-safe, `<TICKET_ID>-<short-kebab>` (e.g. `TASK-002-deal-stage-filter`). It MUST start with the ticket's own id: the orchestrator dispatches with `BRANCH_NAME: <SESSION_SHORT_ID>/<branch_name>`, and the `setup-worktree` hook rejects any branch that does not match `<SESSION_SHORT_ID>/TASK-XXX[-suffix]`. Never prefix with `feature/` or `fix/`.
+**`branch_name`**: descriptive only — a human-readable label, `<TICKET_ID>-<short-kebab>` (e.g. `TASK-002-deal-stage-filter`). It is NOT used as the git branch: the orchestrator always dispatches with the canonical `BRANCH_NAME: <SESSION_SHORT_ID>/TASK-XXX`, and `setup-worktree` derives the branch it creates solely from the ticket id (`<SESSION_SHORT_ID>/TASK-XXX`), ignoring any suffix. Keep it readable; never prefix with `feature/` or `fix/`.
**`visual_customization`**: set `true` when the ticket touches colors, theme, component styling, dark/light mode, or layout preferences. The developer loads `Skill({skill: "shadcn-customization"})` as its first action on such tickets.