Skip to content

Spec: thirdshift release Command and Pass for scheduled and on-demand releases #2054

Closed
6 of 6 issues completed

Description

@JacobStephens2

Settled in a grill-with-docs session (PR #2155, Q1–Q16; ADR 0003, ADR 0009, ADR 0013, ADR 0026). Subsumes #336 and #653.

Problem Statement

Cutting a release of thirdshift currently requires a maintainer at a Linux terminal to pick a version number by hand and run an interactive shell script:

  • A Cron job cannot run releases unattended on a daily or custom schedule because the script requires an explicit version number on the command line, has no Pass mode that skips quietly when nothing shipped has changed since the last release, and loops indefinitely if candidate commits on main have completed with failing push CI.
  • Releases live outside thirdshift's Command model: they write no Command record, Command log, Session trace or Activity log entry, cannot be given a Stop, do not appear in Working, Done or Needs you in the Inbox, send no Run notification, and are invisible to Cron jobs and the Console API.
  • Although the released source comes from a freshly fetched origin/main, the shell script still invokes cargo run against the Launch directory's working tree for the summary session, release Experiment and targeted Fix run (ensure release.sh works with the latest on default branch (ensure no need to git pull locally before it runs) #336), and its summary invocation is not isolated inside the fresh-home sandbox (agy release summaries can still read local files #653).
  • Unattended Review run and Fix run Passes do not skip open release bump pull requests, risking unwanted review commits on a version-only bump branch or an early Self-merge before the release tag is published.
  • Tag publication on GitHub currently lacks a workflow check that the tagged tree is an exact version bump off origin/main pushed by the repository owner, and factory Sessions on the host are not explicitly fenced from invoking a release command or pushing tags without detection.
  • When the summary agent is unavailable, the fallback places GitHub's generated notes inside the bump pull request's summary markers, causing the release-notes job to append generated notes a second time on the GitHub Release page.

Solution

Introduce thirdshift release as a native Release run Command scoped to JacobStephens2/thirdshift, retiring the shell release script, its Python experiment helper, and the hidden release-summary CLI shim while keeping the release-notes helper invoked by GitHub Actions.

Started with no explicit version (thirdshift release, optionally with --patch, --minor or --major), a Release run is a Pass that honors the live Experiment and Quota wait gates, coordinates via a dedicated machine lock and an atomic origin reservation outside the repository's Command limit, auto-resumes recoverable unfinished releases, skips human-blocked unfinished releases, and skips quietly when no shipped-artifact or release-pipeline paths changed since the last release tag or when all candidate main commits have completed with failing push CI. When neither a version nor a bump flag is supplied, a single sandboxed, traced Session reads the merged pull requests since the last release tag, chooses minor or patch (never major), and writes the release summary, falling back to patch and non-duplicated generated notes if the Harness is unavailable. Started with an explicit version (thirdshift release <version>), it acts as a direct Command that cuts or resumes that version on demand.

Unattended Review run and Fix run Passes skip release bump pull requests, factory Sessions are refused if they invoke thirdshift release (with tag pushes and thirdshift release flagged in destructive-command signals), POST /api/v1/start exposes release behind admin scope (leaving release --review terminal-only), the release workflow verifies owner identity and an exact origin/main bump tree before publishing, and an interactive Day shift wizard script provisions the repository's Admin-only v* tag ruleset on GitHub.

User Stories

  1. As a maintainer, I want to schedule thirdshift release in a Cron job with no version argument, so that new versions of thirdshift are released automatically on a daily or custom schedule.
  2. As a maintainer, I want an unscoped Release run Pass to skip quietly with exit code 0 and no Run notification when only documentation, website, agent-skill or test files changed since the last release tag, so that scheduled runs never publish identical binaries.
  3. As a maintainer, I want a skipped Release run Pass to write to the Activity log only when its skip reason changes and to update Pass last-fired tracking on Cron jobs, so that an idle schedule stays quiet while proving the timer is firing.
  4. As a maintainer, I want thirdshift release with no version or bump flag to have the configured Harness choose minor or patch and write the release summary in a single Session, so that scheduled releases get appropriate semantic versions and curated notes in one model call.
  5. As a maintainer, I want automatic Harness bump selection capped to minor or patch, so that an unattended cron run can never publish 1.0.0 or another major version without an explicit human request.
  6. As a maintainer, I want thirdshift release to fall back to a patch bump and GitHub's generated release notes when the summary Harness fails or returns malformed output, without duplicating ## What's Changed on the GitHub Release page, so that a model outage neither blocks a release nor mangles its notes.
  7. As a maintainer, I want to pass --patch, --minor or --major to thirdshift release without a version number, so that a manual or scheduled Pass can pin the bump level while still skipping when nothing shipped changed.
  8. As a maintainer, I want to pass an explicit <version> (thirdshift release <version>) higher than the version on main, so that I can cut or resume a specific version on demand even when no shipped paths changed.
  9. As a maintainer, I want <version> and --major / --minor / --patch validated as mutually exclusive, and non-X.Y.Z or non-increasing versions refused before pushing anything, so that invalid invocations fail immediately and cleanly.
  10. As a maintainer, I want thirdshift release to accept standard Command flags (--harness, --model, --effort, --email, --email-unless-merged, --no-email), so that summary model selection and Run notifications work consistently with the rest of thirdshift.
  11. As a maintainer, I want --review to print the summary and let me accept, edit in $EDITOR, or cancel on a terminal, while refusing immediately when standard input is not a terminal, so that interactive review stays available by hand and fails fast if misconfigured in cron.
  12. As a maintainer, I want --with-experiment (off by default) to run or resume the release Experiment against the last release tag before bumping, prompting release anyway? [y/N] on fail or inconclusive only on an interactive terminal and failing cleanly when unattended, so that optional release gating never hangs waiting on cron stdin.
  13. As a maintainer, I want thirdshift release to execute entirely from the running thirdshift binary against a freshly fetched origin/main in temporary detached worktrees without compiling or reading the Launch directory's working tree, so that scheduled hosts never need git pull or a clean checkout (ensure release.sh works with the latest on default branch (ensure no need to git pull locally before it runs) #336).
  14. As a maintainer, I want the release summary and bump-selection Session to run inside the fresh-home sandbox with no host filesystem read access and its Session trace recorded under the Release run, so that untrusted pull-request text cannot leak local secrets (agy release summaries can still read local files #653) and token usage, models and spans are recorded.
  15. As a maintainer, I want thirdshift release to refuse Launch directories whose origin is not JacobStephens2/thirdshift, so that running it in another repository fails safely before touching Git or GitHub.
  16. As a maintainer, I want Release run Passes to skip during a live Experiment on the machine or a Quota wait, so that releases respect machine-wide evaluation isolation and GitHub rate-limit reserves.
  17. As a maintainer, I want Release runs to coordinate via a dedicated local machine lock and an atomic origin release reservation (plus in-progress on an open bump pull request) outside the repository's Command limit, so that two Release runs never collide on one machine or across machines while active Spec runs or Ticket runs cannot starve a daily release.
  18. As a maintainer, I want unattended Review run (--author) and Fix run Passes to skip release-* pull requests targeting main, so that background Passes never push review commits onto a version-only bump branch or Self-merge a bump pull request before its tag is published.
  19. As a maintainer, I want an unscoped Release run Pass to auto-resume and recover unfinished release-<X.Y.Z> states that are machine-recoverable (a pushed branch without a PR, an open non-draft exact-bump PR waiting on CI, or an unpublished failed release workflow run) while skipping when an unfinished release is blocked on a human (such as a draft bump PR after a failed automatic Fix run or foreign commits on the branch), so that transient interruptions self-heal and genuine blockers do not spam Needs you on every cron tick.
  20. As a maintainer, I want thirdshift release to select the newest main commit descending from the last release tag that has shipped changes and green push CI, wait when candidate main commits still have push CI queued or running, and skip (in Pass mode) or fail (in direct mode) when all candidate commits with shipped changes have completed non-green push CI, so that scheduled releases neither miss an in-flight merge nor hang forever on a broken main.
  21. As a maintainer, I want thirdshift release waiting on bump PR checks to run at most one targeted Fix run (--no-merge --no-base-fix) on a merge conflict or completed failing CI, re-validate the exact version-bump tree afterward, refresh any requested Experiment and summary if the content base moved, and stop before tagging if the PR becomes a draft or remains blocked, so that normal main drift during CI recovers automatically without ever tagging unreviewed code.
  22. As a maintainer, I want a live Release run to appear in Working in the Inbox (writing periodic progress lines during CI and workflow waits so Silent detection stays accurate) and respond to thirdshift stop, so that I can monitor and stop a release from the CLI or Console.
  23. As a maintainer, I want a Release run that publishes the release and merges the bump PR to land in Done (quiet under email-unless-merged), while a Release run that fails—or publishes the release but fails to merge the bump PR—lands in Needs you and sends its Run notification even under email-unless-merged, settling once the bump PR is merged or closed, a later Release run starts or succeeds, or it receives a Dismissal.
  24. As a maintainer, I want thirdshift release to stop once the release is published and the bump PR is merged without running thirdshift update, so that releasing and host binary upgrades remain independent schedules.
  25. As a maintainer, I want POST /api/v1/start and the Console Start controls to expose release behind admin scope (refusing run-only tokens and narrowed viewers, and keeping release --review CLI-only), so that only administrators can trigger a release remotely.
  26. As a maintainer, I want thirdshift release to refuse execution when called from inside a factory Session (THIRDSHIFT_SESSION or THIRDSHIFT_PARENT_RECORD present) and destructive-command signals to flag thirdshift release and git push tag operations, so that unattended Ticket or Spec agents on the thirdshift host cannot cut releases.
  27. As a maintainer, I want the GitHub release workflow to verify on tag pushes before publishing that github.actor is JacobStephens2 and that the tagged commit's tree equals an ancestor commit on origin/main plus only the Cargo.toml and Cargo.lock version bump for that tag, so that unmerged code or non-owner tag pushes can never publish binaries to GitHub Releases or crates.io.
  28. As a maintainer, I want an interactive wizard script in the repository to configure the Admin-only refs/tags/v* tag ruleset on JacobStephens2/thirdshift (allowing tag creation and updates only by Repository Admin and blocking tag deletion), so that write collaborators cannot push release tags while unattended cron and unpublished-tag recovery under the owner account continue to work.
  29. As a maintainer, I want the user manual, generated prompts page, and hand-written site pages updated from the retired shell script to thirdshift release, so that all documentation reflects the new command and workflow.

Implementation Decisions

  • Command and Pass identity. Release run becomes a first-class Command kind across CLI parsing, Command record stages, Command log allocation, Activity log recording (including deduplicated skip reasons for the Release Pass kind), Pass last-fired timestamps, Cron jobs command recognition, Stop handling, Run metrics, Inbox evaluation, and Run notifications. Any invocation without a positional <version> (thirdshift release, --patch, --minor, --major) is a Pass; thirdshift release <version> is a direct Command.
  • Repository and session fences. Before doing Git or GitHub work, thirdshift release verifies it is running on Linux, refuses immediately if THIRDSHIFT_SESSION or THIRDSHIFT_PARENT_RECORD is set in the environment, and verifies the Launch directory's origin remote resolves to JacobStephens2/thirdshift. Destructive-command pattern detection adds patterns for thirdshift release invocations and git push commands that push tags (--tags or refs/tags/).
  • Admission, locks, and cross-Pass isolation. In Pass mode, admission checks the live Experiment gate and Quota wait gate before taking locks. Every Release run acquires a machine-local lock file under ~/.thirdshift and an atomic origin reservation ref dedicated to releases (distinct from the repository's Command limit slots), plus in-progress on the bump pull request while live: if the local lock or origin reservation is already held, a Pass skips quietly and a direct Command fails naming the active lock/reservation. Unattended Review run (--author) and Fix run Passes exclude pull requests targeting main whose head branch matches release-*; targeted thirdshift fix <pr-url> --no-merge --no-base-fix continues to work.
  • Unfinished release discovery and recovery. After locking, thirdshift release inspects origin for an unfinished release-<X.Y.Z> branch, open Release <X.Y.Z> pull request, or unpublished v<X.Y.Z> tag newer than the latest published GitHub Release:
    • In direct <version> mode, it validates and resumes/recovers that exact <version> (refusing if another unfinished version is live or if <version> is closed/invalid/human-blocked, with explicit recovery instructions).
    • In Pass mode, if an unfinished release is in a machine-recoverable state (pushed exact-bump branch without a PR, open non-draft exact-bump PR waiting on CI, or completed failed release.yml workflow with no published GitHub Release), it adopts that release (re-cutting with any higher requested bump flag when re-cutting from newer main) and completes or recovers it; if the unfinished release is human-blocked (such as a draft bump PR left by a failed targeted Fix run, non-bump commits on release-<X.Y.Z>, or an unverifiable publication state), the Pass skips naming that blocked release so cron does not repeatedly fail into Needs you.
  • Candidate main selection and shipped-path filter. For a fresh cut, thirdshift release fetches origin/main and tags, determines the last published v* release boundary on main, and scans first-parent origin/main commits descending from that tag:
    • In Pass mode, a candidate commit is eligible only if its diff from the last release tag touches at least one shipped-artifact or release-pipeline path: src/, skills/, processes/, Cargo.toml, Cargo.lock, dist-workspace.toml, rust-toolchain.toml, README.md, LICENSE, .github/workflows/release*, .github/workflows/publish-crates.yml, or scripts/release*. If origin/main has no commit touching those paths since the last tag, the Pass skips quietly.
    • Among eligible commits (all commits newer than the last tag in direct <version> mode, or shipped-change commits in Pass mode), it immediately selects the newest commit whose latest push ci.yml workflow run completed with success. If none has succeeded yet, it polls (writing periodic progress lines) as long as at least one eligible commit has a queued or running push ci.yml run. If every eligible commit's latest push ci.yml run has completed non-green with nothing pending, Pass mode skips naming the failing main CI and direct mode fails immediately.
    • A local unversioned candidate ref pins the selected content commit while an Experiment runs so an interrupted run resumes against the same content commit unless a newer release tag on main invalidates its ancestry.
  • In-process Experiment, sandboxed bump+summary Session, and fallback notes.
    • All sub-steps execute directly from the running thirdshift binary against temporary detached worktrees of fetched commits—never via cargo run on the Launch directory's checkout.
    • With --with-experiment, the release Experiment runs (or resumes) comparing the selected content commit against the prior release tag on touched Eval suites; pending rechecks or leak decisions are polled with periodic progress lines; fail or inconclusive prompts release anyway? [y/N] when stdin is a terminal and fails immediately when unattended.
    • --review is validated up front before expensive work and refused if stdin is not a terminal.
    • The release prompt moves into the compiled prompt catalog (and generated prompts page). It runs as a tool-less recorded Session inside the fresh-home bwrap sandbox (binding only Harness binary/credentials and an empty temporary directory, routed through the provider-allowlisting proxy). When no <version> or bump flag was given, the prompt supplies the merged pull requests since the last release tag and the two candidate versions (X.(Y+1).0 for minor, X.Y.(Z+1) for patch), instructing the Harness to emit minor or patch (picking minor for new CLI commands/flags, Console pages/actions, config keys or user-visible contract changes, and patch for bug fixes, edge-case hardening or internal refinements) together with the Markdown summary referencing those PRs; when <version> or --major / --minor / --patch was supplied, the version is fixed and the Session writes only the summary.
    • If the summary Session fails or returns empty/unparseable output, automatic bump selection defaults to patch, a warning is logged, and the bump PR body displays GitHub's generate-notes output outside <!-- release-summary:start --> ... <!-- release-summary:end --> (leaving the markers empty or absent) so the post-release notes job never duplicates ## What's Changed on the GitHub Release page.
  • Bump PR, targeted Fix recovery, tag push, publication wait, and merge.
    • The bump commit rewrites only Cargo.toml and Cargo.lock on top of the selected content commit, opens or updates Release <version> from release-<version> into main (carrying the <!-- release-content-base: <sha> --> marker), and waits for PR workflow runs and mergeability (300-second startup/settling grace, unbounded wait on queued/running checks, periodic progress lines).
    • On a Merge conflict or completed failing PR workflow, at most one targeted in-process Fix run (--no-merge --no-base-fix) is attempted; any adopted head must still have a Git tree identical to its origin/main merge-base plus the exact Cargo.toml/Cargo.lock bump, refreshing the requested Experiment and summary if the merge-base changed. Draft PRs or further failures stop before tagging and leave the PR open for human review.
    • Once checks pass and the PR is mergeable, v<version> is pushed on the validated bump head, release.yml is polled to completion, and Release <version> is merged into main with a merge commit matching the validated head commit. Published releases are never moved; an inconclusive GitHub Release lookup refuses rather than risking moving a published tag.
  • Inbox, Run notifications, and Console API.
    • Live Release runs appear in Working. A run that both publishes the GitHub Release and merges the bump PR ends succeeded in Done (linking the published Release; treated as cleanly merged under email-unless-merged, so saved without emailing). A run that fails before publication—or publishes the Release but fails to merge the bump PR—lands in Needs you and emails under email-unless-merged, settling when the bump PR merges/closes, a later Release run starts or succeeds, or the row is dismissed.
    • POST /api/v1/start and Console Start controls add release (supporting optional version, bump mode major/minor/patch, and with_experiment, plus standard Harness and email fields) gated by admin scope rather than run scope. release --review is registered as a reasoned CLI-only exclusion in parity checks and ADR 0026; --release-summary and the retired shell/Python release scripts are removed (keeping scripts/release-notes.sh for .github/workflows/release-notes.yml).
  • Workflow publication guard, tag-ruleset wizard, and docs.
    • The release workflow generator adds processes/** to RELEASE_PATHS and injects a tag-push guard ahead of artifact publication (host and publish-crates) verifying github.actor == 'JacobStephens2' and verifying that the tagged commit's Git tree equals a commit reachable on origin/main with only Cargo.toml and Cargo.lock set to the tag's version; .github/workflows/release.yml is regenerated.
    • An interactive bash wizard script walks a maintainer through creating/verifying the refs/tags/v* GitHub repository ruleset on JacobStephens2/thirdshift (restricting tag creation and updates to Repository Admin and blocking tag deletion).
    • Generated prompts, the user manual (#releasing), and the hand-written site pages (index.html, how-it-works, architecture) are updated to describe thirdshift release in place of scripts/release.sh.

Testing Decisions

  • Good tests exercise observable behavior through the binary, HTTP API, crontab inventory, and workflow generator rather than internal helper functions.
  • Primary seam — thirdshift release black-box CLI integration suite: port and extend the existing release integration suite to invoke the compiled thirdshift binary against an isolated bare origin repository with fake gh and fake Harness executables (replacing sourced shell-function calls):
    • Pass skips (deduplicated Activity log lines, exit 0, no Run notification) when nothing changed, when only non-shipped paths (docs/, site/, tests/) changed, during a live Experiment or Quota wait, when release.lock or origin release reservation is held, when all shipped-change main commits finished CI red, and when an unfinished release-<X.Y.Z> PR is human-blocked (draft or foreign commits).
    • Candidate main selection: immediate cut from newest green shipped-change commit, polling while push CI is pending, and refusal/skip when red.
    • Single-session bwrap-sandboxed minor vs patch selection (including refusing major from model output, recording a Session trace, verifying host files outside the sandbox cannot be read, and falling back to patch + non-duplicated generated notes when the Harness fails).
    • Explicit <version> and --major / --minor / --patch flags, mutual-exclusion errors, --review non-TTY refusal and TTY $EDITOR flow, --with-experiment TTY override vs unattended failure, targeted Fix run recovery, unpublished failed-workflow recovery, THIRDSHIFT_SESSION refusal, Stop cleanup, and Inbox (Working, Done, Needs you settlement, email-unless-merged notification behavior, unmerged-after-publish warning landing in Needs you).
  • Console, Cron jobs, Pass eligibility, and destructive signals (existing integration suites):
    • API parity, OpenAPI, Start controls, and scope tests verifying release requires admin scope (403 for run-only tokens/viewers), release --review is CLI-only, and --release-summary is gone.
    • Cron jobs tests verifying thirdshift release recognition and Pass last-fired age display.
    • Unattended Review run and Fix run Pass tests verifying release-* pull requests targeting main are skipped while explicit thirdshift fix <pr-url> --no-merge remains allowed.
    • Destructive-command fixture cases covering thirdshift release and git push tag forms.
  • Workflow generator, prompt catalog, and site suites:
    • Generator unit tests verifying processes/** in RELEASE_PATHS and the github.actor + exact origin/main bump-tree guard in generated release.yml, plus --check passing against .github/workflows/release.yml.
    • Prompt-page check and site test suite passing after regenerating prompts and manual pages.

Out of Scope

  • Generalizing thirdshift release to repositories other than JacobStephens2/thirdshift (Q2).
  • Running thirdshift update locally or across the Fleet inside thirdshift release (Q6).
  • Allowing the Harness to choose a major version bump without an explicit --major flag or <version> argument (Q7).
  • Automatically mutating live GitHub repository rulesets during an unattended factory run (handled by the interactive Day shift wizard script instead, Q14).

Further Notes

Sub-issues

Sub-issues

6 of 6 Issues completed
Loading 6 sub-issues

Activity

  1. added
    enhancement
    ready-for-human
    on Nov 11, 2026
  2. added a commit that references this issue on Nov 13, 2026
  3. changed the title [-]make `thirdshift release` command to release new versions of thirdshift, so a cronjob can be set to daily release a new version or on whatever schedule desired[/-] [+]Spec: `thirdshift release` Command and Pass for scheduled and on-demand releases[/+] on Nov 13, 2026
  4. added
    ready-for-agent
    in-progress
    agent-failed
    and removed
    ready-for-human
    ready-for-agent
    in-progress
    on Nov 13, 2026
  5. 2 remaining items

  6. added
    in-progress
    and removed
    agent-failed
    ready-for-agent
    on Nov 14, 2026
  7. added
    in-progress
    and removed
    in-progress
    on Nov 14, 2026
  8. added a commit that references this issue on Nov 15, 2026
  9. added
    ready-for-agent
    and removed
    in-progress
    on Nov 15, 2026
  10. removed
    ready-for-agent
    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