Repository navigation
Description
This was generated by AI during triage.
Problem Statement
thirdshift's deterministic control flow outside the agent loop is implemented in Rust (ADR-0001), giving it a single self-contained static binary with embedded Factory skills, data-carrying enums with exhaustive match, and stateright model-checking of the Pickup reservation protocol (ADR-0017). However, compiling and linking the Rust crate and test suite inside fresh worktrees is a recurring bottleneck, and subprocess, signal, and sync/async bridging require significant ceremony. Without a concrete vertical-slice prototype in Go, the Day shift cannot empirically compare fresh-worktree build and test times, subprocess/signal ergonomics, compile-time state-machine exhaustiveness alternatives, and reservation protocol verification against the Rust binary.
Solution
Build an isolated Go vertical-slice prototype of thirdshift's core unattended loop (embedded Factory skills, a Ticket run with Worktree, Harness process-group management, Delivery and CI Repair loop, and a Pickup run with the ADR-0017 reservation protocol and an in-test state-space model checker) and run a reproducible benchmark and architectural comparison against the Rust binary, recording the findings in a research report for the Day shift.
User Stories
- As the Day shift, I want the Go prototype isolated in its own directory and test-selection boundary, so that ordinary Rust Ticket runs and CI jobs are unaffected when the prototype is not touched.
- As the Day shift, I want the Go prototype to compile into a single static Linux executable (
CGO_ENABLED=0) with the Factory skills embedded, so that it meets the same self-contained deployment contract as the Rust binary (ADR-0001,ADR-0003). - As the Day shift, I want the Go prototype to run a Ticket run from an Issue URL—performing pre-flight checks, applying a Claim (
in-progress), creating a Worktree with linked Factory skills, and running a Harness session—so that the core issue-to-branch flow can be evaluated end-to-end. - As the Day shift, I want the Go prototype's Harness runner to parse streaming JSON events and escalate
SIGINT,SIGTERM, andSIGKILLacross the child process group on interruption, so that Go'sos/execand signal handling can be compared directly against the Rust runner. - As the Day shift, I want the Go prototype's Ticket run to drive Delivery, watch CI checks, and run bounded Repair sessions when checks fail or the branch conflicts with the Base branch, so that unattended Delivery state transitions are exercised in Go.
- As the Day shift, I want the Go prototype's Run, Claim, and CI state transitions enforced with sealed-interface or enum-exhaustiveness linting, so that I can evaluate how closely Go can approximate Rust's data-carrying
enums and exhaustivematch. - As the Day shift, I want the Go prototype to implement a Pickup run that selects the lowest-numbered Ready issue, reserves it on
originusing theADR-0017protocol, and dispatches a Ticket run, so that multi-host Pickup coordination can be evaluated in Go. - As the Day shift, I want an in-test bounded state-space model checker in Go that verifies the
ADR-0017Pickup reservation invariants (one dispatch per Ready generationandone claimed dispatch per Ready generation) and demonstrates failure on the simpler unguarded protocol variants, so that Go's verification story can be compared directly againststateright. - As the Day shift, I want a reproducible benchmark runner and a written comparison report measuring cold and incremental worktree build/test times, binary size, code size, subprocess ergonomics, state-machine exhaustiveness, and model-checking trade-offs against the Rust binary, so that I can make an informed decision on
ADR-0001.
Implementation Decisions
- Prototype isolation and affected-test routing: The Go prototype lives in its own isolated prototype directory with its own Go module and toolchain configuration. The repository's affected-test selector routes changes confined to the Go prototype directory to
go testin that directory without running the full Rust suite, and ordinary Rust changes do not require or run the Go prototype suite. - Single binary with embedded Factory skills: The prototype embeds the repository's Factory skills using Go's native embedding (
embed.FS) and links them into each created Worktree while excluding them from git status, matching the Rust binary's behavior. - State-machine modeling in Go: Run outcomes, Claim states, Delivery states, and CI check states are modeled explicitly using Go patterns for closed sum types (sealed interfaces with unexported marker methods and/or typed enums checked by an exhaustiveness check in tests/linting) so that missing state branches are caught automatically.
- Subprocess and signal lifecycle: Child Harness sessions,
git, andghinvocations run undercontext.Contextcancellation and process-group management (SysProcAttr), escalatingSIGINT→SIGTERM→SIGKILLon interruption. - Pickup reservation and bounded model checker: Pickup implements the
ADR-0017origin-ref reservation and Claim protocol. A dedicated Go test implements a deterministic breadth-first state-space explorer over competing hosts, Day shift label edits, and crashes, checking the same safety properties and negative protocol variants as the Ruststaterightmodel. - Empirical benchmark and research report: A benchmark script measures cold build, incremental build, and test execution wall-clock times in a fresh worktree, static binary size, and source line counts against the equivalent Rust modules, writing a structured comparison report to the research documentation directory without modifying
ADR-0001.
Testing Decisions
- Primary testing seam: End-to-end CLI tests exercise the compiled Go prototype binary (or its top-level entrypoint) against temporary git repositories (
originand clone) and fakeghand Harness executables onPATH, asserting on observable state (git branches/commits, worktree contents, fakeghrecorded label/PR calls, exit codes, and output) rather than internal helpers. - Process-group signal test: An integration test starts a fake Harness that spawns a child process, interrupts the Go Ticket run, and verifies that both the Harness and its child receive the signal escalation and terminate cleanly.
- Bounded model-checking test:
go testruns the bounded BFS state-space checker for theADR-0017Pickup protocol, asserting that the current protocol satisfies both safety invariants across multi-host interleavings and that the simplified protocol variants produce minimal counterexample traces. - Benchmark and report verification: Tests verify that the benchmark runner executes cleanly and that the comparison report covers all required evaluation axes.
Out of Scope
- Porting the Console, Security run, Architect run, Review run, Fix run, Triage run, or Experiments/Evals to Go.
- Replacing the production Rust binary or modifying
ADR-0001inside this Spec. - Supporting Harnesses beyond a representative streaming JSON Harness in the prototype vertical slice.
Activity
[-]Prototype a Go vertical slice of thirdshift and compare against the Rust binary[/-][+]Spec: Go vertical-slice prototype and comparison against the Rust binary[/+]