Commit Graph
140 Commits
Author SHA1 Message Date
aiongg de71c62cee Registering a GitHub App over unreadable stored keys needs an explicit confirmation 2026-11-22 15:49:56 +00:00
aiongg 49f56f0a67 GitHub App keys: every process reads the store, unreadable keys are reported
openDb() opens the process's app-key store with its database, so job
processes and commands read the stored keys too, and the planner thread opens
its own; readAppSecrets and the minter no longer fall back to the secrets file,
which is read only for the one-time import. Stored keys the session_key cannot
open are logged once and shown on the GitHub App page; a new registration may
replace them. The webhook-secret copy updates only the same app's readable row.
A dev server seals with its secrets file's session_key when it has one.
2026-11-22 15:25:52 +00:00
aiongg 0a39282973 GitHub App keys live in the database, sealed; a secrets file's app keys are imported once
Registration stores the app's keys in the github_app table, sealed with the
token box derived from session_key, so dashboard replicas and the runner read
the same keys without a shared filesystem, and the secrets file can be a
read-only mount. A secrets file that still holds github_app_* keys is imported
while no row exists; a removed app keeps its row (keys null) so the file does
not bring it back. Processes reread the row at most every 10 seconds.
2026-11-22 15:01:32 +00:00
aiongg 04a30c84cb Dashboard reads: one settings snapshot per read request, read with the session; independent reads of the home, Now, inbox, item, item page and queue endpoints run together 2026-11-22 04:25:36 +00:00
aiongg 4bfd0d8d2e GitHub App manifest: no commit statuses permission, because no code reads commit statuses 2026-11-22 02:03:43 +00:00
aiongg 4e0b14d0ba Merge #39: GitHub App manifest 2026-11-22 02:03:37 +00:00
aiongg 3c6eff3f72 Build the SQL of the GitHub claim, command, identity, pipeline-account, read and slug modules with Kysely 2026-11-21 23:42:02 +00:00
aiongg 07bd3e0e3e Convert the GitHub user lane, vault, webhooks and write statements to Kysely 2026-11-21 22:55:04 +00:00
aiongg 8794761830 Merge main: restart without draining, resumable jobs and once-per-job creating writes; the runner tests read audit details as JSON in the test, so they run on Postgres too 2026-11-21 21:38:38 +00:00
aiongg f1e654b078 Typed Expression twins of the shared SQL-text fragments (hidden-repo filters, quiet PRs, public status, run columns, phase, current head, picks, manual only, tracked repos, open groups, command work, unsure review), checked against their text versions on SQLite and Postgres; pnpm test:pg runs the kx and portable tests by default 2026-11-21 20:34:26 +00:00
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 2926a37d5f Merge pg-e1: dashboard SQL portable to both dialects
# Conflicts:
#	src/access.ts
#	src/answers/hold.ts
#	src/classify/settled.ts
#	src/dash/api/decisions.ts
#	src/dash/api/home.ts
#	src/dash/api/items.ts
#	src/dash/api/needs.ts
#	src/db/portable.ts
#	src/decisions.ts
#	src/dupes/decide.ts
#	src/review/candidates.ts
#	src/review/diff.ts
#	src/settlers.ts
2026-11-21 19:41:09 +00:00
aiongg 21e98d1091 Postgres: GitHub write audit rows return their rowid and keep the pacing owner in JS, held follow-ups return their id, canonical info reads its pairs through the JSON helpers, whitelist rule upserts; SQLite data migration tests run on SQLite only 2026-11-21 19:02:59 +00:00
aiongg 4ddcc4a408 Postgres: classify verdicts replace by delete and insert (new rowid), access, outside, whitelist and author ids portable, sync runs and proposals return their ids, tests insert with RETURNING and explicit upserts 2026-11-21 18:58:23 +00:00
aiongg 09376e1212 Dashboard SQL on both dialects: now, shown, work, limits, setup links and user-lane comparisons 2026-11-21 18:55:24 +00:00
aiongg 7e1123ce8a Merge C1: AUTOCRAFT_DB_URL reaches every process, AUTOCRAFT_DATA_DIR, db.attempt
# Conflicts:
#	src/github/read.ts
2026-11-21 18:26:51 +00:00
aiongg 776d59c758 Run every process on AUTOCRAFT_DB_URL: the dashboard, runner, worker threads and job processes open dbTarget() (job processes get dbEnv(), only the variable that names the database); the GitHub identity read uses the process handle in read transactions on Postgres; AUTOCRAFT_DATA_DIR (default: the SQLite file's directory; the image sets /data) holds reference documents, artifacts and the item snapshot; lock files are named by dbLockName(); the item snapshot, backup.sh, the predeploy snapshot and the periodic loops say that Postgres has no SQLite snapshot instead of succeeding; db.attempt(fn) runs fn under a savepoint on Postgres so a caught statement error leaves the write usable 2026-11-21 18:08:33 +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
Alejandro Martínez Castillo bba74949c5 GitHub App manifest: checks and commit_statuses read, because the app token answers 403 on every CI-state read without them 2026-11-21 17:32:38 +01: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