Commit Graph
123 Commits
Author SHA1 Message Date
aiongg 3208e4c6e4 A stopping job parks writes asked for after the stop instead of failing them, waits for its writes' bookkeeping, and exits with the step's own code when the step returned; only a job the stop ended resumes, command-line runs never do; write keys tell answers and CI run attempts apart, a repeated unknown write is logged and named; pushes are recorded once, also on replay; resumed runs keep their item counts and get their own usage rows 2026-11-21 20:26:41 +00:00
aiongg fbe913b656 A stopping job lets its GitHub writes in flight finish and be recorded before it exits
The runner sends SIGTERM to the job process alone. The job refuses new writes (WritesStoppedError, so a
resumed run makes them), waits up to 7 s for the writes it has begun (tracked from begin() to finish()
in write.ts), saves its usage, then stops the rest of its process group and exits 143. SIGKILL to the
group still follows 10 s after the SIGTERM.
2026-11-21 20:02:33 +00:00
aiongg 04800c244d Creating GitHub writes are made once per job, also when the job resumed after a restart
For a resumed job, comments, reviews, issues, PRs, issue transfers, CI run approvals and reruns,
pushes and the advisory writes first look for the successful audit row of the job's earlier run with
the same action, target and write key (a hash of the text, the run id, the commit or the head and
base) and return its recorded result instead of writing again.
2026-11-21 19:52:35 +00:00
aiongg 53ca553003 GitHub read identity: readsUseApp checks the settings change counter on every call and re-reads the setting when it moved, so job processes see a switch; a refresh that read before a noted switch drops its reading 2026-11-21 17:54:48 +00:00
aiongg 0d85cd64bd Async interleaving on one connection: temp-table fill and use in one read snapshot (item_settled, flow_pick); copy-on-write remote queue cache; overlap guards on interval passes (exclusive); GitHub read identity held in memory and refreshed on the settings counter, shared read handle opened once; owner reloads keep the latest load; held claims are not answered empty while a try may be leasing; codemod keeps the item-tools snapshot and the read handle local 2026-11-21 17:28:37 +00:00
aiongg 4c383b2d1a Hand-convert the transaction residue, initializers, accessors and type predicates; settings snapshot per async context; connect()'s migrations keep synchronous helpers 2026-11-21 17:09:04 +00:00
aiongg 20061c88d9 Apply async codemod: node scripts/codemod-async.ts over the program 2026-11-21 17:00:38 +00:00
aiongg b717826cf9 Pacing comment sits on tryBegin again 2026-11-21 08:35:50 +00:00
aiongg ded4e07234 Planner: labels-apply waits while the repo's GitHub write budget is used up
A labels job whose writes the pacer refuses labels nothing and was queued
again on every input change. The labels lane reads the same budget the
writer checks (pipelineWriteWait, the read-only half of tryBegin) and
leaves out a repo whose label writes would wait past the writer's bound;
the planner wakes when the window frees and the stage says until when.
2026-11-21 08:31:09 +00:00
aiongg 84d50f41b2 App slugs are recorded from a fresh read; pass snapshot comments name the other writers 2026-11-21 07:22:26 +00:00
aiongg 2320fea0d4 Planner pass: serve settings from one reading per pass; read conflict merges, carries, fix-up and CI fix rows, author permissions and post-merge follow-ups once
A pass-scoped settings snapshot (src/settings-read.ts) answers every settings read of the
synchronous part of detectAutopilot; writes made during the pass go through writeSetting and
deleteSetting, which keep it current. The snapshot is dropped when the pass ends.
2026-11-21 06:37:02 +00:00
aiongg 0cf7188de4 Held follow-ups: file when merged unless the path ended before the merge; settle stopped creates
A merged PR files its held issue unless the bound merge path ended before the merge time, so a pre-approval the merge itself cancels no longer drops it. Rows are bound to the press's own path: the pre-approval it created (runPipelineStep returns its id) or the decision's answer history count, so a new answer or pre-approval never revives one. createIssue treats an unsent request (failed app-token mint) as a clear failure and marks a write held back by pacing; pacing counts no try. A row left in filing is settled from its audit row. held_followups moves to its own topic outside the planner input, so row writes keep the failure backoff.
2026-11-21 04:23:03 +00:00
aiongg 97cf92a877 Autorepin: refuse a missing via branch when the command is accepted, count only consecutive failures across waits, fetch the via branch into its own ref namespace 2026-11-21 00:13:42 +00:00
David MannandClaude Opus 5.5 81e6fe9d50 Autorepin via a branch: @<app> autorepin <pull request> via <branch> pins to the first commit of that branch's first-parent history that holds the merge, waits without counting tries while the merge is only on the default branch (looked for every 15 minutes, failed 7 days after the merge), accepts a merge straight into the branch, and a branch name git would refuse makes the line no command
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 16:25:44 +01:00
aiongg ce1e4db5c0 Autorepin: an edited comment must still name the stored pull request, a lockfile may not change the version or checksum of a package it had, an off is kept per pull request, quiet pull requests get no comment, only reasons worded by AutoCraft reach GitHub, the asker's login must stay bound to their GitHub id with write access read through the app, a lockfile task ends after 3 hours, a recorded push survives a crash, and a nested Cargo.lock is refused 2026-11-20 14:25:36 +00:00
aiongg 01089e6d36 Merge main into autorepin: comment commands keep main's checks (comment re-read, head pin, app permission, quiet), autorepin stores its pull request in github_commands and its repins drain after the commands 2026-11-20 14:25:13 +00:00
aiongg b07948bc3e Merge #20 and #21 with fixes: maintainers who settle decisions may use Queue items (permission refreshed through the GitHub App, default weight only, re-checked in batches); @<app> merge queue comments queue items, pinned to the head at comment time 2026-11-20 13:57:45 +00:00
aiongg 1421dc4c5b Comment commands: a PR head without a check suite is unknown and the command is tried again; a failure storing a command never fails the delivery's re-read 2026-11-20 13:57:31 +00:00
aiongg 36c4bcd1d6 Comment commands: app permission read, comment-time head pin, comment re-read, quiet and silent cases
- The commenter's write permission is read through the app installation (appPermission), which writes repo_permissions, so a
  maintainer's pre-approval stays alive under refreshSettlers; an access GitHub cannot read is retried, and a command that
  expires that way is answered once ("could not check your access; comment again").
