Skip to content

feat(missions): slice 1 — end-to-end spine with stub worker#249

Closed
DaveHudson wants to merge 2 commits intomainfrom
mission/slice-1
Closed

feat(missions): slice 1 — end-to-end spine with stub worker#249
DaveHudson wants to merge 2 commits intomainfrom
mission/slice-1

Conversation

@DaveHudson
Copy link
Copy Markdown
Collaborator

Closes #248 (slice 1 of three vertical slices).

Summary

  • Replaces .sandcastle/main.ts's label-gated issue runner with a Droid-style Missions orchestrator backed by apps/missions/ (Convex --local).
  • 6 modules in .sandcastle/missions/ (behaviour in orchestrator.ts + scheduler.ts; rest is glue) plus a portable mission-plan Claude Code skill.
  • Worker role is a stub that appends to README and commits; reviewer/fixer/validator/replanner explicitly throw "not implemented in slice 1" and land in slices 2–3.
  • Root CI now typechecks .sandcastle/ so future orchestrator regressions don't slip through.

Verification

  • bun run ci clean (turbo typecheck + tests across 7 packages, .sandcastle/ typecheck, biome, no-suppressions).
  • convex-test covers create/pause/resume/replanMilestone (7 tests in apps/missions/).
  • bun:test covers schema (6), scheduler (8), status-view (7).
  • Local-Convex smoke: mission plan --apply, mission status, mission pause, mission resume all work end-to-end.
  • Manual smoke (deferred to reviewer): bun run convex:dev in one terminal, bun run mission plan --apply <plan.json> then bun run mission run in another. Confirms the stub worker creates a real branch, commit, and PR; status table reflects each transition. Skipped here because it creates a real PR.

Test plan

  • Boot bun run convex:dev; check apps/missions/.env.local for CONVEX_URL.
  • Set CONVEX_URL in .sandcastle/.env.
  • Apply the plan in /tmp/smoke-plan.json (or write your own).
  • bun run mission run; expect a branch + commit + PR opened, status table goes todo → running → review → done.
  • Pause mid-run on a multi-feature plan; expect orchestrator to finish in-flight feature and exit.

Notes

  • apps/missions/convex/_generated/ is committed so fresh clones typecheck without first booting convex dev. Standard Convex pattern.
  • .sandcastle/CLAUDE.md is unchanged; AFK-rules still apply when an agent runs slice-1's CLI.
  • Slice 2 swaps the stub worker for real Sandcastle agent invocation; the runAgent({ role, ... }) shape is designed so the swap doesn't restructure the orchestrator.

DaveHudson added 2 commits May 7, 2026 13:54
Replaces the label-gated `.sandcastle/main.ts` issue runner with a
Droid-style Missions orchestrator backed by a local Convex deployment.

This is the first of three vertical slices. The worker role in
`run-agent.ts` is a stub that appends a marker to README.md and pushes
a commit; reviewer/fixer/validator/replanner are explicitly not
implemented yet (slices 2 and 3). The point of this slice is to land
the spine — schema, scheduler, CLI, planner, status table, orchestrator
state transitions, PR creation — without the additional uncertainty of
real agent behaviour.

What's in:

- `apps/missions/`: new turborepo package hosting the Convex schema
  (missions, milestones, features, runs, events) plus typed mutations
  and queries. Runs `convex --local` for v1; commit `_generated/` so
  fresh clones typecheck without booting the dev server. `convex-test`
  covers the create/pause/resume/replan paths.
- `.sandcastle/missions/`: 6 modules. `orchestrator.ts` (state machine
  + Convex client) and `scheduler.ts` (dep + path-conflict resolution)
  carry the behaviour; the rest is glue. `bun:test` coverage on
  schema, scheduler, status-view.
- `.claude/skills/mission-plan/`: portable planner skill, invokable
  interactively (`/mission-plan`) or headlessly via the CLI shim.
- `.sandcastle/main.ts`: replaced with a CLI dispatcher
  (`plan`/`run`/`status`/`pause`/`resume`).
- `package.json`: `mission` script (was `sandcastle`); `convex:dev`
  script; root `convex` + `picomatch` deps; root `typescript`
  devDependency for the new sandcastle typecheck step.
- Root CI now also typechecks `.sandcastle/` — previously only
  workspace packages were typechecked, so orchestrator regressions
  could ship.

What's out (deleted): `eligibility.ts`, `issue.ts`, `github.ts`,
`implement-prompt.md`, `implement-docs-prompt.md`, `review-prompt.md`.
The Ready-column flow is gone.

Verification: `bun run ci` clean (typecheck across 7 packages + tests
+ sandcastle typecheck + biome + no-suppressions). Smoke-tested
plan/status/pause/resume against local Convex; `mission run` deferred
to the manual smoke since it creates a real PR.
…plan files

`bun run mission` runs from the repo root, so Bun's built-in dotenv loader
never reads `.sandcastle/.env`. Result: `CONVEX_URL` (and any other env
the orchestrator needs) is missing and the CLI fails with "Missing
required environment variable" even though the var is configured.

Fix: load `.sandcastle/.env` explicitly inside `main.ts` based on the
script's own location, so the CLI works regardless of CWD. Existing
process env still wins over file values, matching standard dotenv
behaviour.

Also:
- gitignore + biome-exclude `smoke-*-plan.json` and `mission-plan-*.json`
  so local smoke-test plan files don't pollute formatter output or get
  committed.
- Include the Convex `ai-files` artefacts that `convex dev --local`
  installed into `apps/missions/` (AGENTS.md, CLAUDE.md, convex.json,
  _generated/ai/, skills-lock.json). They're stable Convex-shipped
  guidelines that improve agent quality when editing this package.
@DaveHudson DaveHudson closed this May 8, 2026
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.

Missions slice 1: end-to-end spine with stub worker

1 participant