Skip to content

Spec: Custom-runner Arms for process Experiments #1468

Closed
6 of 6 issues completed
Closed

Description

@JacobStephens2

This was generated by AI during a grill-with-docs session.

Grilled in docs/grill-with-docs/done/1468-custom-runner-arm.md (Rounds 1–3). Decisions: ADR 0032 (a Custom runner runs inside one Trial sandbox and returns a commit and session traces), ADR 0027, ADR 0028, and ADR 0026. Research: docs/research/eval-process-arms-and-human-review.md, docs/research/process-comparison-cost-accounting.md, and docs/research/process-comparison-grading-and-evidence.md.

Problem Statement

thirdshift can compare two Process Arms—its Built-in Ticket run or Custom processes—end to end on process Eval suites (#1484, #1872). It still cannot pit a Process Arm against a setup whose orchestrator thirdshift does not run itself: an outside multi-agent skill loop, a Python or SDK scaffold, or another coding-agent framework. Running that comparison by hand (#1628) took thousands of lines of bespoke scripts, separate OS accounts for isolation, manual skill-branch tracking as prompts drifted mid-run, and custom token parsers that hit Anthropic/OpenAI cache-accounting mismatches and missed deleted round transcripts.

Solution

Add Custom runner Arms to process Experiments (ADR 0032). Either the Baseline arm, the Candidate arm, or both may name a declarative Custom runner manifest (~/.thirdshift/runners/<name>.toml or an explicit .toml file) in place of a thirdshift commit and Process.

  • Symmetric CLI and Console start: --baseline-runner and --candidate-runner select a Custom runner on process suites (--suite required; review suites and --release refused). When --candidate-runner is set, the positional <candidate> commit is omitted; when Baseline is a thirdshift build and Candidate is a Custom runner, --baseline defaults to HEAD; when both Arms are Custom runners, no thirdshift checkout or Cargo build is needed (Q1.2, Q2.1, Q2.2).
  • Frozen manifest and provenance: prepare-arms freezes the manifest and every file or skill folder it maps (into the runner bundle or into relative paths inside fresh HOME) by SHA-256, records enclosing Git repository, HEAD commit, and dirty state as provenance without refusing local uncommitted edits, pins declared Harnesses by real path and version, and checks every hash before each Trial. Optional git_exclude patterns are appended to .git/info/exclude before the Custom runner starts so runner scratch directories never leak onto HEAD or break blind pairwise review (Q1.3, Q2.3, Q3.2).
  • One Trial-wide sandbox: one bwrap sandbox inside the Trial's systemd-run memory scope encloses the Custom runner and every child process it spawns. Fresh HOME holds only declared Harness logins (with Grok serialization and multi-provider OpenCode config), Trials-only direct-SDK provider keys from [providers] in Credentials, one allowlisting HTTPS_PROXY opening only declared provider API hosts, and thin PATH wrappers ahead of pinned Harnesses that prepend each Harness's no-web-search switch (Q1.4, Q2.4).
  • Unattended commit and result contract: the Custom runner receives version-1 request.json, runs strictly unattended with no simulated user, commits its final change on HEAD, and writes version-1 result.json (delivered, stopped_to_ask, failed, or void limited to session_unavailable, usage_limit, rate_limit). Outer supervision keeps precedence; runner crashes or missing result.json without outer Void evidence record that Trial as failed rather than aborting the Experiment (Q1.5, Q1.7, Q2.5).
  • Unified OTLP session traces and accounting_gap checks: Custom runners either wrap CLI calls with the in-sandbox record_command (--role <role>, giving live streaming and mid-Trial 85% quota stops) or write sessions.json listing raw Harness streams and/or direct-SDK records with explicit uncached_input_tokens. thirdshift converts every session into OTLP .logs.jsonl and .spans.jsonl priced solely from the Experiment's frozen price table, voids Trials whose transcripts contain web-search tool calls, and voids Trials as accounting_gap whenever outbound proxy traffic or Harness wrapper runs exceed recorded sessions (Q1.6, Q2.6).
  • Smoke-testing before 60 Trials: thirdshift evals check-runner <name-or-file.toml> [--suite <suite> --task <task>] (and its Console API twin) validates a Custom runner statically or runs one sandboxed Trial dry run with code checks and accounting outside Experiment storage (Q3.1).

User Stories

  1. As the Day shift, I want to pit thirdshift's Built-in Ticket run against a Custom runner on a process Eval suite, so that I can test an outside agent workflow with the same code Graders, Grader panel, and blind pairwise review.
  2. As the Day shift, I want to use a Custom runner as the Baseline arm, the Candidate arm, or both, so that I can also test an edit to an outside workflow against an earlier version of itself without building thirdshift.
  3. As the Day shift, I want --candidate-runner to omit the positional <candidate> commit and default --baseline to HEAD when Baseline is a thirdshift build, so that starting a comparison does not require an unused commit argument.
  4. As the Day shift, I want code-review suites, spec-review suites, --release, and conflicting --*-process, --*-harness, --*-model, or --*-effort flags on the same Arm refused before dispatch when a Custom runner is named, so that invalid combinations fail immediately.
  5. As the Day shift, I want a Custom runner defined in a .toml manifest under ~/.thirdshift/runners/ or by file path, so that multi-provider setups stay repeatable and readable.
  6. As the Day shift, I want every script and skill directory listed in a Custom runner manifest frozen by SHA-256 before the first Trial and verified before every Trial, so that editing files on the host mid-Experiment cannot silently alter later Trials.
  7. As the Day shift, I want frozen files mapped either into the runner's bundle directory or into relative paths inside fresh HOME (rejecting .. and absolute targets), so that skills expected in ~/.claude/skills/ or ~/.agents/skills/ work inside the sandbox without copy boilerplate.
  8. As the Day shift, I want prepare-arms to record the enclosing Git repository, HEAD commit, and dirty flag for frozen source paths without refusing uncommitted edits, so that local skill experiments stay fast while retaining full provenance.
  9. As the Day shift, I want optional roles (role -> { model, effort }) recorded in the Arm record for human inspection while pricing still comes from observed session Models, so that Experiment reports document what each role was configured to run.
  10. As the Day shift, I want Setup to record runner and runner_digest with commit and harness nullable, so that Experiment resume, per-Arm cost estimates from past Experiments, Trial Peek, and post-submission pairwise reveal identify Custom-runner Arms accurately.
  11. As the Day shift, I want optional git_exclude patterns in the manifest appended to .git/info/exclude before launch and checked against HEAD afterward, so that in-worktree scratch directories cannot leak into blind pairwise diffs.
  12. As the Day shift, I want the whole Custom runner and its child processes enclosed in one bwrap sandbox and systemd-run memory scope, so that an outside orchestrator has the same filesystem, time-safety, and memory boundary as native Process Trials without separate OS accounts.
  13. As the Day shift, I want only the logins for declared harnesses and Trials-only [providers] API keys from Credentials placed inside the sandbox (recording a session_unavailable Void Trial when one is missing), so that undeclared credentials and ambient shell variables are never exposed.
  14. As the Day shift, I want HTTPS_PROXY inside the sandbox to allow only the union of declared Harnesses' and providers' API hosts, blocking GitHub and general web hosts, so that the Custom runner cannot read the shipped fix from the network.
  15. As the Day shift, I want thin PATH wrappers ahead of pinned Harness binaries to prepend each Harness's no-web-search switch and any web-search tool call in a transcript to void the Trial, so that provider-hosted web search cannot leak public fixes over allowed API hosts.
  16. As the Day shift, I want a Custom runner's declared Harnesses and direct-SDK providers included in the Grader panel's Arm families, so that same-family panel seats withhold their votes and stand-in family checks hold before Trials begin.
  17. As the Day shift, I want the Custom runner invoked with a versioned request.json and graded on committed HEAD plus result.json, so that binary changes, renames, and multi-commit branches flow into code Graders and Pair evidence without patch-application failures.
  18. As the Day shift, I want Custom runner Trials to run strictly unattended with stopped_to_ask counted as a failed Score and tallied beside the Verdict, so that neither Arm receives extra help on ambiguous Tickets.
  19. As the Day shift, I want a Custom runner crash, missing result.json, or invalid self-reported outer void_cause recorded as a failed Trial (with exit status and stderr in cause) rather than aborting the whole Experiment, so that one broken task does not ruin a 60-Trial overnight run.
  20. As the Day shift, I want an optional in-sandbox record_command (--role <role>) that streams supported Harness CLIs live into the Trial's session folder, so that multi-session CLI runners get mid-Trial 85% quota pauses and cannot accidentally delete finished session files.
  21. As the Day shift, I want sessions.json to accept both raw Harness JSONL streams and direct-SDK records with explicit uncached_input_tokens, converted into OTLP .logs.jsonl and .spans.jsonl and priced from the Experiment's frozen price table, so that Anthropic and OpenAI cache conventions are never confused and every Experiment view reads one trace format.
  22. As the Day shift, I want Trials where outbound provider proxy traffic or Harness wrapper runs occurred without matching recorded sessions voided as accounting_gap, so that omitted or deleted sub-agent sessions never produce artificially cheap $0.00 Trials or skip leak checks.
  23. As the Day shift, I want thirdshift evals check-runner (statically or on a single --suite and --task) and its Console API twin, plus baseline_runner and candidate_runner on Console Experiment start, so that I can smoke-test a new Custom runner quickly and run it from either the CLI or the Console.

Implementation Decisions

  • Arm definition and Setup schema (format 13). An Arm is either a thirdshift build or a Custom runner, never both. Setup makes commit and harness nullable (null on a Custom-runner Arm) and adds runner (manifest name) and runner_digest (SHA-256 over the frozen manifest and mapped files). Serialized Setup continues to key per-Arm cost history and Experiment resume checks.
  • Suite and CLI validation. Whenever either Arm uses a Custom runner, --suite is required and every named suite must be a process suite; code-review suites, spec-review suites, --release, and per-Arm --*-process, --*-harness, --*-model, --*-effort, or commit arguments on the Custom-runner Arm are refused before dispatch. When Baseline is a thirdshift build and Candidate is a Custom runner, --baseline defaults to HEAD; when both Arms are Custom runners, neither a thirdshift Git worktree nor Cargo build is required.
  • Custom runner manifest and freezing. Looked up under ~/.thirdshift/runners/<name>.toml or as an explicit .toml path. Declares command = [...] (argv, no shell splitting), files (frozen by SHA-256 into runner_dir or mapped to validated relative paths inside fresh HOME), harnesses (pinned by real path and --version, with <provider>/<model> or alias entries where OpenCode or Kimi needs host resolution), providers (direct-SDK provider names from the proxy host catalogue), optional roles (role -> { model, effort }), and optional git_exclude patterns. Enclosing Git worktree origin/path, HEAD commit, and dirty boolean are recorded in the Arm record for source paths without blocking uncommitted edits. Every frozen file's SHA-256 is verified before each Trial.
  • Single Trial sandbox, Credentials, and web-search wrappers (ADR 0032). Credentials gains a Trials-only [providers] table for direct-SDK keys. One Trial-wide bwrap sandbox (inside the Trial's systemd-run memory scope) encloses the Custom runner and its child processes with fresh HOME, logins only for declared harnesses (acquiring the Grok lock when grok is declared and constructing multi-provider OpenCode config with web tools denied when opencode is declared), [providers] API keys only for declared providers, one allowlisting HTTPS_PROXY for the union of declared provider API hosts, and thin PATH wrappers ahead of pinned Harness binaries that prepend each Harness's no-web-search switch while preserving stdin, stdout, stderr, and exit status. Declared Harnesses and providers union into arm_families for the Grader panel.
  • Execution contract (request.json and result.json, version 1). Before launch, git_exclude patterns are appended to .git/info/exclude alongside .thirdshift-issue.md. request.json supplies version, repository, issue_file, issue_url, base, branch, runner_dir, output_dir, and record_command. Outer supervision (interrupted, sandbox_unavailable, memory_cap, host_killed, live usage_limit, timeout -> failed) keeps precedence. Missing/unreadable result.json, nonzero exit without a valid result.json, claiming an outer void_cause, or committing a path matching git_exclude on HEAD marks the Trial failed (with exit status and stderr in cause) without aborting the Experiment. Self-reported void_cause values in result.json are restricted to session_unavailable, usage_limit, and rate_limit. Uncommitted working-tree files are ignored by grading (noted in diagnostics).
  • Session conversion and accounting_gap. Custom runners record sessions either live via record_command --role <role> -- <harness> ... (enabling live 85% quota monitoring) or post-run via output_dir/sessions.json entries for raw Harness streams ({ role, harness, stream_file, started_at, ended_at }) and direct-SDK sessions ({ role, transcript_file, started_at, ended_at, models: { <model>: { uncached_input_tokens, cache_read_tokens, cache_write_tokens, output_tokens } } }). Both convert into OTLP .logs.jsonl and .spans.jsonl in the Trial's session folder, priced solely from the Experiment's frozen prices.json (converting uncached_input_tokens into cache-inclusive Measurement.input_tokens for pricing). Any web-search tool call in normalized transcripts voids the Trial. HTTPS_PROXY and PATH Harness wrappers count outbound provider connections and non-probe Harness runs; if provider traffic occurred (or a runner with declared harnesses/providers ended delivered or stopped_to_ask) with zero recorded sessions—or fewer Harness session entries than Harness runs that crossed the proxy—the Trial is voided as accounting_gap.
  • evals check-runner and Console parity (ADR 0026). thirdshift evals check-runner <name-or-file.toml> [--suite <suite> --task <task>] validates the manifest, files, Harnesses, logins/[providers] keys, and roles Models statically, or runs one standalone Trial dry run with grading and accounting outside Experiment storage when --suite and --task are given. Console API parity adds /api/v1/evals/check-runner and extends /api/v1/start (experiment) with baseline_runner and candidate_runner, while Experiment detail, Trial Peek, and pairwise reveal render nullable commit/harness and Custom runner provenance cleanly.

Testing Decisions

  • Test external behaviour through existing CLI and HTTP boundaries: Experiment JSON output, Verdicts, Void and failure classifications, evals prepare-arms and evals check-runner JSON, Console API parity, and HTML/JSON rendering before and after pairwise submission.
  • Seams:
    1. thirdshift experiment ... --json, thirdshift evals prepare-arms, and thirdshift evals check-runner --json through the Experiment test fixture, using fake Custom runner scripts, fake Harness scripts, and a loopback provider server behind HTTPS_PROXY (running inside real bwrap when available and THIRDSHIFT_TRIAL_NO_SANDBOX otherwise).
    2. Console HTTP and parity tests covering /api/v1/start (experiment), /api/v1/evals/check-runner, /experiments/<id>, Trial Peek, and /experiments/<id>/pairs/<pair>.
  • Prior art: the process Experiment tests, sandbox and accounting Experiment tests, Arm preparation tests, and the Console's experiments, pairwise, start, and api parity tests.

Out of Scope

  • Running Custom runners on code-review or spec-review Eval suites, or as top-level factory Commands (Ticket run, Review run, etc.).
  • Container-per-runner packaging (Harbor BaseInstalledAgent images).
  • Simulated-user Q&A turns when a Custom runner stops to ask a question.
  • Trusting runner-reported USD figures instead of pricing tokens from the Experiment's frozen price table.

Further Notes

Sub-issues

Sub-issues

6 of 6 Issues completed
Loading 6 sub-issues

Activity

  1. added
    enhancement
    needs-triage
    on Oct 27, 2026
  2. JacobStephens2 commented on Oct 27, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Triage notes

    What we've established so far:

    • Comparing two sets of Factory skills already works. An Arm is a thirdshift build at a commit, and the build carries its Factory skills inside it. A Candidate commit with different skills/thirdshift-* content is a skill-set comparison today, on the Eval suites those skills select.
    • Home skills can't be compared. Trials run with a fresh home, so ~/.thirdshift/skills never reaches them.
    • Custom processes can't be compared. A Trial runs one session of one kind, and no Trial runs a process.
    • Open question 2 is answered: yes. Comparing an implement→review path with a maker-checker TDD path needs implement Eval tasks, which is Spec: process Trials and a code-graded implement Eval suite #1484.
    • Open question 3 is answered by Spec: judge Experiments only on discriminating Eval tasks #1477. A process comparison's Verdict counts only once its suite has enough discriminating Eval tasks. Below 20, the suite is an Advisory suite.

    Still open, and for #1484's grill: should an Arm be defined by a Custom process, or by a mapping of skill names onto a fixed build? A process Arm only means something on implement Eval tasks, so this waits on #1484.

    Stays needs-triage, blocked by #1484.

  3. JacobStephens2 commented on Oct 28, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during a grill-with-docs session.

    A first concrete case for this issue, from Jacob: compare thirdshift's Built-in processes, run with the Factory skills, against a contractor's process. The contractor proposes their process as having better verification and better code quality. It uses different skills, a different number of code reviews, different code-review skills, and a lot of multi-family (cross-family) review.

    What the process files will give this, per the grill in docs/grill-with-docs/more-built-in-processes.md:

    • The Spec, Architect and Security runs become Built-in process files, alongside ticket-run, so the two processes can be compared side by side as files first.
    • Steps that start child runs (run-published-issue, and a new land-tickets for Spec runs) take a process setting, so a copied Spec run can send every Ticket through the contractor's Ticket process.
    • Every Command records its Process's name, Built-in or Custom, and a hash of the file, so Scores can later be grouped by Process.

    The next blocker is #1531: the code review runs inside the implement session, so a copy of ticket-run can't yet change the number, skills or model family of its reviews.

  4. added a commit that references this issue on Oct 29, 2026
  5. JacobStephens2 commented on Nov 3, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Triage notes

    The concrete case from the last comment has now been run by hand, outside thirdshift: ten paired live runs, with the Ticket run as one Arm and a contractor's maker-checker TDD process as the other, graded blind. These are the findings that bear on defining an Arm as a whole process. Results stay private; only the lessons about Arms are here.

    What we've established so far:

    • Neither a Custom process nor a skill mapping could have held the other Arm. Its orchestrator was itself an agent, choosing from a skill which role to start next, how many verification rounds to run and when to stop. Its runs used anywhere from 4 to 72 sessions. A process file fixes its Steps in advance, so it can't express a dispatcher that improvises. That suggests a third kind of Arm besides a build and a Custom process: an external runner, a pinned command that takes an Eval task's repository and issue and returns a branch, its session traces and their usage. thirdshift treats the runner as a black box and grades only what comes out.
    • A process Arm has to pin far more than its file. The other Arm's skills lived on unmerged branches that moved dozens of commits in a few days, and its choice of orchestrator harness was left open by the skills. An Arm record needs the process file's hash, plus the commit of every skill it loads, each Harness's path and version (as evals prepare-arms already records), the model and effort per role, and the orchestrator's harness.
    • Isolation has to cover every child session. A process Arm starts sessions on more than one provider, each needing its own login, and every one must stay inside the Trial's sandbox. A Trial's fresh home covers one session today. We kept the Arms apart with one OS account and one repository per Arm.
    • A process Arm needs a rule for questions to a human. In unattended runs, the other Arm twice stopped to ask a fair planning question and produced no pull request. A Score needs to tell "stopped to ask" apart from "failed", and the Arm definition should say whether questions are auto-answered, answered from a brief, or recorded as no delivery.
    • Cost and time need per-session, per-role accounting. One Trial is many sessions across providers. Pricing each session's tokens with a dated price table, and labelling each by role, was the only way to see where the cost went. Most of it went to planning and verification before any production code. The number of sessions per Trial was itself one of the clearest differences between the Arms.
    • A Trial costs far more for a multi-session Arm. That makes Spec: judge Experiments only on discriminating Eval tasks #1477's minimum of 20 discriminating Eval tasks with 6 Trials each expensive. The cost estimate shown before Trials should come per Arm, from that Arm's own history. A first process comparison will likely be an Advisory suite.
    • The grading evidence that worked was the cross-test. Running each Arm's tests against the other Arm's code showed defects that diffs and CI alone did not. Also useful: blind Graders from two model families, each reading both presentation orders, and a blind human merge call per pull request. Each Grader was the same model as one Arm. Their preferences pointed the way self-preference would predict, but eight pairs can't establish it, or tell same-family from same-model preference. The Graders and the human valued different things. Mutation testing added nothing, because its scope didn't reach the changed code. Evidence had to be capped, because one Harness refuses prompts over 1 MiB.
    • Implement Eval tasks need a leak check. The tasks were closed issues with a shipped fix and explicit acceptance criteria (only 10 of 24 candidates had explicit criteria). Every Trial's traces were searched for the shipped fix. Spec: process Trials and a code-graded implement Eval suite #1484 will need the same check.

    Answer to the open question, for #1484's grill: both, plus a third kind. A Custom process (once #1531 splits out the review) suits thirdshift-native alternatives. A skill mapping onto a fixed build suits swapping skills only. A process with its own orchestrator needs an external-runner Arm.

    Stays needs-triage, blocked by #1484.

  6. added
    ready-for-human
    and removed
    needs-triage
    on Nov 9, 2026
  7. changed the title [-]Experiments: compare two skill sets or Custom processes as Arms[/-] [+]Experiments: an external-runner Arm for processes thirdshift doesn't run itself[/+] on Nov 9, 2026
  8. JacobStephens2 commented on Nov 9, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during a grill-with-docs session.

    #1484's grill (docs/grill-with-docs/1484-implement-suite.md, Q2.1, Q3.3, Q4.4) answered most of this issue:

    What's left here is the external-runner Arm: a pinned command that takes an Eval task's repository and Ticket and returns a branch, its session traces and their usage, for a process whose orchestrator is itself an agent. docs/research/eval-process-arms-and-human-review.md §2 suggests shaping it like Harbor's agent interface, without taking Harbor as a dependency. It waits until an Experiment needs to compare thirdshift against an outside process.

    Stays needs-triage, blocked by #1484.

  9. changed the title [-]Experiments: an external-runner Arm for processes thirdshift doesn't run itself[/-] [+]Spec: Custom-runner Arms for process Experiments[/+] on Nov 14, 2026
  10. 10 remaining items

  11. JacobStephens2 commented on Nov 14, 2026

    @JacobStephens2
    OwnerAuthor

    This comment was generated by AI.

    thirdshift's Run on this issue failed, so it waits for the Day shift.

    Put ready-for-agent back to retry.

  12. added
    ready-for-agent
    in-progress
    agent-failed
    and removed
    agent-failed
    ready-for-agent
    in-progress
    on Nov 14, 2026
  13. JacobStephens2 commented on Nov 14, 2026

    @JacobStephens2
    OwnerAuthor

    This comment was generated by AI.

    thirdshift's Run on this issue failed, so it waits for the Day shift.

    Put ready-for-agent back to retry.

  14. added
    ready-for-agent
    in-progress
    and removed
    agent-failed
    ready-for-agent
    on Nov 14, 2026
  15. removed
    in-progress
    on Nov 15, 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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions