Schema migration + round-start/instruction-query runner endpoint #427
Labels
No labels
P0
P1
P2
P3
bug
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#427
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#427 Schema migration + round-start/instruction-query runner endpoint
(open)
@jared created 2026-08-18 14:31
#427 Schema migration + round-start/instruction-query runner endpoint
(open)
@jared created 2026-08-18 14:31
Parent
#425
Map: #425
What to build
A Sequel migration on the existing per-project runner SQLite database adding
implementations, agents, and handoffs tables and extending dispatches with
received/created handoff FKs and lifecycle timestamps, plus a new Thor
command on the runner CLI that opens a round (creating an implementation
row, stamping abandoned_at on any prior unfinished implementation for the
session) and answers instruction queries from derived state. The query path
is idempotent: repeated queries never create dispatch rows or mutate state
(query/command split — today's advance path creates Dispatch rows
unconditionally). One JSON object on stdout; usage errors exit 3, matching
existing runner CLI conventions. State contract: implementation active when
completed_at and abandoned_at are both null; latest row per session is
current; an event state cannot explain fails loudly per ADR-0108.
Acceptance criteria
[ ] migration applies cleanly to an existing runner DB
[ ] CLI tests (Thor commands + synthetic JSON in, emitted JSON + SQLite rows
asserted — the single test seam) cover round open, prior-round abandonment,
idempotent re-query, and the loud-stall response
[ ] no hooks changed yet
Blocked by
#426
Origin
• Trigger: /to-tickets skill on #425 spec
• Improvised this session: none
• Chain: #425 (DESIGN — spec of #425) ← decomposed via /to-tickets user
approval 2026-08-18
• Root candidate: none (this is a decomposition task)
Resolution
Done: Inline Sequel migration adds implementations (session_id, completed_at, abandoned_at), agents (name), handoffs tables and extends dispatches with received_handoff_id/created_handoff_id FKs + dispatched_at/completed_at, all via existing create_table?/ensure_column! mechanism so pre-existing DBs migrate cleanly. New Thor commands round-open (creates implementation row, stamps abandoned_at on prior unfinished round for the session) and next (pure idempotent instruction query from derived state — never creates dispatch rows or mutates; UnexplainedStateError stalls loudly, exit 3, per ADR-0108/0128). No hooks changed. Built TDD at the agreed CLI seam.
Evidence: commit
237d16c; tests: db_migration_test 4 runs/16 assertions, cli_round_open_test 4/9, cli_next_instruction_test 3/6, all green; rubocop clean on touched files (cli.rb:78 MethodLength offense pre-exists on main in untouched code)Follow-ups: none — wiring agents/handoffs rows and the new dispatch columns is already scoped to later chain tickets (#428+); pre-existing recovery_status/tea_tracker individual-run NameErrors predate this change and are out of map scope