|
2 | 2 |
|
3 | 3 | > Append-only session log. Read at session start. Update at session end. |
4 | 4 |
|
| 5 | +## 2026-07-07 — Auto-transition to review on EXECUTE completion (`reviewStatusId`) |
| 6 | + |
| 7 | +Follow-up to today's "does a successful run properly resolve the issue" gap |
| 8 | +(found in the Cockpit/false-STALLED session earlier today). Bailey's policy: |
| 9 | +an agent should be inclined to move work to In Review when it believes it's |
| 10 | +done, never straight to Done — Done stays a human call (or an explicit |
| 11 | +instruction) unless confirmed. |
| 12 | + |
| 13 | +- **Schema** (migration `0092`): `Workspace.reviewStatusId String?` + |
| 14 | + `reviewStatus` relation, mirroring the existing `startedStatusId` / |
| 15 | + `maybeAutoTransitionOnAssign` pattern exactly (same shape, same validation |
| 16 | + style, same opt-in-null-disables semantics). |
| 17 | +- **`maybeAutoTransitionOnComplete()`** (`src/server/audit.ts`, new, exported |
| 18 | + — sits right beside `maybeAutoTransitionOnAssign`): EXECUTE-only; skips if |
| 19 | + the workspace has no `reviewStatusId`, the target isn't an IN_REVIEW- |
| 20 | + category status, or the issue is already IN_REVIEW/DONE/CANCELED. Unlike |
| 21 | + the assign-time version, BACKLOG/TODO/IN_PROGRESS are **not** skipped — |
| 22 | + completing work should surface for review regardless of prior state |
| 23 | + (including issues that were never auto-started at all). |
| 24 | +- **Hooked into `runs.complete` directly** (`mcp.ts`), not the generic |
| 25 | + `recordChange`/`AGENT_RUN_COMPLETED` audit fan-out — verified live data |
| 26 | + shows `AGENT_RUN_COMPLETED` fires for abandons/stops too (e.g. "Stopped by |
| 27 | + operator to restart as RESEARCH"), so gating on that event kind alone would |
| 28 | + have wrongly auto-transitioned stopped runs. `runs.complete`'s own handler |
| 29 | + already has `run.issueId` + `run.engagementMode` in scope, so this needed |
| 30 | + zero extra plumbing. |
| 31 | +- **Settings UI**: new "Auto-transition on completion" section on |
| 32 | + Settings → Workspace, right after the existing "Auto-transition on |
| 33 | + assignment" one. Used the themed `Combobox` (not a native `<select>`, even |
| 34 | + though its neighbor still is — one of the pre-existing ~58-site backlog; |
| 35 | + didn't touch it, but wrote the new field correctly from the start). |
| 36 | +- **Tests**: 2 new cases in `mcp.test.ts`'s `runs.complete` describe block |
| 37 | + (EXECUTE transitions; RESEARCH does not, even with `reviewStatusId` set). |
| 38 | + The default test fixture doesn't seed an IN_REVIEW-category status, so |
| 39 | + both create one ad-hoc, matching an existing code comment in this file |
| 40 | + that already called that gap out. |
| 41 | +- **Docs**: `docs/agents/engagement-modes.md`'s "What each mode changes" |
| 42 | + list gains a sibling bullet next to the `startedStatusId` one. |
| 43 | + |
| 44 | +**Big unblock, unrelated to the feature itself:** finally root-caused why |
| 45 | +every worktree this session could typecheck/lint/build but never actually |
| 46 | +*run* its test suite (`Cannot find module 'server-only'`, seen 3x already |
| 47 | +today). `pnpm-workspace.yaml` is gitignored and a fresh worktree checkout |
| 48 | +never has it — without it, `pnpm install` silently skips linking a chunk of |
| 49 | +real dependencies (not just `server-only`; eslint/vitest/prisma/typescript/ |
| 50 | +tailwindcss/tsx were missing too) while still reporting success. Copying the |
| 51 | +file in from the main checkout, then `pnpm install` + `pnpm exec prisma |
| 52 | +generate` + exporting `AUTH_SECRET` alongside `DATABASE_URL`/`REDIS_URL`, gets |
| 53 | +a genuinely clean `pnpm test` run — 1067/1068 passing (1 pre-existing skip), |
| 54 | +confirmed zero regressions from this change specifically by running the full |
| 55 | +suite, not just the new tests. Documented in memory for future sessions. |
| 56 | + |
5 | 57 | ## 2026-07-07 — Cockpit responsive breakpoints + false-STALLED root-cause fix |
6 | 58 |
|
7 | 59 | Two pieces, following up the same-day Cockpit ship. |
|
0 commit comments