Repository navigation
M2: merge main (c616e356c) into sam/selfhost-pass-2 - #2758
simple-agent-manager[bot] merged 20 commits into
Conversation
* wip(gcp): quota-bucket descent within the GCP tier (slice 2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(gcp): quota-bucket descent in the compute pools guide; slice 2 task file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(gcp): name the quota when no descent remains; distinct sizes first in the per-tier cap Review findings on slice 2: a GCP quota refusal with nothing left to try was recorded as 'no available capacity', and zone duplicates of one size could take every capped slot of a bucket so the smaller type that still fits was dropped. Tests: synchronous 403 producer, two-source scoping control, zone-duplicate cap, exhausted-bucket reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: slice 2 staging evidence; archive quota-bucket descent task Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* task: plan deterministic automation and session tests * test: isolate native rate windows and streamline automation input * test: prevent mock reuse when native teardown stalls * test: record mutation checks and 60 normal file runs * test: record 30 loaded automation runs and native regression * test: complete 120-run stability proof and local reviews --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
* task: profile and reduce ProjectData archive writes * test: measure full archive writes with a reporter-backed workerd fixture * perf: batch compact archive search writes with measured regression guard * docs: record archive profiling validation and review results * test: temporarily bound staging compact archive sweep * test: verify archive SQL telemetry with real returning cursors * test: restore archive defaults after staging setup * docs: record archive measurements and staging validation * fix: satisfy archive SQL and fixture quality checks --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
…2744) * ci(deploy): pin deploy job to ubuntu-24.04 so the VM-agent build stays byte-identical ubuntu-latest moved to ubuntu-26.04 on 2026-11-14. The cgo-enabled native amd64 vm-agent build then produced different bytes for the unchanged release ba3ba01, and publish-vm-agent-artifacts.sh refused to overwrite the immutable artifact, failing every staging (run 43655924997, two attempts) and production deploy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: backlog reproducible VM-agent build across runner images Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: pin Playwright browser jobs to ubuntu-24.04 Playwright cannot install Chromium on ubuntu-26.04 ('Playwright does not support chromium on ubuntu26.04-x64'), so the staging smoke tests failed after a successful deploy (run 43657273196) and the CI Playwright jobs and installer deploy would fail the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* task: track archive drain rate increase * config: double ProjectData archive sweep opportunities * test: normalize shipped archive fixture import * task: record archive drain validation * test: allow approved archive settings in binding audit * docs: clarify compact archive reservations and cost comparison --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
…erts (#2747) * feat(admin): clear integrations, truthful source labels, owner security alerts - PUT /api/admin/platform-config accepts config.clear (integration groups); deletes stored settings and platform_credentials rows, audits each existing row as reset, replaces the Google-infrastructure-only remove flag - Source labels: exhaustive admin-settings source mapping (kv -> legacy-kv, never 'environment'), 'stored in SAM' / 'Worker environment fallback', mixed-source badges, per-field 'changed by' with first-run setup named as unauthenticated - security-alerts: best-effort waitUntil emails to active superadmins (or the bootstrap owner) on integration changes, setup completion, and social sign-ins linked to admins - Admin -> Integrations: per-section Clear with destructive confirmation Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test+docs: integration clear UI audit, docs for source labels, clear and owner alerts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: address security and UI review findings Security review (2 MEDIUM, 4 LOW): - Clear only deletes groups that had stored rows at audit time, so every delete is audited and fenced by the admin-settings revision CAS (no silent delete of a concurrently written row) - Dropped alerts (no email binding / no recipients) log at error - Display names and emails in alert bodies and admin labels are sanitized (no forged lines) - Machine-checked enumeration of integration writers vs. scheduleSecurityAlert UI review (1 HIGH, 3 MEDIUM): - A failed clear keeps the dialog and typed values and says so inside the dialog - Focus moves to the cleared card's heading; clear-specific success message - One 'changed by' line per card when fields share it; timestamps carry a timezone; audit line linked via aria-describedby; dialog copy split into short paragraphs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive admin integration hardening with staging evidence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record staging evidence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: anchor the timezone regex and address SonarCloud findings - formatChangedAt: group the alternation so $ anchors both branches (a stray Z no longer counts as a zone marker) - read-only component props; non-async account hook; non-redundant waitUntil type Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… GitLab trust (#2748) * fix(deploy): mask SETUP_TOKEN in GitHub Actions logs wrangler deploy prints every plain-text binding's value and the deploy job echoes that output into the public Actions log. Register the generated token as a log mask before it is returned, so later steps print ***. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): close first-run setup once the install has an owner Installs created before the setup wizard never wrote setup.completed, so /api/setup stayed open behind SETUP_TOKEN on instances that already had a superadmin. An active superadmin now closes setup and records it; SETUP_FORCE still reopens it for lockout recovery. The setup rate limiter no longer falls back to X-Forwarded-For or User-Agent, which callers can rotate for a fresh attempt budget. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(auth): a self-managed GitLab host set at runtime cannot vouch for emails better-auth links an OAuth sign-in to the existing user with that email when the provider is trusted or reports the email as verified. A self-managed GitLab host reports whatever its operator wants, and on 2026-11-12 a host saved through first-run setup signed in as the superadmin that way. GitLab is now trusted for linking and profile sync only on gitlab.com or on a host pinned in the Worker environment. Otherwise it is left out of trustedProviders, gets no profile override, and its email_verified claim is replaced with false. GitHub and Google have fixed identity hosts and keep their behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: setup token masking, setup closing with an owner, GitLab link trust Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record implementation notes and discrimination proofs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: reviewer follow-ups for setup token, rate limit and GitLab trust Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(installer): redact values a failed command declared with ::add-mask:: The shared install engine captures the sync step's stdout, so the mask it registers for SETUP_TOKEN never reaches Actions, and a failure tail could carry the token from the mask line or wrangler's bindings table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(auth): scope an untrusted GitLab host's account ids to the host better-auth signs an existing account in by provider id + account id before any email check, and GitLab user ids are public. A self-managed host saved at runtime could return the id of a user who linked gitlab.com and sign in as them, or squat an id a gitlab.com user signs in with later. Its accounts are now stored as <host>/users/<id>, and its emails stay unverified, from one getUserInfo instead of a profile mapper. Found by the security review of this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(auth): use only the configured GitLab host's login for repo tokens A user can now hold GitLab logins from two hosts (raw ids from gitlab.com, host-scoped ids from a self-managed host saved at runtime). The token lookup took the newest GitLab row regardless of host, so one host's access or refresh token could be refreshed against, or sent to, another. It now selects only rows the configured host issued, and returns nothing when GitLab is not configured. Found by the security review's re-check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive setup-takeover root fix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: share the OAuth sign-in harness between the GitHub and GitLab slices Removes the cookie jar, app mounting and sign-in start step that the new GitLab trust test duplicated from the GitHub sign-in test (SonarCloud new-code duplication gate). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: CodeRabbit follow-ups on provider tokens, pinned GitLab host, installer masks - Close better-auth's HTTP provider-token endpoints (get-access-token, refresh-token, account-info). SAM reads tokens only server-side, scoped to the configured host; over HTTP they could refresh or send any of the caller's accounts to whatever host is configured now. - Trust a runtime-saved GitLab host that equals the GITLAB_HOST pin. - Redact every ::add-mask:: value declared during the installer run, not only those still in the failed command's bounded buffer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…4, pure move) (#2746) * refactor(web): split SettingsComputeUsage into components/ai-usage (L4, pure move) Rule 18: the page was 776 lines. AiUsageSection (with AI_PERIODS), BudgetSettingsSection (with BudgetBar) and the cost/token/model formatters move verbatim from main into apps/web/src/components/ai-usage/. Only import lines and five `export` keywords differ. No behaviour change; the integration branch's monthly-cap-unavailable behaviour and its component rename are left for a later slice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record L4 validation, reviews and left-out items Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record L4 staging verification Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ngle read, F16 (#2749) * feat(api): admin-set durable provisioning attempt deadline (60 s), attempt logging, provider-fetch single read Port of C1/C19 from sam/selfhost-pass-2 (landing slice L7). The durable attempt budget becomes operations.nodeProvisioningAttemptDeadlineMs (default 60 s, 5 s-300 s), separate from the 5 s per-request timeout, so a GCP create (9-12 s) no longer reaches its DNS step on an aborted signal. Each failed attempt logs safe structured fields with the cause it wraps. F16: NodeAllocationUncertainError no longer embeds raw provider text. completeAbortableResponse reads the body once instead of clone(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: durable attempt deadline vertical slice, F16 safe summary, provider-fetch single read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: pin sub-minimum attempt budgets in metering deadline cases; assert F16 safe wrapper messages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: L7 progress and discrimination evidence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: address L7 review findings (180 s max, safe code shape, GCP hint, test coverage) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: L7 staging evidence and reported forced-failure gap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: describe the provisioning attempt deadline as a cancellation budget (CodeRabbit) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: L7 final state Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Brings L7 (#2749), L4 (#2746), #2748 (setup closes with an owner, GitLab identity trust, SETUP_TOKEN masking), #2747 (admin hardening), #2742, #2744, #2740, #2739 and #2737 onto the integration branch. Conflicts resolved so landed code takes main's version: L7 provider-fetch, attempt deadline (60 s admin setting, summarizeProvisioningFailure) and tests are main's; the branch's node-lifecycle-provisioning-deadline.ts and its duplicate registry entry are removed. The branch keeps its reverse-tunnel ingress in node-provisioning.ts. GitLab sign-in combines main's identity trust with the branch's guarded profile fetch and host refusal. L4 takes main's BudgetSettingsSection name with the branch's monthly-cap availability additions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
Merging this PR will not alter performance
Comparing Footnotes
|
…labels (M2 S2/S3) Main (#2747) made every integration save from the settings page schedule an owner security alert and return actor labels. The branch's GitHub App manifest completion stores integration credentials through the same writer but did neither, so storing an App was a silent path and the admin page's cached status lost its labels. Also drops the second 'operations.nodeProvisioningAttemptDeadlineMs' member of the setting name union (both sides had added it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's isSetupCompleted (#2748) closes first-run setup on any install with an active superadmin, token or not. That subsumes the branch's closeSetupWithoutToken, which became unreachable, and contradicts the branch test control that expected a token install with an owner to stay open. The helper is removed, and the control now asserts main's behaviour (410 and setup.completed recorded). The token-less self-host cases keep their tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (M2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* blog: security advisory for open first-run setup on self-hosted SAM Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * blog: address review findings in setup-takeover advisory Adds API token and all-user linked-login checks, the cache wait before removing linked logins, SETUP_FORCE and fresh-install caveats, and softens claims the evidence does not fully support. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * blog: link the merged fixes (#2748, #2747) in the setup takeover advisory Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * blog: explain the one-time setup token reasoning and the installer path Adds why SETUP_TOKEN was deliberately plain text (single use, refused once setup closes) and where that broke, plus a section on the installer flow that deploys inside the owner's Cloudflare account without GitHub Actions, and recent related hardening (#2219, #2550, #2598, #2688, #2747 labels). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * blog: date the setup advisory for publication Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(api): authenticate platform GCP credential in provider orphan sweep The provider orphan sweep built its provider for the selected platform cloud credential through the static buildProviderConfig(), which rejects every GCP credential (workload identity and service-account key). On an installation whose platform credential is GCP the sweep failed on every five-minute cron and orphaned VMs were never cleaned up. Build GCP platform providers through the existing token provider and factory, acting as the credential's creator with no project scope, as installation catalog reads do. Ownership and selection logic are unchanged. Account failures stay contained inside the sweep, but a run with errors now reports through the handler's durable failed-sweep path while keeping its partial-success counters. Same change as sam/task-p1-find-out-jq3vp8 (task 01M7E7PHTQH57W6EPC8ZJQ3VP8). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: add P1b platform-GCP orphan sweep proof record Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(api): split provider orphan destroy path into its own module Pure move, no behaviour change: claim check, final ownership re-read, delete and deletion record move from provider-orphan-reconciliation-core.ts (575 lines) to provider-orphan-destroy.ts, ahead of a change to the delete path (file size rule 18). Candidate and OwnershipScope become exported types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): let the orphan sweep actually delete GCP orphans With the platform GCP credential authenticating (previous commit), the self-host test box showed the sweep select exactly the owned orphan and then fail to delete it: the whole pass (list, claims, re-read, delete) shared one 5 s AbortSignal, and GcpProvider.deleteVM looks the instance up zone by zone, sends DELETE and then polls the operation to completion. It could never fit, for platform or user GCP credentials; no DELETE ever reached GCP. - Each provider call (list, ownership re-read, delete) gets its own NODE_STOPPED_HANDOFF_REQUEST_TIMEOUT_MS, as env.ts already documented (per-candidate); no candidate starts after the sweep budget, the rest wait for the next eligible pass. - Providers with two-phase deletion (GCP) get a send-and-return requestVMDeletion bound to the exact instance the re-read proved: new provider option expectedInstance refuses before anything is sent unless the resolved instance has that id and zone. It is counted as deletionRequested, never destroyed, and counts toward PROVIDER_ORPHAN_DESTROY_LIMIT. The next pass is idempotent: still present -> requested again; gone -> not listed. - Providers without it (Hetzner and the rest) keep deleteVM. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: drop unrelated table reformatting from configuration reference Keeps only the orphan-sweep edits in configuration.md; the previous commit also reformatted unrelated tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record P1b box findings and extended scope Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): address orphan sweep review findings From the security-auditor, cloudflare-specialist, test-engineer and task-completion-validator reviews: - Claim lookup batches node ids under D1's 100 bound-parameter limit; a backlog of 100+ orphans failed every pass before. - The GCP delete is bound to the re-read's zone and ownership labels: expectedInstance.labels are re-checked on the provider's last read before the DELETE, and a known zone is read directly instead of walking every labelled zone. A re-read without a zone is refused, not bound by id alone. - Failures confined to one user/project account count as accountErrors and no longer fail the platform sweep, so one tenant's dead credential cannot mask a platform failure or page operators every hour. - Tests: delete-boundary label/id change, 105-candidate backlog against a D1 fake enforcing the bind limit, persisted audit record, hung re-read, mid-pass budget, no-zone refusal, wider INCIDENT margins with an elapsed precondition. - Deferred MEDIUM/LOW items filed in tasks/backlog/2026-11-15-provider-orphan-sweep-followups.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): assert account-error reporting and the completed audit record Round-2 review LOWs: the handler test now covers accountErrors>0 with errors=0 (no failed sweep) and asserts providerOrphansDeletionRequested and providerOrphanAccountErrors in cron.completed; the Hetzner control asserts the 'completed' deletion record. Task bounds corrected per review; remaining LOWs added to the follow-up backlog task. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record P1b box R16 proof and cleanup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: document orphan delete binding and account errors; fix task review scope Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record P1b staging no-regression evidence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): keep shared-infrastructure orphan sweep failures in errors CodeRabbit (major): moving every failure inside a user/project account pass into accountErrors also hid D1 claim-lookup failures, so every account could fail against the shared database while the sweep reported green. Classify at the source instead: provider-attributable failures (list, re-read, delete, credential resolution) go to accountErrors for user/project accounts and to errors for the platform account; a D1 claim-lookup failure stays in errors wherever it happens. Also corrects the follow-up backlog note: the audit write runs after the delete request (CodeRabbit minor). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record CodeRabbit review and fix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…tas (#2761) * docs(www): journal post on Google Cloud time budgets and regional quotas Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(www): address content review findings in the GCP journal post Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(www): address CodeRabbit findings in the GCP journal post Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…2761 Second merge of main at the coordinator's request, to include a886029 (#2757, the provider orphan sweep authenticates and deletes on GCP). One conflict, apps/api/src/scheduled/handler.ts: main's orphan sweep block (errors fail the sweep, partial counters kept) after the branch's reverse-tunnel lease sweep. Every other #2757 file equals main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Coordinator review (self-host coordinator, task 01M7FB384QHQ1TQCK95D0SX0TX), pinned to head 2cdfca4.
Merging with a merge commit (not a squash) so main's history stays an ancestor of |
a9da517
into
sam/selfhost-pass-2



Summary
M2 merges
origin/main(first atc616e356ce1b6b17bcfa66afc801c5c39e3d853c, then once more at1e49113c6f68bdefbbeb55daec58814d63b7ebfe; see the second merge below) into the self-host integration branchsam/selfhost-pass-2atc02f82651af78c0366d74daf27c49c695a6d8c04. It is a real merge, not a rebase or cherry-picks, and the base is the integration branch, notmain. Draft: do not merge. The coordinator reviews and merges it. Model: M1 (#2736).17a464e51:c02f82651af78c0366d74daf27c49c695a6d8c04(sam/selfhost-pass-2, including refactor(selfhost): hosted git only in the self-host build (H1) #2752)c616e356ce1b6b17bcfa66afc801c5c39e3d853c(main, including L7 L7: admin-set provisioning attempt deadline (60 s), provider-fetch single read, F16 #2749)84d77aa0f):105393655(at the coordinator's request, to include fix(api): make the orphan sweep authenticate and delete on GCP #2757):f24eb53a867a09c3330a619749b2dff6e4ca7a88(this PR after the first merge and its fixes)1e49113c6f68bdefbbeb55daec58814d63b7ebfe(main; final main parent)git diff --shortstat origin/main...<head>):c02f82651): 872 files, +86,752 / -2,827.17a464e51: 863 files, +85,951 / -2,367.f24eb53a8(againstc616e356c): 864 files, +86,043 / -2,366.1e49113c6): 864 files, +86,043 / -2,366. The difference from the first merge commit is this task's file, the S2 test and the S4 test change.Second merge: main moved to
1e49113c6Main gained three commits after the brief:
edcafa4a4(Security advisory: check that self-hosted SAM setup is closed #2743): marketing-site security advisory, content only.a88602948(fix(api): make the orphan sweep authenticate and delete on GCP #2757): the provider orphan sweep authenticates and deletes on GCP.1e49113c6(docs(www): journal post on Google Cloud time budgets and regional quotas #2761): journal post.They were merged once more (
105393655).One conflict:
apps/api/src/scheduled/handler.ts. Main replaced the orphan sweep call: errors now fail the sweep through the durable path, partial counters are kept, andproviderOrphansDeletionRequested/providerOrphanAccountErrorsare logged. The branch had added its reverse-tunnel lease sweep just before that call. Resolution: the branch's lease sweep, then main's block. The file now differs from main only by the branch's reverse-tunnel lines.Audit of the fix(api): make the orphan sweep authenticate and delete on GCP #2757 files:
provider-orphan-destroy.ts,provider-orphan-inventory.ts,provider-orphan-reconciliation-core.ts,services/platform-credentials.ts,packages/providers/src/gcp-deletion.ts,vm-deletion.ts, and all five new or changed orphan tests.handler-kill-switch.test.tsdiffers only by the branch's reverse-tunnel lines.handler.tsand its test.PR fix(api): platform GCP orphan sweep auth (box branch, P1b) #2750 conflicts with this head after the second merge. It was not touched. Its head is now
96cc0ec89, andgit merge-tree --write-treeof it with105393655conflicts in 3 files:apps/api/tests/unit/scheduled/handler-kill-switch.test.tsapps/api/tests/unit/scheduled/provider-orphan-real-provider-boundary.test.tsapps/www/src/content/docs/docs/reference/configuration.mdMain's fix(api): make the orphan sweep authenticate and delete on GCP #2757 is the reviewed version of the same orphan-sweep fix, so fix(api): platform GCP orphan sweep auth (box branch, P1b) #2750's owner should take main's version of those files. Before the second merge (
f24eb53a8), fix(api): platform GCP orphan sweep auth (box branch, P1b) #2750 merged cleanly.Checks after the second merge:
wrangler-bindings,runtime-tunables,migration-safety,file-sizes,shared-flight-joins,ast-checks.selfhost:test: 538 passed, 5 skipped.tests/unit/scheduledfile, plus the outbound-fetch inventory, the selfhost-only-modules guard, setup, manifest and both GitLab sign-in suites: 36 files, 463 tests.No new migration of any kind from these commits.
Conflict table (first merge)
packages/providers/src/provider-fetch.tscontent-encoding/content-lengthpackages/providers/tests/unit/provider-fetch.test.tsapps/api/src/durable-objects/node-lifecycle-provisioning.tsattemptDeadlineMs/logAttemptFailurefrom new-attempt.ts-deadline.ts, inlineattempt_failedlognode-lifecycle-provisioning-deadline.ts(45 s, 1 s-600 s) is deletedapps/api/src/services/node-allocation-recovery.tssafeFailureFields,describeProvisioningAttemptFailure,summarizeProvisioningFailure, provider-code shape filterdescribeProvisioningAttemptFailureapps/api/src/services/node-provisioning.tssummarizeProvisioningFailurein both uncertain-allocation errors,{ cause }prepareNodeTunnelIngress/settleNodeTunnelIngress,reverse-tunneltransport on resume,nodeRole,tunnelIngressgate)apps/api/tests/workers/direct-provisioning-do.test.tsdurable_attempt_failed)apps/api/src/auth.tsGITLAB_HOST; untrusted host left out oftrustedProviders,overrideUserInfoOnSignIn: trusted,untrustedGitLabUserInfogitLabLoginProvider(host refusal, guarded profile fetch),keepLinkedAccountEmailgitlabis pushed totrustedProvidersonly whenidentityTrusted. See M2-D1apps/api/src/services/platform-config-oauth.tsidentityTrusted,PUBLIC_GITLAB_HOST,pinnedHostargumentallowPrivateNetworkGitLabOAuthConfigcarries both fieldsapps/api/src/routes/auth.tsCLOSED_PROVIDER_TOKEN_PATHS(better-auth token endpoints closed)/link-sociallimited to GitHub and GitLabapps/api/src/routes/setup.tsCF-Connecting-IPonlyclientIpFromHeaders(lib/client-ip.ts, also validates the literal)closeSetupWithoutTokenapps/api/src/services/platform-config-core.tslogsettleSharedFlightapps/api/tests/unit/routes/admin-platform-config.test.ts,apps/api/tests/unit/services/platform-config.test.tsidentityTrusted: falseallowPrivateNetwork: falseapps/api/tests/unit/routes/admin-settings.test.tsintegration owner alertsdescribeOpenAI-compatible LLM endpoint settingsdescribeapps/web/src/components/ai-usage/AiBudgetSettingsSection.tsx(add/add)BudgetSettingsSectionAiBudgetSettingsSection, plus monthly-cap availability (capAvailable,MonthlyCapUnavailableNote)apps/web/src/components/ai-usage/format.ts(add/add)apps/web/src/pages/SettingsComputeUsage.tsxAiBudgetSettingsSectionmonthly-cost-cap-availability.test.tsxnow importsBudgetSettingsSectionapps/web/src/pages/AdminPlatformConfig.tsxhandleSavereturnsbooleanand keeps a failed Clear's dialog openhandleManifestStored(GitHub App manifest panel)Also resolved inside the merge commit, with no textual conflict:
operations.nodeProvisioningAttemptDeadlineMsauto-merged twice intoadmin-settings-core-definitions.ts: main's (60 s, 5 s-180 s) and the branch's (45 s, 1 s-600 s).admin-settings.mdhad both "Node provisioning" sections. The branch's is removed.workspace-create-metering.test.tsis main's file. The branch's copy mocked the deleted module.untrustedGitLabUserInfoused an unguardedfetchand is replaced by the branch's guarded fetch with main's untrusted rules (M2-D1).gitlab-sign-in-identity.ts.untrustedGitLabAccountSubjectandgitlabAccountScopestay.security.mdcites the new location.Silent breakages found (no textual conflict) and fixed
17a464e51POST /api/admin/platform-config/github-app/manifest/complete) stores integration credentials throughsavePlatformIntegrationConfigbut did not schedule main's (#2747) owner security alert. It also returned status without main's actor labels, and the admin page writes that status into the same query cache the GET fillsintegration-changedand passesincludeActorLabels: true. New test through the real manifest flow, both halves proven discriminating: without the alert the test failsexpected 0 > 0; without the labels it fails'admin'vs'Ada Admin <admin@example.com>'73ebcbfc1AdminSettingNameunion listedoperations.nodeProvisioningAttemptDeadlineMstwice (SonarCloud S4621 one399e0120)73ebcbfc1isSetupCompleted(#2748) closes setup on any install with an active superadmin. That made the branch'scloseSetupWithoutTokenunreachable, and the branch control "a token install with an owner stays open" (setup-without-token.test.ts) failedGET /statususes main's check alone. The control asserts main's 410 withsetup.completedrecorded. The token-less self-host cases keep their testsdd95a017bdeploy/selfhost/README.mdcited the removed helperisSetupCompletedf24eb53a8Discrimination proof for the GitLab union. With the untrusted branch in
fetchGitLabUserInfodisabled, main'sgitlab-sign-in-trust.test.tsfails 4 of 9 tests:All four pass with the branch restored. The branch's
gitlab-oauth-sign-in.test.ts(guarded fetch, redirects, private host, linked email) passes too. It pinsGITLAB_HOSTin the environment, so it runs on main's trusted path.Audit (beyond textual conflicts)
ADMIN_SETTINGS_REGISTRY: 274 entries, no duplicate names, no duplicatelegacyEnvironment.operations.nodeProvisioningAttemptDeadlineMsexists once (60000, 5000-180000, from@simple-agent-manager/shared)apps/api/wrangler.tomlorigin/main(empty diff), including the Durable Object bindings,[[migrations]]and main's two[vars]changes. Hosted git is declared only byscripts/selfhost/selfhost-durable-objects.ts;tests/unit/selfhost/selfhost-only-modules.test.tspasses.pnpm quality:wrangler-bindings: 20 DOs, 22 migrations, no[env.*]0002…0231) are identical on both parents and the result, so the merge introduces none. The branch's only D1 additions are0232_node_reverse_tunnel_leases.sql(still unique) andobservability/0002_analytics_events.sqlapps/api/src/index.tsscripts/selfhost/celld-project.ts,celld-config.tscelld-config.tscopies[vars]generically, so main's newPROJECT_DATA_ARCHIVE_DAILY_WRITE_BUDGET(6000000) andPROJECT_DATA_ARCHIVE_GLOBAL_SWEEP_INTERVAL_MS(540000) flow through. The celld-config and celld-project tests passhosted-gitjob stays. Main'subuntu-24.04pins (Playwright and VM-agent jobs) are keptsam/p1b-box-orphan-sweep-gcp)6265923f3). After the second merge it conflicts in 3 files (see the second-merge section)Test results
Local, on the merged tree:
pnpm install --frozen-lockfilepasses. Main changed no dependency the branch also pins.pnpm build: 18/18 tasks.pnpm typecheck: 36/36.tscforscripts/deployandscripts/selfhost: pass.pnpm check:fast: pass (format ratchet, oxlint shadow, ESLint with the SAM rules, type-boundary ratchet).wrangler-bindings,runtime-tunables,migration-safety,do-migration-safety,migration-orderingfile-sizes,stale-artifacts,source-contract-tests,shared-flight-joinsdependency-governance,direct-dependency-evidence,workspace-test-surfacesnode-pool-boundary,runtime-boundary-semantics,agent-install-manifestskill-references,ast-checks,repo-visibility,no-tracked-stale-binariesscripts/quality/do-migration-compatibility.test.ts): 20/20.pnpm selfhost:test: 538 passed, 5 skipped (36 files). The skips are thenft -cruleset tests: this workspace has nonft, and CI installs nftables.pnpm --filter @simple-agent-manager/api test:hosted-git): 20/20.pnpm test: on the merge state (started one399e0120):github-app-manifest.test.tswas being edited during the run (the S2 test and its discrimination reverts).project-data-archive-sharding.test.ts"never materialises more than one page" hit the 5 s test timeout under full-suite load in this workspace; it is main's test and untouched by this merge.setup-without-token,github-app-manifestandproject-data-archive-sharding: 58/58). CI's Test job is the independent run.selfhost:live-test(no Go or Docker here). CI is the evidence for those.CI, started by hand (integration-branch PRs do not start it):
f24eb53a8(after the first merge): success, every job green. That includes Test, the three Durable Object Workers shards, Hosted git conformance (self-host), Validate Deploy Scripts, Go Vulnerability Diff, VM Agent Test, VM Agent Integration, VM Agent E2E, CLI Test, Devcontainer Volume Mount, Type Check, Lint, Build and Code Quality Checks.e399e0120was cancelled (stale head that still had the red S4 test).105393655(after the second merge): success, every job green (23 succeeded, the rest skipped by path filters; none failed). The PR head2cdfca47adiffers from105393655only by this task's markdown file.SonarCloud (PR analysis, project
raphaeltm_simple-agent-manager): quality gate OK on head2cdfca47a(and earlier onf24eb53a8): 0 bugs, 0 vulnerabilities, 0 code smells, 0 open issues, 0 security hotspots on new code.e399e0120) had one finding: S4621, the duplicated union member that S3 removed.What the next box round must check (app.vmtest.sam2.party; not touched by this task)
GITLAB_HOSTin the box's Worker environment. Its sign-ins are stored under host-scoped account ids (<host>/users/<id>), its emails count as unverified, and its profile is not synced.gitlabAccountScopewill not use the old row.GITLAB_HOST.validStoredValue). Check Admin → Settings.node_provisioning.durable_attempt_failed, notnode_provisioning.attempt_failed, so update log greps.ProviderError (gcp, HTTP 403, PERMISSION_DENIED)innodes.error_message.content-encoding/content-length. A GCP create, the STS token exchange and a DNS call through it must still work on celld./setupanswers 410 once an active superadmin exists (now from main'sisSetupCompleted). A box with a SETUP_TOKEN also closes once it has an owner.security_alert.no_senderin the log.PROJECT_DATA_ARCHIVE_GLOBAL_SWEEP_INTERVAL_MS=540000) with a 6M daily write budget, and celld copies both. Watch box CPU and the archive cron log for the first hours./api/auth/get-access-token,/refresh-tokenand/account-infonow answer as closed. No SAM client calls them (searched web, CLI and selfhost).celld d1 migrations listshould show nothing pending, the same as before the deploy.errorscount above zero fails theprovider_orphan_reconciliationsweep.providerOrphansDeletionRequestedandproviderOrphanAccountErrorsin the log.Decisions for Raphaël
fetchGitLabUserInfo), and main'suntrustedGitLabUserInfo(plainfetch, follows redirects with the access token) is removed. For an untrusted host the branch'skeepLinkedAccountEmailis skipped, because there is no profile override for it to protect. The branch schema requiresusernameandstate, while main's tolerated their absence; real GitLab always sends bothgitlab-login-provider.tsNoticed, not changed (per the brief)
node_provisioning.attempt_failedlog name. It still exists for tunnel-setup failures (node-tunnel-provisioning-failure.ts, main and branch), next to L7'sdurable_attempt_failed. That is two names for related events; it is main's code.apps/www/.../admin-settings.mdkeeps the branch'sagentEmail.smtpTimeoutMsrow. It is branch-only and correct.Validation
pnpm lint(viacheck:fast)pnpm typecheckpnpm test(see Test results)selfhost:test, hosted-git conformance, DO migration compatibilityStaging Verification (REQUIRED for all code changes — merge-blocking)
Does not apply. This branch never deploys to Cloudflare staging. It is a draft PR into the self-host integration branch, and the self-host test box round (owned by another task) verifies it after the merge; see the box checklist above.
Staging Verification Evidence
N/A: see above.
UI Compliance Checklist (Required for UI changes)
N/A. The apps/web edits are conflict resolutions that take main's L4 split and names, keep the branch's existing cap-availability additions, and union two handlers in
AdminPlatformConfig.tsx. No layout changed. Covered by the existing web unit tests (web: all 418 files pass).End-to-End Verification (Required for multi-component changes)
Data Flow Trace
routes/auth.ts→createAuth(auth.ts) →selectGitLabOAuthConfig(config, env.GITLAB_HOST)(platform-config-oauth.ts,identityTrusted,allowPrivateNetwork) →gitLabLoginProvider→fetchGitLabUserInfo(guardedFetch; untrusted:untrustedGitLabAccountSubject,emailVerified: false) → better-auth.routes/admin-platform-config.ts/github-app/manifest/complete→completeGitHubAppManifest→savePlatformIntegrationConfig→scheduleSecurityAlert→getPlatformConfigStatus({ includeActorLabels: true }).Untested Gaps
selfhost:live-testlocally. CI covers both.Post-Mortem (Required for bug fix PRs)
N/A: merge, not a bug fix.
Specialist Review Evidence (Required for agent-authored PRs)
needs-human-reviewlabel added and merge deferred to human: N/A17a464e51)platform-config-core.ts, celld vars. MEDIUM: deadcloseSetupWithoutToken, fixed indd95a017b. LOW: duplicate union member, fixed in73ebcbfc1e399e0120, re-run ondd95a017b)dd95a017b), LOW task-file gaps (fixed). It independently found S2 and S3, already fixed in73ebcbfc1. Re-run: one stale README citation of the removed helper, fixed inf24eb53a8; its stated verdict is PASS with that fix. All 38 both-sides files checked, nothing lostCodeRabbit Review Evidence (Required for agent-authored PRs)
skippingCodeRabbit Notes
Not requested (draft integration PR).
Exceptions (If any)
01M7FB384QHQ1TQCK95D0SX0TX).Agent Preflight (Required)
Classification
External References
N/A: no external API changed. Inputs read before editing: the M1 (#2736) description; per-file diffs of both parents against
84d77aa0f; the #2748 and #2749 commit messages and tests.Codebase Impact Analysis
apps/api: provisioning deadline and attempt logging (L7), GitLab sign-in trust, setup closing, the manifest route, tests.packages/providers: provider-fetch.apps/web: the L4 split and the admin integrations page.apps/www: docs (admin settings, security).deploy/selfhost/README.md.Documentation & Specs
admin-settings.md: the duplicate section is removed.security.md: cites the GitLab untrusted rules' new location.deploy/selfhost/README.md: citesisSetupCompleted.Constitution & Risk Check
🤖 Generated with Claude Code