Cloud dispatch pool + auto PR (opt-in, skip clearly)
Worker pool: workers table + register/heartbeat (heartbeat is
registration, no 404), GET /workers with alive (120s default),
POST /workers/heartbeat (X-API-Key, missing worker_id 400).
Tasks gain executor (local/docker/cloud, None = any worker);
worker claim filters by executor in pick_next and in the CAS
WHERE clause, CAS semantics unchanged; CloudExecutor _name
now correctly returns cloud, not local.
CloudExecutor: generic HTTP runner interface (endpoint from
explicit arg or CLOUD_RUNNER_ENDPOINT, auth header name only,
token value only from env into the request header, never into
logs/body/errors); no endpoint configured = explicit failure,
never silent downgrade. Vendor adapters (ECS/Cloud Run) are
out of scope, documented as such.
Auto PR: projects.auto_pr (0/1, create-time only, no PATCH
route exists); POST /tasks/{id}/pr (maintainer+ via
approve_merge) only for merged tasks (else 409); skip reasons
in order: auto_pr_disabled, no_worktree, no_remote, no_gh,
gh_not_authenticated — all return 200 with pr_skipped, task
stays merged, no push attempted; push/pr-create failure
returns 502 with step, task stays merged; success writes
pr_url/pr_number and audits pr_created. No default auto-push
from the worker. Remote URLs in errors are scrubbed of
userinfo; gh credentials are managed by gh itself, never
stored by the control plane.
Tests: host 27 pass, cloud 323 pass (8 skipped are
environment-dependent real-Postgres tests).
This commit is contained in:
1 parent
d3e588e4b3
commit
306cdf0d0c
8 files changed
+1256
-34
No files matched your search
+14
-1
@@ -781,7 +781,8 @@ POSTGRES_SCHEMA = (
|
||||
"name TEXT, "
|
||||
"owner_id TEXT, "
|
||||
"created_at DOUBLE PRECISION, "
|
||||
"repo_url TEXT)",
|
||||
"repo_url TEXT, "
|
||||
"auto_pr INTEGER)",
|
||||
# tasks 含 server.migrate_tasks_table 补的那 6 列,建表时一次建齐;
|
||||
# 老库迁移仍走 migrate_tasks_table(PRAGMA 翻译后在 PG 上是 no-op)。
|
||||
"CREATE TABLE IF NOT EXISTS tasks("
|
||||
@@ -802,6 +803,9 @@ POSTGRES_SCHEMA = (
|
||||
"started_at DOUBLE PRECISION, "
|
||||
"finished_at DOUBLE PRECISION, "
|
||||
"child_pid BIGINT, "
|
||||
"executor TEXT, "
|
||||
"pr_url TEXT, "
|
||||
"pr_number INTEGER, "
|
||||
"UNIQUE(project_id, idempotency_key))",
|
||||
"CREATE TABLE IF NOT EXISTS summaries("
|
||||
"id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, "
|
||||
@@ -875,6 +879,15 @@ def init_postgres_schema(conn):
|
||||
"PRAGMA table_info(projects)").fetchall()}
|
||||
if "repo_url" not in cols:
|
||||
conn.execute("ALTER TABLE projects ADD COLUMN repo_url TEXT")
|
||||
if "auto_pr" not in cols:
|
||||
conn.execute("ALTER TABLE projects ADD COLUMN auto_pr INTEGER")
|
||||
tcols = {row[1] for row in conn.execute(
|
||||
"PRAGMA table_info(tasks)").fetchall()}
|
||||
for _name, _type in (("executor", "TEXT"), ("pr_url", "TEXT"),
|
||||
("pr_number", "INTEGER")):
|
||||
if _name not in tcols:
|
||||
conn.execute(
|
||||
"ALTER TABLE tasks ADD COLUMN %s %s" % (_name, _type))
|
||||
conn.commit()
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user