- The comment's creation time is stored. A PR is pre-approved only at the head it had then: a force push, a later commit date or
  a later first check suite on the head refuses it ("the PR changed after your comment; comment again"), and preapproveMerge
  takes the pinned head. On an issue, the closing PR is queued only when it is older than the comment and unchanged since.
- A comment older than 5 minutes at delivery queues nothing; before acting the comment is read again by id and must exist, have
  the same author and still hold the same command.
- A login never bound, a viewer, and a non-operator on a quiet PR get no answer; nothing is answered on a quiet PR. Unexpected
  errors are answered with a fixed text; only an answer to someone the queue rule lets queue skips the comment approval.
- github_commands gets an index on (state, reply) and the runner prunes settled rows after 30 days; parseCommand skips indented
  code and HTML comments across lines.
2026-11-20 13:54:08 +00:00
David MannandClaude Fable 5.2 8372456a31 Autorepin: commands count in the order of their comments (a late retry never undoes a later off), the merge commit must still be an ancestor of the default branch as fetched now, only dependency tables are repinned, the lockfile is read as TOML, an unreadable Cargo.toml ends the try instead of being skipped, and a scratch folder that cannot be removed does not replace the outcome
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 14:47:45 +01:00
David MannandClaude Fable 5.2 7f02969357 @<app> autorepin <pull request> in a comment on a PR: once that pull request of another tracked repo is merged into its default branch, the PR gets a commit that sets the rev of its Cargo dependencies on that repo to the merge commit, with Cargo.lock updated by cargo in a build task; no model, the push has a lease on the head, and a merge pre-approved at the old head carries on to the repinned one
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 14:24:16 +01:00
David MannandClaude Opus 5.5 a85d1cfa3a A command reads the commenter's role and binding again after the permission read and passes that role to queueAdd, so a login demoted or bound to another account meanwhile queues nothing; the early check stays, so an unknown commenter costs no GitHub call
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:12:33 +01:00
David MannandClaude Opus 5.5 14e2d89e0c Commands never tried go before retries in a drain, and retries by their last try, so due retries cannot fill the limit drain after drain; a retry's tried_at is the time after its permission read
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:11:23 +01:00
David MannandClaude Opus 5.5 1243b8533a A command exactly an hour old has expired (the deadline is inclusive)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:09:50 +01:00
David MannandClaude Opus 5.5 491d49160d A command whose hour ran out while GitHub answered the permission read expires instead of being queued, and its outcome is recorded at the time after that read
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:06:57 +01:00
David MannandClaude Opus 5.5 ffb76a0826 A command checks its items' read times again after the permission read, right before queueAdd with no I/O wait between the check and the pre-approval, so an older snapshot written meanwhile (a reconcile that started before the comment) makes it wait instead of queuing that head
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:47:35 +01:00
David MannandClaude Opus 5.5 10f60b0497 A command counts only a read strictly after the comment (a read stamped at its instant may have started before it), and on an issue it also waits for a fresh read of every open PR that closes it, since queueAdd pre-approves the sole one at its mirrored head
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:43:09 +01:00
David MannandClaude Opus 5.5 7365123cd7 A command with no read of its item since the comment, and none queued, queues a re-read itself (at most once a minute), so a failed re-read or one in the comment's own second does not leave it waiting until it expires
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:40:10 +01:00
David MannandClaude Opus 5.5 b8d66de52a item_reads.synced_at is when the read started, before its first GitHub request (the run's start for paged reads), so a read that began before a comment never passes its freshness check; docs: the weight follows "merge queue" (a weight alone is no command), and the app's answer needs Issues and Pull requests write, which a dashboard-registered app has
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:38:31 +01:00
David MannandClaude Opus 5.5 8f9b4c05bc Commands in comments, after review: a fence closes only as CommonMark closes it; a command waits until the item was read from GitHub after the comment (item_reads), since a gone sync request also follows a failed re-read; rows waiting for a read or a permission retry (tried_at, a minute) no longer fill the drain's limit, which now counts GitHub calls only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:27:03 +01:00
David MannandClaude Opus 5.5 a8ab84a50c Merge queue from GitHub comments: @<app-slug> merge queue [weight] on a PR or issue queues it as a line of Queue items, as the commenter, under the same rule (settleRefusal); the webhook keeps only the comment id, item, weight and commenter in github_commands (never the text), the runner carries it out after the item's re-read with the commenter's write permission read from GitHub, and the app answers in the thread through write.ts; commenters without an AutoCraft login, or with another GitHub id than the bound one, get no answer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:10:42 +01:00
aiongg 16482513f1 Bulk label writes use at most half of the GitHub write budget; a paced labels-apply job ends done and paced failures skip the failure backoff 2026-11-20 11:59:10 +00:00
aiongg c77b23a302 Rename the server admin CLI to autocraft-server; document the MCP Connector, Task Runner login, long-polling claims, model call queue and Manual only 2026-11-20 02:17:48 +00:00
David MannandClaude Opus 5.5 fd4ae23175 A red integration batch is worked out without a model: red on main at the base blames no PR, a traced failure tests its PRs alone, otherwise one rerun, then the split
Checks that failed on the default branch at the batch's base too rebuild the batch on a newer head or wait. The failed
logs' compiler errors and panics are blamed at the batch tip; the members they point at (some, at most 3) are tested in
batches of their own and the rest rebuilt without them, so a wrong trace costs a round, not a hold, and the batch size
stays. Nothing traced: the failed runs are rerun once (ci_reruns, ci_rerun_at), and only results newer than the rerun
count. Then the split as before. A red combined-tree build is traced from its build log the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:28:18 +01:00
aiongg 9532f539b1 Ask comments that never reached GitHub are asked again after a backoff
A write that fails before any request goes out (the GitHub App's installation token could not be minted) returns sent: false. The fix-up, conflict and CI fix steps record such a comment as comment-unsent instead of the final comment-failed; the planner asks again 10 minutes after the first and an hour after the second, and a third unsent comment is final. Existing comment-failed rows with an installation-token reason become comment-unsent.
2026-11-16 15:01:05 +00:00
aiongg ee966e7afa Code-carrying model replies reach their parsers with only the known credential shapes hidden; stored copies and every posted GitHub text get the whole scrub 2026-11-14 23:52:35 +00:00
aiongg 5a3b165c1d Merge branch 'sec3-runner'
# Conflicts:
#	docs/operations.md
2026-11-14 23:27:17 +00:00
aiongg de0547d883 Whitelist tiers, overrides and the pipeline's own tier belong to accounts and heads; removing an operator ends what acts as them
- History counts per GitHub account: a PR row with an id counts for that id, an id-less row for the
  account the login is bound to, and for nobody while the login is unbound. The sync no longer binds a
  login that has id-less merged or closed PRs; the backfill binds it from the history's own author.
  A failed binding pass shows as the author-ids health warning.
- An allow override stores the account it was given to (looked up when set) and counts only for it;
  a deny holds for any account under the login, in any letter case. The outside-author limits read
  the same per-account standing.
- The pipeline's own Fix, main CI fix and security fix PRs keep their own tier only while the head is
  a commit the pipeline pushed to its own branch (own_commits), or reached from one only through its
  own later pushes; otherwise a person is asked.
- Removing or demoting an operator revokes their org setup links, and a link works only while its
  creator is an operator. Removal drops Discord links and codes in any letter case.
- Decision alerts to maintainers need a repo permission read within a day.
- A cached author permission is not used for another account under the login, nor once its refresh
  has failed too often or for too long.
- Pushes to new branches and new PRs need the grant of a step that opens the pipeline's own PRs;
  security fix writes carry their own grant kind.
2026-11-14 23:24:55 +00:00
aiongg f5bdb64c5e Runner hardening: per-repository installation tokens, a github.com-only credential helper, an allow-listed jev environment, pinned git attribute source and explicit repositories, absolute deny rules, a wider output scrub, and a deploy of the pushed commit
- Installation tokens for a write are minted for the write's repository (a transfer's also for its target); reads across repos and pushes to a contributor's fork keep the installation-wide token. Reading the app's keys checks the secrets file's mode like every other reader.
- The app's git credential helper is set for https://github.com only, after every configured helper is dropped.
- jev children get only the search path, home, locale, temp, cache, TLS and proxy variables and Jev's own.
- Git on the cached clones names the repository with GIT_DIR, runs with safe.bareRepository=explicit and reads attributes from the empty tree.
- The sandbox denies /proc and the credential directory in the absolute (//path) form as well.
- The scrub hides hex keys that are not digests, URL user:password, three-part dotted tokens and credentials inside hex or base64.
- The dashboard unit sees the settings file, releases, the bare repo and .local read-only.
- post-receive resolves the pushed commit once and the hook deploys that commit; the image build runs pnpm installs without install scripts.
2026-11-14 23:23:21 +00:00
aiongg a9c8f10cd5 Merge sec2-base-binding 2026-11-11 13:00:25 +00:00
aiongg 555110bfe4 Reviews and merges are bound to the head and base they read: diffs are fetched by commit and keyed on the fetched head, each review records its base branch, merges and batch members must match it, conflict merges take only the default or reviewed base, same-repo pushes need an author with write access, and adopted PRs must be the pipeline's own against the expected base 2026-11-11 13:00:05 +00:00
aiongg b9f48030b0 Checks must belong to the PR head commit, CI and build files need a person's look, the merge-time discussion read covers 100 entries, carries bind to the compared head, and a CI rerun first checks the run's commit 2026-11-11 12:51:51 +00:00
aiongg 9aa57afb56 Review links use the tracked repo's owner, worker auth limiter counts only failed requests, fix paths are normalised, identity switch is one transaction, lockfile resolutions equal one side exactly, SSE and webhook limits raised, health probe starts a background coverage refresh 2026-11-10 15:23:57 +00:00
aiongg a1be494889 Merge hard-lead-a 2026-11-10 15:14:37 +00:00
aiongg 283f61a64e Access entries bind the GitHub id when added, the identity switch revokes stored user tokens, worker plain http is limited to private hosts, and legacy-sealed values are re-sealed at startup 2026-11-10 15:13:33 +00:00
aiongg 3ca31e014c Merge hard-parse 2026-11-10 15:12:23 +00:00
aiongg 9f62d28191 Harden patch mode parsing, checkout paths and listing, reference names, worker update spec, mirror nulls, title length, file sizes, push target, stored resolutions and review fix paths 2026-11-10 15:11:21 +00:00
aiongg a9dfea2531 Claude calls get an exact environment and scrubbed output; preapproval, revocation and lease claims are re-checked atomically; held outside items are skipped when proposals apply; the public health probe reads cached state only 2026-11-10 15:10:49 +00:00
aiongg 26c4573dcd Reporter writes take their identity from the writer's login, like the other user-lane writes 2026-11-09 13:20:49 +00:00
aiongg dd74d1f577 Discord filing review fixes: link text when the URL is too long for a button, new-issue slot taken at the choice to file, no text in the audit, audited writes through write.ts, slot reserved before the junk check, old token revoked at re-sign-in 2026-11-09 13:17:01 +00:00