Repository navigation
M1: merge main (03230e52b, then 84d77aa0f) into sam/selfhost-pass-2 - #2736
simple-agent-manager[bot] merged 36 commits into
Conversation
…session size (#2702) * feat(archive): flip then paged reclaim, and one resumable path for every session size Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(archive): port onto packages/project-data; satisfy the DO migration, AST and lint gates - Imports follow the worker extraction (#2681): worker-core helpers, internal test paths. - Migration 076's triggers are frozen literal SQL; the DO migration safety test allows CREATE TRIGGER IF NOT EXISTS only when its body neither deletes nor drops. - The paged target abandon deletes tool-payload archives and messages with two literal statements instead of an interpolated table name. - Import order fixed; task file records the fold and port. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(archive): re-read the reserved total after a refund within a tick A large candidate reserved and then refused by the root was refunded in D1 but stayed in the per-tick reserved cache, so smaller affordable candidates behind it were floor-refused for the rest of the tick. A successful refund now drops the cache and the next floor check re-reads D1. Scenario test on real DO/D1/R2; reverting the invalidation turns it red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(archive): wake only root objects with an unconfirmed reclaim Staging (9d02820, 3 s wall, 74 eligible sessions) archived nothing: the start-of-tick reclaim pass listed every project with a published journal row, two root-DO RPCs each and past the deadline, because D1 never recorded that a reclaim had finished. 21 clean projects made the tick take 20 s. D1 migration 0237 adds project_data_archive_migrations.reclaim_pending (default 1, so existing and older-coordinator rows are covered). The pass selects only flagged projects. A completed reclaim clears the flag, and so does a complete listing that omits a row snapshotted from D1 before the listing (the fence against a concurrent flip). Copy-back-fenced sessions are listed as fenced and keep their flag. Also addresses CodeRabbit on 9d02820: the unit flip fake no longer deletes, the renewal test now outlasts its lease, and the copy-back test exercises the reclaim fence directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(quality): fix pre-existing lint errors in the DO migration-safety test Sort imports and replace inline require('node:fs') with a top-level import. Behaviour unchanged (11/11 pass). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(task): record staging verification of the reclaim_pending 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>
* chore(tasks): archive the worker modularization task files PR #2681 is merged and deployed. Ticks the remaining checklist and acceptance items with their evidence, adds an Outcome section with the gaps the completion validator asked to have spelled out, moves the brief and the eight workstream notes to tasks/archive, and repoints the two code comments that cite the brief. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * docs: point package AGENTS files at the archived modularization brief Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * docs(tasks): state the staging regression's actual coverage in the archived brief CodeRabbit pointed out that the checklist said "full regression" while the Outcome section lists flows that were not exercised on staging. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
) * docs(www): journal post on splitting the API worker into packages SAM's daily journal entry for #2681: the API worker split into eight workspace packages with narrow env types, ports, re-export forwards and a blocking boundary lint rule, done by coordinated agents in about 20 hours with no behavior change. Adds the X card and a Mermaid browser check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(www): address accuracy review on the worker split post Fix the deep-path example, label the diagram's six feature packages, separate merge and production times, list the untested cron, call the 45 minutes a limit, and gloss D1, bindings, Wrangler and lint. 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>
…ineage (#2710) * feat(connector): profile accounts, pool usage, per-chat model and lineage for monitoring - sam_profiles_list names the account each profile runs on (metadata-only resolver, no decrypt) - sam_usage_get: provider usage per quota pool with freshness, exhaustion and reset times - sam_chat_start accepts a one-chat model/effort override; profile and account unchanged - sam_chats_list carries task state, step and parent beside the stale-prone lifecycle label - sam_tasks_list carries parentTaskId, executionStep and sessionId Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(connector): profile accounts, usage pools, per-chat model, chat task state Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(connector): share agent-key selection, opaque pools, honest SAM-proxy state Review fixes: - Profile accounts now come from the shared selection (agent-credential-selection.ts) that admission uses: cc rows with no match fall through to the legacy table, unusable credential kinds seed nothing, platform credentials are never an account. buildSnapshot gains a metadata-only mode instead of a forked snapshot. - sam_ai_proxy state only when the person chose SAM as provider (Claude/Codex), matching the agent-key route; platform windows from other members are gone. - poolId is an opaque digest: backfilled credential ids embed ciphertext. Ciphertext equality for pools is computed in SQL. - Usage reads only the pool's own references across projects (no row-cap crowding, fewer round trips); chat task enrichment is fault-isolated and bind-limit tested. - Drop v.trim from sam_chat_start (it broke JSON Schema publication); tool count 39. - Legacy precedence tests moved to a real SQL engine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(connector): one SAM-proxy predicate for the agent-key route and account read - services/sam-ai-proxy-fallback.ts: PROXY_ELIGIBLE_AGENTS, AI_PROXY_ENABLED and the explicit-SAM-provider rule, used by runtime.ts and profile-account-bindings.ts - Parity test covers every fixture user (cc, legacy-only, platform+legacy, none) - Legacy platform step-3 test; production-shaped legacy rows in route mocks - Static error text for profile list failures; usage semantics say 'would select' Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive connector account monitoring Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(connector): map pool and provider-mode rows through maybeJsonRecord Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(connector): address SonarCloud findings (sort compare, nested ternaries, complexity) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(operations): keep profile-list error detail for workspace agents only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: revert unrelated formatting from a too-broad prettier run 1899349 ran prettier over apps/api/src/services/*.ts and reformatted 71 files this PR does not otherwise touch. Restore them to the merge base. 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>
* chore(deps): update six backend dependencies together * docs: persist backend dependency review and native runtime evidence * fix(deps): require Node-API 10 compatible development runtimes * docs: record specialist completion audit and staging coordination * docs: record passing full backend dependency quality suite * test(vm-agent): await admission after eviction replay completes * docs: record completed backend validation and reviews * docs: preserve interrupted Workers and staging gate status * fix(security): pin Go 1.26.11 across builds and installer --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
#2713) * feat(web): paint comment quotes in chat and library markdown, click to open Share the comment reader's CSS Custom Highlight painter with the project chat and the library markdown viewer. Open quoted comments are painted faintly by default, the focused comment strongly; clicking painted words opens the newest open thread under them. Surfaces register into one registry so a library preview over a chat cannot erase the chat's highlights. Library comments opened from the Comments page now open the panel on the thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(web): cover comment quote highlights in chat and library Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): land comment links reliably and reveal the quoted words "Open in chat" now always takes the confirmed jump path: the one-shot fast path could be undone by the list's own first scroll to the newest message, leaving the reader at the bottom with the target never rendered. Reveal the open comment's words only when someone is sent to them (a link or a thread's View), not when they click the words themselves. Document the highlights and the library deep link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record comment quote highlight progress Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): address review of comment quote highlights - Select-to-comment keeps working: a click that dismisses a selection (read on press), a double or triple click, and a click on a link are left alone; a mouse click waits out a double-click before opening. - Hit-test only the text lines a quote covers, not block boxes between them, and keep the open thread when its words are under the pointer. - No observer and no paint while there is nothing to paint; each element's text is indexed once per paint however many quotes it holds. - The reveal stops waiting for unfound words after 10s; the reader shares the same user-scroll signals. Deep links use jumpToMessage's confirm option instead of a copy of its body. - Tests: dismiss tap, double click, link, late-mounting log, reveal window (scrolls, settles, stops on wheel, expires, not on click), library deep-link reveal, reader resolved filter, Comments page library link, text-line hits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive comment quote highlights task Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): address CodeRabbit review of comment quote highlights - Paint a comment anchored to a later streamed chunk inside the reply row that absorbed it (useConversationJump exposes rowIdFor). - Statuses painted by default are a named allowlist (open, sent), shared by the chat, library and reader. - Repaint when an image inside the surface loads, so a reveal survives the layout shift. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style(web): sort test imports 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>
…elf-hosted buyer (#2716) * task: rewrite integrations and enterprise marketing pages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * www: rewrite integrations and enterprise pages for accuracy and the self-hosted buyer Integrations: correct OpenCode providers, Mistral Vibe models, GCP setup and volumes, region counts; add Amp and GitLab; move GitHub out of AI Models; sections by buyer question with agent and cloud comparison tables; detail template with dynamic step count and shared footer. Enterprise: self-hosted framing, what-runs-where, data-location table, short security-review answers, real UI screenshots, an explicit not-yet list, mobile-safe comparison table, support CTA. Subpages share one layout and drop claims the code contradicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * www: sync docs with the self-hosted-only model, add drift test and page coverage - docs: OpenCode providers are Zen, Go and Custom; replace hosted-platform wording with installation-administrator wording; features data quota unit is vCPU-hours - tests: integrations-catalog drift test reads packages/shared, providers and AgentSettingsCard source; marketing-pages spec covers the new pages - a11y: underline inline links on enterprise pages; mobile table fixes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * www: move integrations comparison rows into their own module (file size limit) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record implementation notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * www: address review findings on accuracy and coverage - machine lifetime: 4h applies only when idle; 24h absolute ceiling sleeps sessions - firewall wording scoped to the agent port and SSH; metadata block is for containers - shared chats let a teammate prompt the owner's agent - Vibe: uv fetches Python 3.12 itself; OpenCode also accepts compatible endpoints - security doc token table matches code (7d cookie, 1h JWT, 15 min bootstrap) - remaining 'hosted service' wording in docs and two blog posts - Playwright: all enterprise subpages, plus a comparison-table readability check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * www: address UX review on integrations and enterprise pages - comparison table keeps table roles when stacked on phones; labels are silent to screen readers; SAM row highlighted in stacked cards - heroes align with the section grid; count-aware card columns remove orphans - not-yet list moved above product screenshots, solid cards with a tag - screenshots link to full size; full-width hero buttons on small phones - balanced heading wrap, tighter h2 leading, FAQ markers, link-card arrows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive integrations and enterprise pages rewrite Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * www: keep integration copy in JSON, validated at build like feature pages The agent, cloud and platform entries were TypeScript object literals with the same shape, which SonarCloud counts as duplicated code (22.5% new duplication). Move the copy to agents.json, clouds.json and platform.json and validate each entry with asIntegration(), mirroring data/features/*.json. 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: credential-independent node teardown Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(api): split providerless strict teardown into its own module Moves reconcileStrictProviderlessVm out of strict-node-deletion.ts (509 lines, rule 18) and extracts the exact-ownership label comparison into node-provider-labels.ts (nodeProviderLabelsMatch). Behavior unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): tear down nodes after their placement credential rotates Strict teardown no longer depends on the credential that created a node. The pinned placement credential is used while it resolves to its exact generation; otherwise the node owner's current credentials for the provider are tried (provisioning order, then the installation's platform credential), and ownership is proven from the instance: it is re-read right before deleteVM and must carry the recorded instance ID and every exact SAM label (managed, node, role, env, installation, incarnation). A mismatch preserves the VM; a credential that cannot see it is never absence proof. Refusals are named (teardown_credential_unavailable, teardown_instance_not_visible, teardown_instance_ownership_mismatch, teardown_ownership_scope_unavailable), recorded on the node from the shared strict-deletion funnel, raise the existing operator alert, and survive cron re-diagnosis and the stranded sweep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): cover stranded-deadline reason and instance-ID mismatch on credential fallback Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: node teardown no longer depends on the provisioning credential Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): address teardown review findings - Named teardown refusals keep the full failure backoff past the blocked deadline, so a node that needs a person does not re-read the provider every cron tick. - The ownership search continues past a visible instance that is not this node's, so an account-scoped ID collision cannot hide the account that owns the VM. - A credential resolution that threw is a retryable failure, not a teardown_credential_unavailable verdict. - Every enabled platform credential for the provider is a candidate, per-row isolated and without decrypting twice. - The blocked-state recorder alerts only when its incarnation fence matched. - Deployment-role nodes, the stranded sweep and the legacy deployment test are covered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): treat a rejected current credential as unable to see the node's VM A 401/403 from a current owner credential can never answer for the instance, so it counts toward a named teardown_instance_not_visible verdict instead of retrying silently. The blocked-state recorder also skips nodes already proven terminated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): only a credential refusal, not a rate-limited 403, ends teardown as not visible Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): address CodeRabbit review on credential-independent teardown - A project-attributed node also tries the owner's user credential, since createProviderForUser returns only the first tier that resolves. - Refusal classification recognizes GcpApiError 401/403 from token exchange and impersonation, and keeps rate, quota and limit 403s retryable for Hetzner and GCP. - A credential that can read the VM but is refused the DELETE is skipped; the next credential proves ownership again before its own delete (teardown_delete_refused when none may delete). - The operator alert claim is fenced to the runtime incarnation, provider instance and blocked episode the caller observed. - The duplicated-tag test keeps the matching installation label. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): match limit errors by token and name delete refusals consistently A 403 whose text merely contains "rate" (e.g. a project id) is still a credential refusal; only rate-limit, quota and exceeded-limit tokens stay retryable. After a delete refusal, a foreign instance seen through another credential also ends in teardown_delete_refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(tasks): archive credential-independent teardown task with staging evidence Task-file-only change. The code tree is identical to e7343e2, which ran on staging. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): classify credential refusals from structured error codes only isCredentialRejection decided whether a 401/403 was a temporary limit by matching words like "quota" in the message text. A permission refusal that named a resource such as "quota-prod" was then read as a limit, so a read-only credential's refused DELETE stopped teardown instead of moving on to the next owner credential (CodeRabbit, #2715). Only machine-readable codes decide now: the provider error code and Google ErrorInfo reason for ProviderError, and error.status, errors[].reason, details[].reason or the OAuth error code from a GcpApiError body. 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 portable build context implementation * feat: collect portable compose build context without Docker * feat: reserve and verify scoped build-context uploads * feat: collect context on VM and Instant with secret-safe Compose loading * feat: retain verified contexts and record fenced timing history * fix: preserve all Compose inputs and bound graph expansion * feat: verify contexts through isolated publish shadow jobs * style: sort build context shadow imports * fix: use patched zstd dependency and SQL migration imports * docs: record portable context dependency evidence * test: prepare Instant mountpoint for real route fixtures * fix: select context source by standalone runtime role * fix(deploy): anchor build context reads to source directory handles * fix(deploy): prevent FIFO blocking during context root acquisition * fix: bind context upload metadata and classify R2 failures * docs: record phase 2 transport proof and remaining VM gate * fix: address build context review findings * fix: port build context across worker modules and renumber migrations * fix: preserve staging-applied context migration names * fix: recognize applied context migrations in ordering guard * fix: resume context cleanup past slow failures * fix: retry context callbacks with exact committed receipts --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
…line (#2717) * proto(web): connector provenance, usage windows and per-run account variants Dev-only prototype at /prototype/run-account comparing today's UI with variants for: where 'via ChatGPT' sits on a chat-list row, how a usage indicator names its window (5h, week, Opus week), and choosing an account for one run instead of keeping one profile per account. PROTOTYPE ONLY: remove the route and directory before any merge to main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * proto(web): usage round 2, 5h-first ring variants across eight account states Adds Raphaël's ring (arc = 5h left, colour = week health, dot at zero) next to ring + week pip, thick ring + hairline week, and ring + week bar (CodexBar/UsageBar style), all fed the same eight scenarios. PROTOTYPE ONLY: remove the route and directory before any merge to main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(api): choose the agent account for one run Tasks gain agent_configuration_id: the caller's own account chosen for this run, over the profile's. The shared resolver checks it first (a new 'run' tier) and halts rather than falling back when it is paused, missing, another person's, or for a different agent. The profile credential context carries it, so the agent-key callback, provider-limit admission, the AI proxy and credential write-back all resolve the same account. Task submit and chat start validate it before any task effect; wakes and re-runs reuse the task row, so they keep it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): 5h-first usage ring, per-chat account choice, connector on the meta line - Usage ring: the arc is the 5h window, the colour is the week's health (green above half, amber to a quarter, red below), with a dot when the arc is empty. A used-up week empties it; weekly-only accounts draw the week. Words appear only at half or less, the 5h first. - Profile list rows and the Profiles page show every window as a labelled meter in percent left. - 'on <account>' beside To picks one of your accounts for this chat; the low-usage nudge names the limit and offers 'Run on <account>', with an undo. The ring follows the chosen account and submit sends agentConfigurationId. - Connector provenance moves to the meta line: 'Chat via ChatGPT'. - Removes the /prototype/run-account prototype. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: address review of per-run account and usage ring API - Migration renumbered to 0238 (0237 is taken on main). - A run account that can no longer be used refuses at agent-key (refuseHaltedRunAccount) instead of continuing to the platform proxy. - The run tier skips an account chosen for another agent (like a profile pin) and re-checks the owner of the configuration and its credential. - Submit requires the account to carry the caller's own credential. - The AI proxy reads the run account in its existing session query, so no extra D1 read per model call; task lookup by workspace is newest-first. - Tests: wake reactivation keeps the account, submit route through agent-key in one database, platform-mode refusal, other-agent skip. Web - Account list: pressed buttons in a labelled group, focus moves in on open and back to the trigger on close, Escape closes, and a profile on the SAM platform can go back to it. The nudge hides while the list is open and no longer hides a chosen account that is itself low. - Meters say 'left' to screen readers; picker-row meters are decorative. - Card usage words wrap to two lines; the empty-arc dot is not clipped; a week without a reading no longer colours the ring. - Audits updated for the new copy; backlog task for the unrelated onboarding-overlay failures in the nested sidebar audit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(web): the account chosen beside To reaches the submit request Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): runtime asset mock supports the newest-first task lookup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive usage-windows-and-per-run-account Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): carry the run tier through the shared credential selection #2710 moved admission's selection into agent-credential-selection.ts, which maps resolution sources to tiers; a run account resolves as 'run'. Profile account bindings are resolved without a run, so 'run' never reaches them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: fold the run-account tests into the suites they extend The three new run-account test files copied their fixtures from sibling suites (SonarCloud: 10% duplicated new lines). Each now lives in the suite it extends, sharing one fixture set: resolver tiers in composable-credentials-profile-pins, the capability slice in profile-account-pins-capability, and the submit route cases in task-submit-route (renamed from task-submit-source-idea, which now covers both the idea gate and the run account). No test was dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): wrap a long profile name in the account list The profile's name in an account row's caption could not shrink, so one long unbroken name pushed the list 32-480px wider than a phone screen. Found by the staging proof. The new Playwright case measures the list and every row against its client width for a long name and a URL name; it failed before the fix (scrollWidth 810 vs 330). Also files the Connecting... alert-role issue found during the same proof. 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 tunnel settle-window check * task: activate tunnel settle-clock investigation * test(api): anchor tunnel settle checks to persisted create time * docs: record tunnel timing regression and validation evidence * docs: finalize tunnel settle-clock verification record --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
…save (#2718) * task: credential re-save safe for compute pools and node cleanup * fix(api): keep a cloud connection's identity across a re-save and reap nodes whose source was deleted A GCP re-save deleted and re-inserted the credentials row. capacity_sources cascades from it, so the user's pool choices were deleted (GCP unplaceable) and every node placed from it lost capacity_source_id, which the cleanup provenance predicate required (never reaped). - replaceUserGcpCredential updates the row in place, like every other provider's save. - PUT /api/gcp/service-account and POST /api/gcp/setup reconcile capacity pools. - Cleanup provenance accepts a released capacity_source_id only in the cascade's exact shape (column NULL and the named candidate gone); hasManagedVmPlacementProof follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: a credential re-save keeps the pool account; removed accounts' nodes are still cleaned up Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): address review on credential re-save - Duplicate GCP rows collapse onto the row a capacity source is built on. - Released-source provenance also requires the node's own pool to exist and belong to its owner. - Tests: PUT /api/gcp/service-account moves the source's credential version; a released node is never reused for new work; a foreign pool is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record review follow-ups and discrimination evidence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: backlog in-place platform cloud credential rotation Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): give cleanup fixtures the pool tables the provenance predicate reads Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): use a fake credential id in the released-node fixture Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(quality): review the credential-id fixture in this PR's history Commit 538817f's worker test held a credentials:<ULID> row reference (an id, not a secret); 6c39434 replaced it. Accept that exact historical finding, expiring in 30 days. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): address adversarial re-check on credential re-save - Providerless reconcile no longer takes the released-source flag: it needs the exact pinned credential, which a release always deleted. Comment says where such nodes surface. - Name the in-place GCP writer in the credential-version writer table (rule 71). - Tests: released shape binds to the node's own pool scope, project and installation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): state the real reason released nodes skip the providerless reconcile 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: trace archive cursor CI nondeterminism * test: control archive lease time and scope verification observations * docs: record archive test diagnosis and local review * test: isolate unrelated verification from flip fault injector * docs: record archive guard discrimination evidence * test: control large archive copy deadlines under CPU load * docs: record final archive timing guard proofs * test: retire archive fixtures before their summary callbacks leak * docs: record final archive guard proofs and stability progress * docs: record 60 archive cursor passes and completed local reviews --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
* task: track exact JWT lifetime race fix * task: activate exact JWT lifetime fix * fix: derive JWT expiry and issue time from one clock read * task: record exact lifetime regression and review evidence * fix: keep exact access token lifetimes across clock boundaries * task: record final JWT lifetime validation * docs: record verified JWT lifetime staging acceptance --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
* task: plan deterministic Codex rate-limit test correction * test: control Codex rate-limit window clock at minute boundaries * docs: record repeated boundary and mutation test proof --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
* task: investigate archive sharding lifecycle timeout * fix(project-data): index archive search document equivalence lookups * fix(project-data): seek existing projection identities without schema growth * style(test): sort archive helper import * test(api): budget measured archive lifecycle work under CPU contention * test: preserve archive timeout measurements and repeat harness * test: record 30 normal and 30 CPU-loaded archive passes * docs: record archive completion review and release hold * fix: create archive repeat harness output directory --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
* task: plan container rollout completion follow-up * fix: wait for container rollout completion in deployments * test: cover rollout gate on both deployment paths * task: record rollout gate validation progress * fix: identify container rollouts through API snapshots * task: record resolved rollout review findings * task: preserve validation limits and runtime evidence * docs: clarify rollout gate and running binary evidence * refactor: simplify container rollout polling and assertions --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
…tion) (#2725) * task: add cleanup-cron-two-phase-provider-deletion Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(providers): two-phase GCP VM deletion (request + status by operation record) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(api): two-phase provider deletion in the node cleanup cron The stopped/destroying handoff phases and stranded retirement start a provider deletion without waiting for its operation (write-ahead record on the node row), and a new first phase confirms it from the provider's own record before writing termination proof. Handoff candidates rotate by backoff so a failing page cannot hold the head of every tick. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): two-phase teardown at the cleanup cron entry point Cron-entry tests with a provider whose delete outlasts an attempt: reaped across ticks with one DELETE and proof only after the provider records it done, the same after a credential re-save, never-confirming bound with alert, round-robin under a full page of slow candidates, and Hetzner/ownership controls. Existing cleanup tests updated for the new phase and counters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: two-phase provider deletion in the cleanup cron; backlog for remaining slow-delete callers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): scope of NODE_STOPPED_HANDOFF_REQUEST_TIMEOUT_MS in .env.example Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(api): move teardown credential-rejection classifier to its own module Keeps node-teardown-authority.ts under the 500-line limit; re-exported unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): settle real async work between fake-timer steps in the starvation test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: update checklist and discrimination record Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): keep a sent deletion in the confirm phase; confirm mode never sends Review fixes: a failed attempt after the write-ahead record no longer returns the node to stopped (where no phase selected it); the confirm phase clears a record that no longer matches instead of falling through to a new DELETE; phases stop starting attempts below a third of the per-attempt budget; migration renumbered 0241 to avoid open PRs' 0239. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): bound every confirm failure; grace for a DELETE still leaving; page GCP ops Adversarial review: a confirmation failing before the status read now becomes teardown_deletion_unconfirmed past the bound instead of retrying every tick; a not_requested answer within the sender's attempt budget is still pending, so a racing caller cannot clear the record and cause a second DELETE; the GCP operations list follows nextPageToken (bounded). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): node-cleanup call args include the send grace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: honour the sender's recorded grace; stop GCP ops paging at a conclusive page Adversarial delta review LOWs: a confirming caller (e.g. an owner delete) uses the sender's recorded per-attempt budget as the in-flight grace, and the GCP delete operations walk returns as soon as a page shows this instance's delete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): validate the provider deletion record instead of narrowing parsed JSON Runtime-boundary semantic check (blind-external-payload-narrowing). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: CodeRabbit review — attempt minimum capped by phase budget, hold failed in grace, re-read before GCP DELETE - minimumTeardownAttemptMs never exceeds half the phase budget, so a short phase budget or a long per-attempt budget cannot skip every cleanup attempt. - A 'failed' provider record inside the sender's grace is still pending (GCP's record is per instance, so an earlier attempt's failure must not void this attempt's ticket). - requestGcpInstanceDeletion re-reads the instance by name after beforeSend and refuses a different numeric id before the name-addressed DELETE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(providers): re-read the GCP instance by numeric id before the name-addressed DELETE Adversarial delta LOW: a by-name 404 after a rename read as absent. Re-reading by id makes a 404 mean this exact instance is gone, and a changed name is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(providers): fail closed if a GCP id lookup ever stops resolving A 404 by numeric id is reported absent only when the name does not resolve to the same instance; otherwise the request is refused with no DELETE. GET by id verified live (read-only) against sam-prod-infra on 2026-11-14. 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>
… webhook targets (#2727) * task: cut wasted DO SQLite row writes (archive pressure gate, system-owned webhook targets) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix(archive): archive only projects under storage pressure; skip system-owned webhook targets Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test+docs: cover the archive storage-pressure gate and system-owned webhook targets Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test: archive sweep storage-pressure settings resolve through the registry Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * task: record implementation notes Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * fix: exclude system-owned projects at the GitHub project lookup; cover review findings - findProjectsForGitHubRepository() leaves out projects owned by SYSTEM_USER_ID, so both the project-event producer and pull-request tracking skip them - held-session count runs after the migration batch - tests: exact threshold and telemetry-age boundaries, in-flight migration and paged reclaim of a held project, wrapper passes admin settings through, count failure reports null - docs: telemetry-disabled case, measurement interval, shared max bound Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test: give the producer fixture project an owner Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test+docs: address CodeRabbit review on the archive pressure gate - in-flight case no longer depends on wall time: the first tick runs on a controlled clock that only advances when a chunk is written, so the yield happens after six chunk writes - docs: the gate reads the stored reading and its age, not the telemetry switch Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…2732) * fix(deploy): trust completed pinned rollout over stale application list * docs(deploy): clarify pinned rollout completion authority --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
) * task: gcp boot disk scales with the machine (slice 1) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(gcp): size the boot disk by vCPU (20 GB/vCPU, 50 GB floor) and price it The GCP provider created every VM with a fixed 50 GB boot disk and the catalog advertised 50 GB, so an 8-vCPU node admitted about one default workspace and disk ran out before CPU or memory. - gcpBootDiskSizeGb(): max(minGb, gbPerVcpu x vCPUs); admin settings gcpCatalog.bootDiskGbPerVcpu (20) and gcpCatalog.bootDiskMinGb (50) - catalog offerings, static offerings and createVM share that policy; a pool plan's resources.diskGb (the candidate disk) decides the VM size - offering price adds the region's pd-balanced capacity price - every GcpProvider in the API is built by createGcpProviderForEnv() - remove the dead GCP_DISK_SIZE_GB env var and DEFAULT_GCP_DISK_SIZE_GB Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(gcp): boot disk sizing through catalog, pool refresh, reuse and admin settings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record slice 1 implementation notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(gcp): apply review findings for boot disk sizing - route the static catalog fallback through the boot disk policy - build GCP providers with createProvider (GcpProviderConfig gains catalog) - refresh a stored price table that predates boot disk prices at once; warn when a refresh finds no disk prices; a malformed disk map drops only the disk prices - drop unread catalogMetadata.bootDiskGb; revert formatter churn in native-vm-config.ts; import GcpBootDiskPolicy in GcpProviderConfig - tests: lowering the policy keeps nodes reusable, an admin edit reaches the candidate row, settings outage falls back to defaults, static fallback follows the policy, old price tables refresh - docs: precedence, refresh path, quota guidance; blog price note Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(gcp): keep provider resolution free of settings-registry load edges Tests that mock drizzle-orm or the providers package broke once provider-credentials statically reached the admin settings registry. Load the settings module on first use (as gcp-sts already is), move the boot disk default constants to shared next to the other GCP defaults, and keep constructing GcpProvider directly so tests that substitute the class still intercept teardown and provisioning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(shared): GCP large size capacity follows the boot disk policy (80 GB) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive gcp boot disk slice with staging evidence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(gcp): share the Compute stub between the boot disk tests SonarCloud flagged the duplicated stub (4.3% duplication on new code). 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>
…2714) * refactor(api): move the ws-* proxy out of index.ts into route modules Pure move of the workspace-subdomain proxy middleware (index.ts lines 258-732 on main) into routes/workspace-subdomain-proxy.ts and routes/workspace-port-access.ts, mounted at the same position in the middleware chain. No behaviour change. index.ts drops from 1,040 to 543 lines and leaves the file-size exemption list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record L2 local gate results Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record L2 review results Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record L2 merge-hold sources 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> Co-authored-by: simple-agent-manager[bot] <260041690+simple-agent-manager[bot]@users.noreply.github.com>
* fix(placement): compute pool decides VM provider and location Projects and agent profiles/skills carried their own provider and location. The resolved provider was a hard filter on pool offerings, so a project with a stored default_provider could not use offerings its own pool allowed, and failed with "no eligible offering" when those were the only ones. The project default location was mostly ignored, which made the setting misleading. Provider and location now come only from the effective compute pool and the work's resource requirements. An explicit per-request provider/vmLocation (task submit, dispatch_task) and the wake location preference still apply. - scheduler-core: resolveProvider/resolveVmLocation read only explicit and preferred values; project/profile placement types drop the fields - shared: remove provider/vmLocation from profile/skill types and defaultProvider/defaultLocation from Project/UpdateProjectRequest - api: stop reading the columns in placement, chat-start and task-submit runtime selection, retry-subtask, orchestrator scheduling, credential attribution health and offboarding preview; drop them from PATCH /projects/:id, profile/skill REST + MCP schemas and responses - web: remove the Provider & Location section from Project Settings - db: columns kept (migration safety), no longer read or written - docs: compute-pools, concepts, creating-workspaces, idea-execution - tests: new real-SQLite slice through resolveCanonicalVmAllocationPlan with a legacy project row; Playwright scaling audit repaired (stale mocks, onboarding modal, inner scroll container) and updated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(placement): address review of pool-decided provider/location - OpenAPI: drop provider/vmLocation from the AgentProfile schema; regenerate - schema: mark projects.default_provider/default_location and agent_profiles/skills provider/vm_location as retired - tests: MCP field extraction, profile service and eviction recovery assert the new contract (legacy row values are ignored, never returned) - playwright: drop stale defaultProvider/defaultLocation from mocks - docs/rules: overview ranking wording; rule 24 grep example uses a live field - backlog: host ranking still tie-breaks on the platform default location Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: avoid unused destructured bindings in MCP field-extraction tests 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>
…ve) (#2733) * task: add L3 API pure splits task file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(api): split tts.ts into tts-config and tts-text (L3, pure move) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(ai-proxy): split ai-token-budget into ai-budget-settings and ai-monthly-cost-cap (L3, pure move) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(api): split sam-session agent-loop into agent-loop-llm and agent-loop-streams (L3, pure move) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record L3 implementation and local gates Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record L3 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>
Brings #2714 (ws-* proxy moved out of index.ts), #2733 (tts, ai-token-budget, agent-loop splits), #2715/#2718/#2725 (node teardown authority, two-phase provider deletion), #2605 (build-context bundles), #2658 (Go 1.26.11 and dependency upgrades), #2723, #2702/#2724 and the rest of main since 57614ec. 17 conflicted files. Main's structure wins and the branch's behaviour is re-applied on top: - ws-* proxy files: main's text plus the branch's redirect:'manual', node route seam (NODE_UNREACHABLE, node_route_unavailable), reverse-tunnel origin, Caddy forward_auth gateway and x-sam-gateway-secret stripping. - #2733 split files: branch versions (main's split is a pure move the branch already contains; branch adds the speech endpoint, local metering, endpoint routing). - strict node deletion: main's two-phase deletion and teardown authority; the branch's GCP providerless reconcile, manual-deletion hint and reverse-tunnel lease release carried into main's new strict-node-providerless-reconcile.ts. The branch's label matcher is dropped for main's identical nodeProviderLabelsMatch. - isAiProxyEnabled: one resolver (the branch's gateway-aware one); main's samProxyFallbackAvailable now reads it, so the Connector read and the agent-key route still agree. - build-context upload (#2605) signs through the shared R2 presign target, like compose artifacts (same URL on Cloudflare; operator stores work). - baselines merged by content (gitleaks groups, dependency evidence). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* task: track ProjectData per-operation row accounting * feat(project-data): aggregate row usage by operation * test(project-data): prove row accounting boundaries and guards * chore: archive reviewed row accounting implementation * docs: record staging row accounting evidence * fix(project-data): stabilize row accounting checks and address review findings * fix(quality): reject incomplete telemetry calculation ranks --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
…ng the DOM (#2735) * docs(www): journal post on highlighting comment quotes without touching the DOM Covers PR #2713: comment quotes painted in chat and library previews with the CSS Custom Highlight API, click hit-testing, and the deep-link scroll race fix. Adds dark/light UI renders with mock data and the X card. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(www): correct framing per content review The Comments page reader already painted quotes; the jump race was found while testing; resolved comments paint when opened; no-API fallback detail. 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>
…ir the lockfile The merged lockfile had no entry for isomorphic-git@1.38.7: main (#2658) upgraded repo-hosting's pin to 1.44.12 and dropped the old resolution, while the branch's apps/api still asked for ^1.38.7 (hosted-git import). apps/api now pins the same exact version; one copy is resolved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dd the gateway-less case The merge made main's samProxyFallbackAvailable read the branch's gateway-aware isAiProxyEnabled (the resolver the agent-key route uses). Three tests built an env with no AI Gateway, which that resolver correctly reads as a self-hosted box with the proxy off, so they now configure the gateway like every Cloudflare deployment. New case: without a gateway the binding reports the SAM proxy only after an admin turns on aiProxy.directUpstreamEnabled, through the real admin settings write. Verified discriminating: with the kill-switch-only predicate restored, exactly that test fails. Also formats strict-node-providerless-reconcile.ts (one import line). 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
|
The merge replaced the branch's providerInventoryMatchesLabels with main's identical nodeProviderLabelsMatch; the comment still named the old helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merging this PR will not alter performance
Comparing Footnotes
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* task: document project event storage cost investigation * fix(project-events): reduce admission writes and indexed retention cost * test(project-events): pin retention plans and protected-prefix costs * fix(project-events): repair missing alarm sections on admission * docs: archive validated project event cost investigation * docs: record staging release checkpoint * docs: checkpoint owned staging event fixture * docs: record signed staging wake and verified cleanup * fix: retry event alarm scheduling across failures and eviction --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
* task: investigate archive compatibility and lifecycle CI flakes * fix(ci): avoid nested coverage pools and tied-time order assumptions * test: record guard mutations and bounded repeat-run harness * test: record 30 normal and first 10 loaded compact runs * test: record second loaded compact batch and package checks * test: force tied lifecycle timestamps and finish compact stability proof * test: record first five tied-clock lifecycle repetitions * test: record fifteen lifecycle runs and mutation reproduction details * test: log CI CPU capacity and record 25 lifecycle runs * test: complete thirty normal lifecycle file runs * Record first loaded lifecycle stability batch * Compare bounded middle CI budget after serial benchmark and 120 stable runs * Select measured middle CI budget and record comparison limitations * Reconcile final review findings with completed evidence * Stop active verification test groups when the harness is interrupted * Clean probe process groups even before readiness is published * Retain interruption evidence without shipping the one-off probe collector * docs(test): retain recorded evidence without repeat helper --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coordinator review (task 01M7AF82KG9C78WAABTG3V1MN1)Reviewed head Checked by me:
Relied on, not re-run: the conflict table and silent-breakage fixes S1 to S7, the test totals, security-auditor and task-completion-validator. Not verified anywhere yet: a full-Worker boot on celld with D1 from this tree (the author had no Docker); the next box round does that. |
1652457
into
sam/selfhost-pass-2
|



Summary
M1: merges
origin/mainat03230e52b79e394e2251572b815146e9649c8460, then once more at84d77aa0f(see the second merge below) (contains #273303230e52band #2714bc5a6cc94) into the self-host integration branchsam/selfhost-pass-2atc0935ad06cdb4e37e018aca6e46d240b19574471. It is a merge, not a rebase, and the base is the integration branch, nevermain. Draft: do not merge without the coordinator's review. Model: #2709 (L0).57614ec6b. 17 files conflicted; all are resolved (table below).redirect: 'manual'on both proxied fetches, the node route seam (readNodeAgentRouteRow/nodeAgentRouteFromRow/NodeAgentRouteError, 503NODE_UNREACHABLE, thenode_route_unavailableports payload), the reverse-tunnel loopback origin, the Caddy forward_auth gateway, andx-sam-gateway-secretstripping on both paths.workspace-port-access.tsis byte-identical to main. Main's text differed from the branch's only in header comments, so nothing main changed in that block is lost.tts-config.ts,tts-text.tsandagent-loop-streams.tsare byte-identical. The other six files are the branch's versions:git diff origin/main HEADon them shows only the branch's additions (speech-endpoint synthesis, local metering, the env argument and refusal message, endpoint routing,callOpenAIChatLLM, the availability error).git diff --shortstat origin/main...HEAD):527f16b95; the same against57614ec6b).2523e6ee3: 841 files, +82,933 / -2,808 (against03230e52b).20cdb9941(main84d77aa0f): 844 files, +83,041 / -2,814. The extra files over the merge commit are this task's file and the new tests.Second merge: main moved once, to
84d77aa0f2cfa69a1e12f0f2fca7bf65b0c0fa50Main gained four commits while this PR was in CI: #2728 (CI coverage pools, deterministic lifecycle ties), #2729 (ProjectData row-usage attribution), #2734 (fewer project-event writes, retention FK scans) and #2735 (journal post). They were merged in once (
20cdb9941). Per the brief, main is not chased again.apps/api/src/services/admin-setting-definitions.ts. Main added'operations.projectDataRowUsageIntervalMs'and the branch addedOutboundSettingName. Resolved as the union of both members.077-project-event-storage-cost-indexes(indexes only), which runs on each ProjectData object's first access.check:fast, ten quality gates, project-data tests (529) and the newcheck-project-data-rowstests (16). The admin-settings unit tests also pass (59).Conflict table
.github/workflows/ci.ymlapps/api/src/index.tsbuildContextCallbackRouteregistered (#2605)projectsRoutes)apps/api/src/routes/workspace-subdomain-proxy.ts(add/add)index.tsapps/api/src/routes/workspace-port-access.ts(add/add)apps/api/src/services/tts.tsai: Aiparameters the branch generalisedapps/api/src/durable-objects/sam-session/agent-loop.ts,agent-loop-llm.ts(add/add)callOpenAIChatLLMand the availability errorpackages/ai-proxy/src/ai-token-budget.ts,ai-budget-settings.ts(add/add),ai-monthly-cost-cap.ts(add/add)envargument andMONTHLY_COST_CAP_UNAVAILABLE_MESSAGEapps/api/src/routes/workspaces/runtime.tsPROXY_ELIGIBLE_AGENTSand a syncisAiProxyEnabledmoved to newsam-ai-proxy-fallback.ts;refuseHaltedRunAccount(#2710)await isAiProxyEnabled(env)fromai-proxy-availability.ts(gateway-aware; off on a gateway-less box untilaiProxy.directUpstreamEnabled)samProxyFallbackAvailable(main) now awaits the branch resolver, so the Connector read and the agent-key route still agree (main's stated intent). On Cloudflare both are the kill switch aloneapps/api/src/services/strict-node-deletion.tsreconcileStrictProviderlessVmto newstrict-node-providerless-reconcile.tsCOMPLETE_INVENTORY_PROVIDERS), manual-deletion hint, recovery-window message, reverse-tunnel lease releasereleaseTerminatedNodeTunnelsapps/api/src/services/strict-node-deletion-shared.tsresolveStrictNodeProvider;hasManagedVmPlacementProof(node, capacitySourceReleased)COMPLETE_INVENTORY_PROVIDERSandproviderInventoryMatchesLabelsCOMPLETE_INVENTORY_PROVIDERS. The branch's matcher is dropped for main's identicalnodeProviderLabelsMatch(node-provider-labels.ts);node-operator-retirement.tsnow uses itpackages/app-deployment/src/compose-image-artifacts.tsgetS3Client(env, checksumMode)for #2605apps/web/src/pages/comment-reader/ReaderConversation.tsxquote-highlightmoved, import order changedusePlatformCapabilitiesimportscripts/quality/direct-dependency-evidence.jsongolang.org/x/vuln/cmd/govulncheckscripts/quality/gitleaks-reviewed-baseline.jsonSilent breakages found (no textual conflict) and fixed
pnpm install --frozen-lockfilefailed: main (#2658) moved repo-hosting'sisomorphic-gitto 1.44.12 and dropped the 1.38.7 resolution, but the branch's apps/api asked for^1.38.7(hosted-git import)1.44.12, the same version as repo-hosting. Lockfile = main's + 34 lines (the same delta as L0)115157d27build-context-upload.ts(no conflict) importedgetS3Client, which the branch removed. On a self-hosted box it would have signed against*.r2.cloudflarestorage.comgetR2PresignTarget(env, 'WHEN_REQUIRED'), as compose artifacts do. On Cloudflare the URL is identical (endpoint, regionauto, bucket, key, checksum mode,x-amz-meta-sha256in the signed headers); operator stores now work. Newapps/api/tests/unit/services/build-context-upload-presign.test.tscovers Cloudflare, operator store and the rejected promise2523e6ee3samProxyFallbackAvailable(new on main; no conflict) read the kill switch only. On a gateway-less box the Connector would report a SAM proxy that the agent-key route refusesprofile-account-bindings.tsawaits it2523e6ee3strict-node-providerless-reconcile.ts(new on main) had main's Hetzner-only body, so the branch's GCP providerless delete (e9ce2e5) and owner escape hint would have been lost silently2523e6ee3node-operator-retirement.ts(branch) importedproviderInventoryMatchesLabelsfrom the shared modulenodeProviderLabelsMatch2523e6ee3profile-account-bindings,account-usage) built an env with no AI Gateway and expected the proxy onaiProxy.directUpstreamEnabledwrite. Proven discriminating: with the kill-switch-only predicate restored, exactly that test failse08088ccascripts/selfhost/teardown-gcp.tscited the removedproviderInventoryMatchesLabelsnodeProviderLabelsMatchc6dd79553Checked and found no breakage:
wrangler-bindings,runtime-tunables,agent-install-manifest,skill-references,ast-checks,shared-flight-joins(2,112 files, 0 findings),file-sizes,stale-artifacts,migration-safety,do-migration-safety,source-contract-tests,no-tracked-stale-binaries,dependency-governance,workspace-test-surfaces,migration-ordering,repo-visibility,runtime-boundary-semantics,node-pool-boundaryanddirect-dependency-evidence.tests/unit/selfhost/key-rotation.test.ts): passes. Main adds noiv/*_iv/ encrypted column (searched the schema, D1 migrations and project-data diffs).GO_VERSION, everyAssert Go version, the installer-engine preflight (main moved it togo1.26.11), the bootstrap URL, the selfhostvm-agent-artifacts.tsimage, sam-mx (golang:1.26.11) and everytoolchain go1.26.11.wrangler.toml(selfhost:test and the local project build).isAiProxyEnabled/getS3Client/ label-matcher duplicates remain.resolveStrictNodeProvideris removed as on main.Migration findings
0232_node_reverse_tunnel_leases.sql: not renamed. Main adds no 0232.pnpm quality:migration-orderingpasses.ALTER TABLE ADD COLUMN/CREATE INDEX IF NOT EXISTS).migration-safetypasses.0230_publish_job_build_context.sql:deployment_publish_jobs+5 columns (executorNOT NULL DEFAULT'node'with CHECK).0231_publish_job_context_shadow.sql:deployment_publish_jobs.context_shadowNOT NULL DEFAULT 0.0237_archive_reclaim_pending.sql:project_data_archive_migrations.reclaim_pendingNOT NULL DEFAULT 1, plus a partial index.0238_task_run_agent_configuration.sql:tasks.agent_configuration_id.0241_node_provider_deletion_request.sql:nodes.provider_deletion_requested_at,nodes.provider_deletion_json.0230and0231now each have two files (0230_capacity_pool_excluded_sources/0230_node_cloudflare_tunnels/0230_publish_job_build_context;0231_node_tunnel_pending_creates/0231_publish_job_context_shadow). That is main's numbering, not this merge's. None collides with 0232.d1 --help). Both are independentADD COLUMNs.v22, so the branch'sv23(HostedGitRepo) keeps its tag.076-archive-source-write-generation(a new table, two columns, write-generation triggers). It runs on each ProjectData object's first access.Test results
Local, on the merged tree (
e08088cca;3d995fbab/115157d27for the earlier steps):pnpm install --frozen-lockfile: fails on the raw merge (S1); passes after S1.pnpm build: 18/18 tasks pass.pnpm typecheck: 36/36 pass.tsc -p scripts/deployandtsc -p scripts/selfhost: pass.pnpm check:fast: pass (format ratchet, oxlint shadow, ESLint 22/22 with the SAM rules, type-boundary ratchet).turbo run teston3d995fbab: 38/39 tasks pass.e08088cca; the two affected files then pass 24/24 and the build-context presign test passes.pnpm selfhost:test: 485 passed, 5 skipped (32 files). The extra skips (L0 had 2) are thenft -cruleset tests: this workspace has nonft. CI installs nftables.deploy/selfhost/sam-mxmodule, because a dispatched run diffs againstorigin/main.selfhost:live-test: it needs Docker.e08088cca: all jobs green on the first attempt. That includes Test, the three Durable Object Workers shards, Go Vulnerability Diff (which also scanned the branch-only sam-mx module), VM Agent Test, Integration and E2E, CLI Test, and Validate Deploy Scripts.selfhost:test: 488 passed, 2 skippedselfhost:live-test: 297/297 (16 files: real Caddy, frp, celld 0.6.3 and the fence namespace)3d995fbabwas cancelled after the local suite found S6. The commits aftere08088ccaonly change a comment inteardown-gcp.tsand the task file.b0fd3a18a: all jobs green on the first attempt (conclusionsuccess).20cdb9941: all jobs green on the first attempt (conclusionsuccess). Counts: api 16,292 passed / 4 skipped; web 5,284;selfhost:test488 / 2 skipped;selfhost:live-test297/297; deploy and quality scripts 920; installer engine 120. This is the CI evidence for the PR head: the headf95a5e2f3differs from20cdb9941only by this task's markdown file.celld boot (local, partial: no Docker for the object store)
The scratch script was not committed. It used the deploy's own generator (
buildCelldConfig+prepareCelldProject+celldDeployConfig+writeCelldConfig) with freshly generated platform keys and the apps/web build, then pinned celld 0.6.3 (downloaded and checksum-verified byensureCelldBinary), with esbuild resolved as the deploy does. The full Worker ran undercelld dev(local state, no bucket):wrangler.tomlHostedGitRepoboundcelld-main.ts→apps/api/src(every workspace package)GET /health{"status":"healthy"}GET /api/config/platform-capabilitiesmonthlyCostCap: truevia local metering)GET /api/setup/status(D1)no_such_table: not a merge defect.celld devdoes not apply D1 migrations, andcelld d1 migrations applyneeds a fleet bucket. The bucket is the pinned MinIO image, and this workspace has no DockerNot verified locally: D1-backed probes (seeded-token sign-in,
/api/admin/settings,/api/projects). They need the object store. CI's live suite runs real celld 0.6.3 with probe Workers; the box deploy is the full-Worker check (see below).What a box agent must check after deploying this
Migrations: expect exactly five newly applied D1 files:
0230_publish_job_build_context.sql0231_publish_job_context_shadow.sql0237_archive_reclaim_pending.sql0238_task_run_agent_configuration.sql0241_node_provider_deletion_request.sql0230 and 0231 apply after 0236 (out of numeric order, by name).
celld d1 migrations listshould then show nothing pending. If0232_node_reverse_tunnel_leases.sqlis pending or re-applied, stop.Archive reclaim:
0237marks every existingproject_data_archive_migrationsrowreclaim_pending = 1, so the archive reclaim path (feat(archive): flip then paged reclaim, one resumable path for every session size #2702, Fix archive timeout and quadratic projection lookups #2724) will run over every already-archived session after the deploy. Watch the cron log and box CPU and memory for the first hours. Spot-check one archived session's history still loads.ProjectData DO migrations 076 and 077 (write-generation triggers) runs on the first access of each project. Open two projects' chats and check for errors in the celld log.
Node teardown: fix(api): tear down nodes after their cloud credential rotates #2715, fix(api): keep pools and node cleanup working across a credential re-save #2718 and fix(api): cleanup cron finishes GCP teardown (two-phase provider deletion) #2725 added two-phase provider deletion and current-owner-credential teardown.
deleted, withnodes.provider_deletion_requested_atcleared after proof.provider_instance_idshould still be found by its labels (the branch's providerless path).Workspace proxy moved (refactor(api): move the ws-* proxy out of index.ts (L2, pure move) #2714):
node_route_unavailable).AI proxy on a gateway-less box:
aiProxy.directUpstreamEnabledoff,sam_profiles_listmust show nosam_ai_proxybinding and agent-key must refuse the proxy.Build-context bundles (Add portable deployment build-context bundles #2605), if app deployments are on: a compose publish that uploads a build context presigns through the operator store (
R2_S3_*). Verification then heads the unprefixed key on the R2 binding, which only works if the box's binding maps to the same prefix (asr2-presign-config.tsdocuments).Hosted git: import one repository. isomorphic-git is now 1.44.12.
vm-agent: built with Go 1.26.11, so the release identity rotates. New nodes get the new agent; existing nodes are judged by
VM_AGENT_REQUIRED_VERSIONas before.Decisions for Raphaël
r2-s3-client/ operator stores. Main's private client duplicates the shared one (rule 24)isAiProxyEnabled/samProxyFallbackAvailablenow use the gateway-aware resolverAI_GATEWAY_IDandCF_ACCOUNT_IDare set (always, on SAM's deployments)Findings outside the merge (not fixed, per instructions)
classifyName(worker-corenetwork-hosts, branch) no longer refuses*.metadatanames, which main's old image-resolver check did. Negligible: the name is not a delegated TLD.recordManualNodeDeletionreleases Cloudflare tunnels inline but not reverse-tunnel leases. Those wait for the lease sweep's next tick.POST /:id/agent-keyawaitsisAiProxyEnabledbefore checking proxy eligibility. That is the branch's code since L0, unchanged here. On a gateway-less box it costs one cached admin-settings read per call.admin-settings-resolution.ts,profile-tools.tsandcelld-config.tssit at exactly 500 lines.Validation
pnpm lint(viacheck:fast)pnpm typecheckpnpm test(see Test results)selfhost:test, partial celld bootStaging Verification (REQUIRED for all code changes — merge-blocking)
N/A by task instruction: this is a draft PR into the self-host integration branch, which never deploys to Cloudflare staging. A self-host test box round verifies it after the merge; that is owned by another task.
Staging Verification Evidence
N/A: staging is overridden. See the celld boot and the box checklist above.
UI Compliance Checklist (Required for UI changes)
N/A: the only apps/web edit is an import union in
ReaderConversation.tsx. The Playwright audit is skipped by instruction.End-to-End Verification (Required for multi-component changes)
Data Flow Trace
routes/projects/build-context-callback.ts→services/build-context-upload.ts(shim) →getR2PresignTarget(env, 'WHEN_REQUIRED')(services/r2-s3-client.ts) →@simple-agent-manager/app-deploymentcreateBuildContextUpload→getSignedUrl.profile-account-bindings.ts→samProxyFallbackAvailable(sam-ai-proxy-fallback.ts) →isAiProxyEnabled(ai-proxy-availability.ts). That is the same resolverroutes/workspaces/runtime.tsPOST /:id/agent-keyawaits.Untested Gaps
CI covers all except the full-Worker D1 boot, which the box deploy covers.
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/ArefuseHaltedRunAccountand custom-base-URL refusal, presign equivalence and key scope, AI budget files). 2 LOW in branch-only code outside the merge (listed above)e08088cca)57614ec6b(supersessions all documented here), found no duplicates, and confirmed the PR claims, migrations and new tests. MEDIUM: CI was pending at review time; now green. LOW items: the shortstat was refreshed (done); the agent-key route awaits the AI-proxy resolver before the eligibility check, which is pre-existing branch code the merge did not touch (listed under findings)CodeRabbit Review Evidence (Required for agent-authored PRs)
CodeRabbit Notes
Not requested: the dispatching coordinator told this task to skip CodeRabbit.
Exceptions (If any)
01M7AF82KG9C78WAABTG3V1MN1).Agent Preflight (Required)
Classification
External References
N/A: no external API changed. Inputs read before editing: the #2709 (L0) description; the #2714 and #2733 diffs; per-file diffs of both parents against
57614ec6b; celld 0.6.3--help,dev --helpandd1 --help.Codebase Impact Analysis
apps/api: proxy routes, agent-key, strict node deletion, build-context shim, Connector bindings, tests.packages/app-deployment: build-context upload.scripts/quality: baselines..github/workflows/ci.yml.apps/web: one import.Documentation & Specs
No doc change needed. The resolution adds no new behaviour on Cloudflare, and the self-host behaviour it keeps is already documented on the branch.
Constitution & Risk Check
🤖 Generated with Claude Code