Skip to content

Spec: Go vertical-slice prototype and comparison against the Rust binary #1830

Closed
4 of 4 issues completed

Description

@JacobStephens2

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

  1. 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.
  2. 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).
  3. 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.
  4. As the Day shift, I want the Go prototype's Harness runner to parse streaming JSON events and escalate SIGINT, SIGTERM, and SIGKILL across the child process group on interruption, so that Go's os/exec and signal handling can be compared directly against the Rust runner.
  5. 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.
  6. 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 exhaustive match.
  7. As the Day shift, I want the Go prototype to implement a Pickup run that selects the lowest-numbered Ready issue, reserves it on origin using the ADR-0017 protocol, and dispatches a Ticket run, so that multi-host Pickup coordination can be evaluated in Go.
  8. As the Day shift, I want an in-test bounded state-space model checker in Go that verifies the ADR-0017 Pickup reservation invariants (one dispatch per Ready generation and one claimed dispatch per Ready generation) and demonstrates failure on the simpler unguarded protocol variants, so that Go's verification story can be compared directly against stateright.
  9. 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 test in 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, and gh invocations run under context.Context cancellation and process-group management (SysProcAttr), escalating SIGINT → SIGTERM → SIGKILL on interruption.
  • Pickup reservation and bounded model checker: Pickup implements the ADR-0017 origin-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 Rust stateright model.
  • 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 (origin and clone) and fake gh and Harness executables on PATH, asserting on observable state (git branches/commits, worktree contents, fake gh recorded 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 test runs the bounded BFS state-space checker for the ADR-0017 Pickup 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-0001 inside this Spec.
  • Supporting Harnesses beyond a representative streaming JSON Harness in the prototype vertical slice.

Activity

  1. added
    enhancementNew feature or request
    and removed on Nov 6, 2026
  2. changed the title [-]Prototype a Go vertical slice of thirdshift and compare against the Rust binary[/-] [+]Spec: Go vertical-slice prototype and comparison against the Rust binary[/+] on Nov 6, 2026
  3. added
    ready-for-agentFully specified, ready for an AFK agent
    in-progressA Claim: thirdshift has taken this issue
    and removed
    needs-triageMaintainer needs to evaluate this issue
    ready-for-agentFully specified, ready for an AFK agent
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions