Repository navigation
M4: merge main into selfhost integration (staged) - #2884
simple-agent-manager[bot] merged 281 commits into
Conversation
Bumps library/docker from `08a9801` to `7bf70dc`. --- updated-dependencies: - dependency-name: library/docker dependency-version: 7bf70dcb85c822e3fa6f2d332143e474b99147b9d7b39102b0cfe8b04a7dd61b dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
* feat(insights): record run token usage (agent_run_usage) and show it on the receipt Insights slice U, control-plane side: migration 0253 agent_run_usage, the harness writer on the usage callback (cumulative, per-column MAX), the AI proxy writer (measured usage only), the shared operations read and the receipt's Tokens tile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(vm-agent): report run token usage on the usage callback Claude Code and OpenCode turns are read from the ACP prompt response and folded into per-model running totals under one epoch per host; Codex thread totals come from the rollout file the usage probe already tails. Reports are cumulative, so repeats and reordering cannot double count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(insights): run usage across the VM agent → API boundary, scope attacks, receipt tokens UI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(insights): run receipt tokens, run usage sources and the token rows setting Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(insights): lint and format run usage files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(insights): address run usage review findings - Codex reports one model per thread; totals restart on a credential switch; model count and name length match the schema; token reports drain on stop - AI proxy: budget accounting first, run-usage write via waitUntil - Counters clamped, reads sum with TOTAL(); no-op upserts write nothing - Project delete removes agent_run_usage; spend on another member's personal key is private; unused account read removed until slice A - Receipt: failed reads and live runs say so; per-model spend and floor label - Tests: proxy route wiring, old control plane schema, privacy, overflow Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive insights slice U task file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(vm-agent): move prompt retry helpers out of session_host_prompt.go (file size limit) 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 invalid admin settings row isolation * fix: isolate invalid admin setting overrides and show safe fallbacks * docs: record admin settings isolation validation and review evidence --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
…orce-resume-zm2n4q
…ivery and Stop gate (#2804) * task: add codex-repo-hook-trust (active) * feat(agents): restore the Codex rule-delivery hook and Codex Stop entry, with the review's missing tests * style: sort imports * refactor(vm-agent): move per-agent startup config writers to session_host_agent_config.go (pure move) * feat(vm-agent): SAM Codex sessions trust the repository's Codex hooks (bypass_hook_trust + project trust in CODEX_CONFIG) * docs: Codex sessions run repository hooks; rule delivery for Codex * chore(diagnostics): seed script for the staging Codex hook probe * task: progress * fix(vm-agent): trust key is the ACP cwd verbatim, never /; standalone test; docs state the full trust scope * fix(vm-agent): only bypass_hook_trust is needed (codex-acp already trusts the session project); real-process test of repository hooks through codex-acp * task: progress (local proof, staging wait) * chore: task text matches the final design; note at the Codex pins to rerun the hook probe * test(vm-agent): share the real-adapter process and mock-stream helpers; force HTTPS in the probe seed script SonarCloud flagged 33 duplicated new lines (the hook probe repeated the adapter-start and Responses-stream code of the pinned and steering process tests) and plain curl redirects in seed-codex-hook-probe.sh. The three tests now use startACPAdapterProcess, adapterCommand and writeResponsesTurn; the hook probe still passes against codex-acp 2.1.1 and Codex 0.160.0. gateway.go gets the blank line gofmt wants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: task state (staging queue, Sonar fix, CodeRabbit outcome) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: task state (staging queue at 19:45Z) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: archive the Codex repo-hook trust task with its staging evidence 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>
…s archived task (#2827) The archive move in #2804 staged the rename before these edits, so main kept the unticked checklist. Ticks the staging, review and acceptance items and adds the staging evidence note (deploy 43971455359, VM and Instant sessions). Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…2818) * task: inbox slice H1 human tasks (server side) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * wip(inbox): human task storage, comment anchor and person operations Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * wip(inbox): agent task operations, wake policy trigger, sam.inbox event guard and wake text Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * wip(inbox): API task port (events, watches, comments, notifications) and comment-wake decision Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * wip(inbox): task REST routes, MCP assign/comment/attach, task detail on reads Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * wip(inbox): task discussion in Comments inbox, departed-member handoff, assign in turn-end text Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(inbox): human task capability tests through MCP and REST with wake-rule, viewer and cross-project guards Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(inbox): wake policy trigger, sam.inbox matching guard, departed member, cancel, Comments page filter Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(inbox): human tasks in the inbox guide, agents guide, API reference and settings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(inbox): stored comment anchor kinds apart from the client anchor union; fewer round trips on the comment path Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(inbox): review findings — watches renew per change and wind down when closed, same-owner attach without comment wakes, notice after outbox commit, admission off the request path, member checks in writes, chunked Comments read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(inbox): reassign, archive, untick, wakeOnSteps, same-owner attach, watch renewal, direct subscription refusal, inbox-item comment scope Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(inbox): closed-task watch setting and same-person attach Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: sort shared exports Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(inbox): CodeRabbit review — whole-number step index, write scope for task changes, member checks in claim, notice reset on reopen, task cap in the INSERT, atomic departed handoff, replayed comments wake nobody, owner's other chats read the task, task gate in the generic answer path, docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(inbox): non-numeric step index is refused Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(inbox): literal SQL in the watch renewal (AST sql-injection check) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(inbox): concurrent claim race; finished filing chat records changes without a wake through the real alarm path Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(inbox): departed-member handoff through the real offboarding preview/apply routes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive inbox slice H1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: drop stale insights import left by the main merge Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(inbox): guard the moved-task rows in the departed-member handoff (runtime-boundary check) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ci): drop the gitleaks baseline group that expired 2026-11-17T00:00Z The group (reviewed 2026-08-19) pinned PEM delimiter literals at old line positions in apps/api/src/services/github-app.ts; W7 moved that code to packages/repo-hosting, where a 2026-11-12 group covers it. The scanner fails on any expired entry even with no matches, which blocks every branch and main. With the group removed, the current-tree scan passes (43 reviewed, 0 new) and the PR-range scan passes (0 new), so the group matched nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ci): keep the baseline file's formatting; only the expired group is removed 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>
…tes) (#2820) * feat: platform capabilities seam (L11): resolver, public endpoint, voice and model gates Land slice L11 from sam/selfhost-pass-2: a pure resolver for which platform services this installation has (Workers AI, speech-to-text, text-to-speech), errors.featureUnavailable (404 FEATURE_UNAVAILABLE), the public no-I/O GET /api/config/platform-capabilities, the TanStack Query hook, and the mic, read-aloud and model-catalog gates. Every capability resolves true on Cloudflare; the web assumes all present while loading or on error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: address L11 review findings - Prefetch platform capabilities once at app start (covers profile/skill forms outside project routes); drop the now-redundant project prefetch. - Keep the model-access field label when model calls are unavailable. - Port the agent-models without-Workers-AI test (list, run, MCP, cache order). - Document the agent-facing not_available code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style: format agent-model-access-field test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive L11 platform capabilities 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>
* fix: harden node and GitLab redirect boundaries * fix: cover container session probes and synchronize redirect docs * test: prove redirect limits and credential allowlisting * fix: preserve authenticated local port-forward app redirects * fix: preserve node cache revalidation responses * test: share proxy request inspection setup * docs: archive L6 validation and staging evidence --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
…2822) * feat(admin): retire SaaS-era Admin Analytics sections (Insights H2) Remove the signup funnel, geographic distribution and weekly retention cohorts from Admin Analytics: their API routes, Analytics Engine queries, constants, env vars (ANALYTICS_GEO_LIMIT, ANALYTICS_RETENTION_WEEKS), middleware event names, web components, fetchers, types, hook queries, the KPI funnel card, the react-simple-maps/d3-scale dependencies and VITE_GEO_TOPOJSON_URL. DAU, top events, feature adoption, website traffic, AI usage and event forwarding are unchanged. No storage changes: the sections read the Analytics Engine dataset, which the kept sections and forwarding still use. Also fixes the chart category labels, which used an undefined colour token and rendered black on dark panes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive insights H2 task file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(admin): address H2 review findings - KPI grid sizes its desktop columns to the cards present, so a partial load leaves no hole; render test covers 1, 2 and 3 cards. - Remove an empty effect branch on the Analytics page. - Document /forward-status; list two existing analytics vars in .env.example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(admin): share the kept-sections audit between viewports Removes the duplicated test body SonarCloud flagged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(admin): collapse repeated audit scenes into captureScene Clears the SonarCloud new-code duplication gate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(admin): drive audit scenes from one table for both viewports 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>
* feat(insights): Cloudflare cost snapshot core, table, daily job and Health & cost read Move the rule-76 billed-metric analysis behind pnpm quality:cloudflare-cost into packages/shared/src/cloudflare-cost so the CLI and the Worker share it, adding Workers requests (tail invocations excluded), Workers CPU and KV. Add migration 0256 (installation_cost_daily, installation_cost_sync), a daily isolated snapshot job, a superadmin refresh route and a cloudflare section in installationHealth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(insights): Cloudflare card on Admin Health & cost, with tests and visual audit Month to date, the recent-rate projection, top product lines, a daily series and a Refresh now button; unconfigured, permission and error states explain themselves. Tests cover the GraphQL fixture mapping, idempotent upserts on the real migration, the unconfigured token, scheduled-step isolation and the projection math. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(insights): Cloudflare cost snapshot, Account Analytics Read permission Document the Cloudflare card, the daily snapshot, its settings and the refresh route; list Account Analytics Read as an optional runtime-token permission and request it in hosted-installer runtime tokens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(insights): sort imports and exports Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(insights): address slice CF review findings - Classify Cloudflare's real auth error shapes (10000, 9106, authz) as permission and read the error body on non-2xx responses. - Never overwrite stored days with a response that has no usage for them; read stored usage across the whole window for the month's allowance. - Throttle Refresh now (insights.cloudflareCostRefreshMinSeconds, 429). - insights.healthCloudflareProjectionDays; defaults from the setting definitions; rows_written kept from the last success; prices checked-on date on the card. - Card: labelled daily chart with a table, dashed missing days, so-far/projected labels and two-tone bars, status emphasis, refresh toasts for every outcome. - Revert the installer runtime-token permission (OAuth grant lacks the scope); tracked in idea 01M7KABJJ3H6XQ812REW68MJZT. - Tests: bind ceiling across a full window, real auth shapes, empty response, writer-to-reader chain, throttle, projection days, settings max = CF limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(insights): address CodeRabbit review on slice CF - Storage projections add the observed days' accrued cost to the latest level for the remaining days (CLI and card). - A dataset that is not a list fails the request instead of reading as zero. - Stored days the fetch omits keep usage and fetch time but get their cost recomputed after an earlier day changes. - The card read is anchored on the latest well-formed stored day and skips impossible dates. - Refresh now claims its interval with one conditional write, so overlapping presses make one Cloudflare call. - Shared-package tests for the cost core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(insights): drop unused fixture 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>
* docs(www): weekly claims audit — Inbox on roadmap, secret_request in concepts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(www): concepts — only some notifications are Inbox Updates 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>
…2833) * fix(deploy): treat pull_request_checks as a reviewed churning table GitHub webhook traffic prunes orphaned pull request check observations between the pre- and post-migration row counts, so a deploy that applied an additive migration (0254) was refused at 28243 -> 28201 (production run 44010648016). Add the table to the reviewed churning list (bounded 50% decrease), add a regression test from the incident's numbers, and sync the docs to the actual list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(deploy): pin the pull_request_checks churning cap and document override drift 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>
* feat(insights): projectSetups read for the Agent setups tab Shared operation, REST route and ProjectData nudge count behind Insights · Agent setups (slice S). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(insights): Agent setups read on real SQL and the real ProjectData object Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(insights): Agent setups tab, suggestions and docs Replaces the coming-soon Agent setups tab with the real read: setups by profile, skill or model, a comparison, and one-tap skill suggestions applied through PATCH skill. Playwright audit at 375 and 1280. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(insights): address Agent setups review findings Never echo a free-text profile hint; suggest only project profiles as a skill default; count nudges once per chat; mark partial measures and small samples; name compared bars in text; cards below lg; refresh the skill list after applying a suggestion. Tests for each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(insights): pick runs first, join rework, drive per-run reads by index The setups statement scanned later pull requests once per merged run across the whole range (14.4 s at 9,000 runs / 30,000 PRs). It now picks the newest runs first, joins rework on an automatic index and drives the token and memory reads from the picked runs (159 ms on the same data). Query plan pinned by a test. One unreadable chat no longer fails every nudge count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: record Agent setups progress and review outcomes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(insights): resolve a profile hint that names a project profile Tasks store the profile hint as typed, often a name. Resolve names against this project's profiles only (unique per project), as submission does; an unresolved or personal-name hint still reads as not recorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: archive Insights Agent setups with staging evidence 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>
…lity (L12) (#2829) * task: plan L12 OpenAI-compatible endpoint landing * task: activate L12 landing plan * refactor(ai): split passthrough preparation from forwarding * refactor(workspaces): split runtime callbacks by concern * feat(ai): route admin model endpoints and guard authenticated upstreams * fix(ai): cache endpoint credentials atomically across isolates * docs: record L12 validation and review evidence * refactor(api): reuse callback identity and credential response boundaries * docs: archive validated L12 implementation for release gates * test: preserve schema exports in account setup fixture * test: synchronize diagnosis races at actual model request --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
… new screenshots (#2837) * docs: Inbox Problems and tasks, permission notifications, Overview landing, Insights spend and pane wording Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: Agent Context guide, setup-closed check, model gate, pool and GCP troubleshooting, admin analytics Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: 10–17 November changelog cycle; move Inbox and Overview entries into it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: screenshots for Overview, Insights, Problems, Receipt and policies; refresh rail and profile picker images Docs captures come from the existing audits' mocks (docsShot inside project-overview, insights, run-receipt and agent-context audits) so no fixtures are copied; the profile picker docs spec is updated for the window-labelled usage text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: file Inbox task chat card heading and stale Insights/nav copy found during docs update Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: address review round 1 (troubleshooting points to Problems, Retry semantics, assignee steps for tasks, Agent setups, on-demand matching, realistic fixtures) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: address review round 2 (assignee finishes a task by telling the agent, not Archive; Inbox Retry starts at once) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(web): share the Acme Billing user and project between the Overview and Insights audits SonarCloud flagged the two audits' identical mock user/project blocks as duplicated new code after the docs fixture rename; both now import acme-billing-fixtures.ts. Also updates the Overview's failed-start assertion for the Problem fixture's real title shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: address CodeRabbit review (exhaustion policy qualifies quota descent and Queue waits, tasks are read-only in the Inbox, alt text covers both image variants, overflow checks before docs captures) 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 L17a reverse tunnel API landing * refactor(api): extract node provisioning failure finalization * feat(selfhost): isolate reverse tunnel API ownership and provisioning * test(api): reconcile reverse transport and lifecycle inventories * refactor(api): simplify provisioning failure finalization * fix(selfhost): adopt live reverse leases after transport changes * fix(selfhost): keep reverse lease cleanup owned by its build * style(api): sort reverse lease imports * docs: archive verified L17a reverse tunnel landing * style: format L17a verification record --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
…llation settings, truthful email copy - No-profiles gate with exactly one configured agent offers 'Start chatting with <agent>': one click creates the single '<agent> Chat' profile (Instant where the installation can run it, read at click time; Cloud VM otherwise). 'Customize' opens the wizard. Nothing is created without the click. - Wizard: the Instant card is disabled where Instant is unavailable; a chat profile with no runtime chosen falls back to VM there. - Compute pool overview warns when no allowed machine can hold a default workspace, using the installation's resolved default requirements and host reserve. Pool responses now carry placementSettings.hostMemoryReserveMb (resolveEffectiveNodeHostMemoryReserveMb). - Email trigger copy states the only sender check SAM makes (From allowlist, packages/agent-email/src/inbound.ts); onboarding no longer says the SAM-hosted repo lives in 'your Cloudflare account'. Ported by hand from sam/selfhost-pass-2 (0d67786, 16b2473); self-host-only parts left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x230p L19: guided-setup teardown marks D1 first and resumes cleanup
* fix(vm-agent): translate Vibe permission modes and reset restored sessions * docs: record Vibe draft PR validation and handoff constraints * docs: finalize tested Vibe draft handoff evidence * task: archive Vibe permission-mode task (draft hold lifted by Raphaël 2026-11-18) 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>
…2e41740d213944c79404d3 Bound harness usage admission without deleting history
Staged M4 merge, step 1 of 3. Landed slices take main's shape (L5b, D2, D3, L6, L11, L12, L14, L17a); the branch keeps only its unlanded remainder. Branch copies superseded by main's selfhost modules (services/speech-endpoints*, services/node-reverse-tunnel-*) are removed and callers repointed; the celld entry installs main's self-host speech backend. 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 disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Merging this PR will not alter performance
Comparing Footnotes
|
…5fe4b52a58efb9686d061d [Codex Security] CLI renders API-derived text as terminal control sequences
Staged M4 merge, step 2 of 3. L17b's reverse-tunnel gateway takes main's shape: services/node-agent-route.ts and node-websocket-gateway.ts are main's, the branch's Worker-mounted routes/self-host-gateway.ts is removed in favour of selfhost/reverse-tunnel/gateway.ts, and the branch's unlanded inbound-email gateway moves to selfhost/reverse-tunnel/inbound-email.ts mounted there. The celld entry wraps the worker with selfhost/build.ts (speech install + withReverseTunnel). The branch's shared 0232 lease migration and Drizzle table give way to main's self-host-only 0255 (IF NOT EXISTS over 0232). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Staged M4 merge, step 3 of 3 (origin/main tip 096db08). Landed slices take main's shape: L13 (AI local metering + ceiling), L9+L10 (account linking), L15 (quickstart/pool), L16 (hosted-git seam), L19 (credential-setup teardown). The branch's local git server now plugs into main's registerArtifactsBackendFallback seam from selfhost/hosted-git.ts (implementation in services/hosted-git/ local-backend.ts); step 1's L13 remainder is replaced by main's L13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- gitlab.ts takes main's L6 deadline/refusal shape; only the private self-managed GitLab opt-in (allowPrivateNetwork) is re-attached; the now-unused gitlab-host-policy.ts is removed. - gitlab-sign-in-trust test is main's plus the branch scope test; the branch SMTP link-alert test is dropped (L9/L10 refuse implicit links). - celld-project test expects the withSelfHostBuild entry. - Lint: import order, unused imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- celld packager projects the self-host reverse-tunnel lease migration (0255) into the primary database's migration dir; the shared 0232 copy is gone, so a fresh box otherwise had no lease table (CRITICAL). - Remove the branch's duplicate /link-social gate; main's L9/L10 account-linking plugin owns it. - llm-endpoint-snapshot joins another request's load through settleSharedFlight (quality:shared-flight-joins); range-report's local digest cache carries the reviewed allow directive. - Remove the now-unused guardedFetchWithDeadline helper. - Restore main's L11 production-shape capability pin next to the branch's broader tests. - Tests: take main's L9/L10/L13 web tests; adapt branch tests whose feature landed in main's shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Branch tests that asserted pre-landing behaviour now superseded by main's L6/L9-L10/L12/L13/L17a-b take main's tests or are adapted: GitLab whole-call deadline, account-link alert recipient, transport installation for reverse-tunnel selection, lease table from the self-host migration, H2-retired analytics routes. The inbound email gate checks the gateway secret's minimum length again, pinned to the self-host constant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's quality:no-secret-readback (#2841) scans scripts/ and skips fixtures/. The fake AWS KMS and Azure/Google key services decrypt only test data and are imported only by tests, so they live with fixtures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@coderabbitai review |
Action not completed
|
- The gateway-secret length pin moves to its own test file, so the reviewed synthetic fixture in selfhost-inbound-email.test.ts stays on the line its gitleaks baseline digest names. - Hosted-git conformance reads the credential host from cloneUrl, the L16 git-token response main landed (no separate host field). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's ProjectData ensure memo (af302db) remembers only completed ensures, so two concurrent cold requests each run their own ensure and there is no shared flight to strand on celld. The live join test now expects both answers to report two loads for the ensure case; the latency bound that catches a stranded request still applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Coordinator review (task 01M7JMXS2JRW6QQMB1356ENPM3): approved for merge into Gates on head
The items raised to the coordinator (pre-existing HIGH-1/4/5 and the MEDIUMs) and the unsure items (#4 admin cap flag, #5 dropped L12 refinements, #7 removal of the 0232 migration, #13 L19 celld teardown, #16 budget PUT 503) are recorded on the landing plan. Each belongs to the slice that lands that code, or to the BOX proofs, which run next. |
942d2c0
into
sam/selfhost-pass-2




Summary
M4 merges current main into the self-host integration branch in three staged real merges so a usage-limit stop cannot lose resolved work. PR base sam/selfhost-pass-2; no rebase, no cherry-picks, no force-push to the integration branch. Do not merge: coordinator task 01M7JMXS2JRW6QQMB1356ENPM3 reviews and merges. Model: M3 #2817 (M2 #2758, M1 #2736).
Rule: code that landed on main takes main's version; the branch keeps only what has not landed. Where a slice landed in a different shape, main's shape wins and only the self-host remainder is re-attached, through main's self-host seams where one exists.
Steps
faa02a842dacdedb476059f37eabd043ae7c128c4fc4cb99ad52fd4d2de8be46bedc845f1080d24bbf0c98bf5e3d29a1b3bdd7f2ed85031bb14676f3c918fdc86fc7ced5bb1ec5aee299a51c91809bfeb7502ba965bc2450cd45f353fe6808bc3c06c80df987c53a871d19b3e6fc55e27401dc47c4997e87origin/maintip when step 3 started:096db08db(#2864)f987c53a871d19b3e6fc55e27401dc47c4997e87096db08db540f9f09decef902935822aeecb2f21ea608b26b15da3b9fe77c614d3ffc82016f9b50fCommit
c918fdc86(after step 1) adds the task file only. The first push to this PR's own output branch replaced a stray main commit left on it by branch creation (forced update ofsam/m4-third-attempt-staged-zk9fseonly; the integration branch was not touched).Landing progress (
git diff --shortstat origin/main...<head>)faa02a842, M3): 855 files, +84286 / -2124.c918fdc86, merge base4fc4cb99a): 742 files, +78013 / -1313.f987c53a8, merge baseb7502ba96): 725 files, +75855 / -1276.ea608b26b, merge base096db08db): 664 files, +72186 / -1074.4dd6fcff7(after the post-merge fixes;origin/main=bfa8cc57c, merge base096db08db): 649 files, +70526 / -1052.Conflict table — step 1 (
4fc4cb99a, 84 conflicted files).github/workflows/ci.ymlapps/api/src/auth.tsbetterAuthSecretOptionsandkeepLinkedAccountEmailimports kept (unlanded L9/L10 and key rotation)apps/api/src/services/gitlab-login-provider.ts(add/add)allowPrivateNetworkpassed toassertOutboundUrlandguardedFetch) and trusted-hostkeepLinkedAccountEmail(L9/L10, unlanded). BranchfetchGitLabUserInfo/GITLAB_SCOPESdropped (no other callers)packages/repo-hosting/src/gitlab.tsguardedFetchWithDeadline+ private GitLab opt-in +gitLabRequestErrord58e63d20moved it to main's L6 shape +allowPrivateNetworkopt-in only, and removed the unusedgitlab-host-policy.ts(unsure item 1)packages/repo-hosting/src/ports.tsapps/api/tests/integration/gitlab-sign-in-trust.test.tsapps/api/tests/integration/github-oauth-sign-in.test.tsclientHeaders+ ingress-IP matrix / branchcallbackHeadersapps/api/src/lib/client-ip.ts(add/add),middleware/app-error-handler.ts,routes/chat-load-diagnostics.tsapps/api/tests/unit/lib/client-ip*.test.ts(add/add)apps/api/src/middleware/error.tsapps/api/src/services/platform-capabilities.ts(add/add)resolveLlmEndpointCapability/ branch 18 capabilities + speech-endpoint paramgetTTSConfig,publicPlatformCapabilities(env)with no speech param,resolveLlmEndpointCapability); branch's unlanded capabilities (artifacts, containerRuntime, guidedCredentialSetup, email, DNS, appDeployments, observability, R2 presign, live log stream, monthly cap, local metering) re-attachedapps/api/tests/unit/services/platform-capabilities.test.ts(add/add)apps/web/src/lib/api/platform-capabilities.ts(add/add)apps/web/src/components/agent-models/AgentModelAccessField.tsx, its testapps/web/tests/unit/components/platform-capabilities-ui.test.tsx(add/add)apps/web/tests/playwright/platform-capabilities-audit.spec.ts(add/add)apps/web/src/lib/project-route-prefetch.ts, its testapps/api/src/routes/transcribe.ts,routes/tts.ts,services/tts.tsservices/speech-backend.ts,selfhost/speech/) / branch Worker-loadedservices/speech-endpoints.tsservices/speech-endpoints.tsandspeech-endpoint-settings.tsdeleted (superseded byapps/api/src/selfhost/speech/)apps/api/src/index.ts(auto-merged)platformCapabilitiesRoutes/ branch inline route on the same pathspeech-endpointsimport removedapps/api/src/middleware/rate-limit.ts(auto-merged)TTS_SYNTHESIZElimitspeech.synthesis.maxRequestsPerHour; branch key now unused)scripts/selfhost/celld-project.ts(no conflict)installSpeechEndpoints()fromselfhost/speech/index.ts(L14's install point)apps/api/tests/unit/selfhost/speech-endpoints.test.ts(add/add)selfhost/speechapps/api/src/services/admin-setting-definitions.ts,admin-settings-registry.tsadminSettingsRegistry()+ installs, D2unavailableValue, Insights/Infomaniak/brief settings / branch speech + stalled-classifier settingsapps/www/src/content/docs/docs/reference/configuration.md(auto-merged)apps/api/src/selfhost/speech/; rate-limit name corrected tospeech.synthesis.maxRequestsPerHourapps/api/src/routes/admin-analytics.tsanalyticsQuerygateapps/api/src/routes/admin-costs.tsresolveAiGatewayIdapps/api/src/scheduled/handler.tsdaily-jobs.ts, inbox sweep / branch reverse-tunnel lease sweepselfhost/reverse-tunnel/leases.ts; L17b's entry runs it, step 2)apps/api/src/services/task-title.tsapps/api/tests/unit/config/omitted-worker-var-defaults.test.tsapps/api/tests/unit/services/profile-account-bindings.test.tsapps/api/tests/unit/usage-*.test.ts,ai-proxy-auth-lifecycle.test.ts,admin-settings-foundation.test.tsscripts/quality/ast-checks.tspackages/cronadded / branch network-hosts + vendor exclusionscripts/quality/direct-dependency-evidence.jsonapps/www/src/content/docs/docs/architecture/security.mdgitLabLoginProvider)apps/api/src/routes/node-lifecycle.tsapplyHeartbeatIp, L17a inline reverse-tunnel checks / branch inline IP code +isTunnelNodeTransportapps/api/src/routes/workspace-subdomain-proxy.tsrefuseNodeRedirect/ branch L17b route row + gateway decisionapps/api/src/routes/workspaces/runtime.tsruntime-agent-key,runtime-git-token,runtime-messages… / branch async proxy gate, custom base URL refusal, hosted-git tokenruntime-git-token.tsapps/api/src/services/node-agent.tsnodeResponse, manual redirects / branch L17bresolveNodeAgentRouteretargetingapps/api/src/services/node-manual-deletion.tsreleaseTerminatedNodeIngress/ branch operator retirementproveOperatorRetirementapps/api/src/services/node-provisioning{,-cloud-init,-ingress,-predicates}.ts,strict-node-deletion.tsapps/api/src/services/node-tunnel-config.tsnodeTransportExtension().select/ branchisReverseTunnelInstallationroutes/nodes.ts,session-snapshot-upload-relay.ts)apps/api/src/services/task-runtime-liveness-node-probe.tsapps/api/src/services/debug-agent-tools.tstimeoutMsresolver / branch signal + Cloudflare-account gatehasCloudflareAccountApigateapps/api/tests/unit/services/node-reverse-tunnel-lifecycle.test.ts(add/add)apps/api/tests/unit/services/node-ip-validation.test.ts,tests/workers/diagnosis-runner-do.test.tspackages/shared/src/types/{workspace,index}.tsNODE_BILLING_ENDED_STATUSES/ branchisTunnelNodeTransportapps/api/src/services/node-reverse-tunnel-{authz,config,leases,provisioning}.ts(no conflict)apps/api/src/selfhost/reverse-tunnel/self-host-gateway*.ts,agent-email/self-host-inbound.ts,node-agent-route.ts,node-websocket-gateway.tsand tests repointed to main's modulesAI-proxy / L12 area (resolved with main's shape, L13 remainder re-attached):
sam-session/agent-loop-llm.ts,agent-loop.tssam-session/operator/model.tsassertOperatorModelSupportsTools/ branch L13 per-model usageincrementModelUsagewhen not a custom endpoint and local metering is on (L13 remainder)routes/ai-proxy-admission.ts,ai-proxy-passthrough*.ts(prepare add/add),ai-proxy-platform-billing.ts,ai-proxy.tsroutes/ai-proxy-anthropic.tsaiGatewayOnlyHeadersaiGatewayOnlyHeaders(unlanded)routes/ai-proxy-upstream.tswithDirectStreamUsagewithDirectStreamUsageroutes/usage.tsgetLocalUsageBreakdown,monthlyCostCapAvailableservices/ai-proxy-availability.ts,llm-chat-target.ts,llm-endpoint-settings.ts(add/add),ai-proxy-shared.ts,sam-ai-proxy-fallback.tspackages/ai-proxyservices/ai-token-usage-accounting.ts(auto-merged)estimateTokensFromTextpackages/ai-proxy/src/ai-monthly-cost-cap.tsenforcedflagenforced; duplicated auto-merged block removedpackages/ai-proxy/src/ai-monthly-cost-cron.tsskipReasoncommentpackages/ai-proxy/src/ai-proxy-shared.tspackages/ai-proxy/src/ai-token-usage-accounting.tsincrementModelUsagefor priced callspackages/ai-proxy/src/index.tspackages/ai-proxy/tests/unit/ai-token-budget.test.tsenforcedassertionstests/unit/routes/ai-proxy-accounting.test.ts,tests/unit/runtime-always-proxy.test.tsapps/api/src/repo-hosting-ports/platform-config.ts(auto-merged)outboundMaxRedirectsConflict table — step 2 (
b7502ba96, 13 conflicted files)apps/api/src/services/node-agent-route.ts,node-websocket-gateway.ts(add/add)apps/api/tests/unit/services/node-agent-route.test.ts,tests/workers/self-host-gateway.test.ts(add/add)apps/api/src/services/node-agent.tsresolveNodeAgentRoute(env, id, node)/ branch route resolutionapps/api/src/routes/workspace-subdomain-proxy.tsresolveNodeAgentRoute/ branchreadNodeAgentRouteRow+ 202 ports readiness when unroutablex-sam-gateway-secretstrip on the container path (defence in depth)apps/api/src/routes/nodes/diagnostics.tsapps/api/src/services/session-snapshot-upload-relay.tsprovisionsExtensionTransportNodes/ branchsnapshotUploadRelayAvailableapps/api/src/services/task-runtime-liveness-{loaders,types,node-probe}.tsapps/api/tests/unit/cf-container-runtime-contract.test.ts,ws-proxy.test.tsapps/api/src/routes/self-host-gateway.ts(no conflict)selfhost/reverse-tunnel/gateway.tsindex.tsmount removed (the Worker no longer carries a gateway route)apps/api/src/routes/self-host-gateway-inbound-email.ts(no conflict)apps/api/src/selfhost/reverse-tunnel/inbound-email.ts, mounted by main'screateSelfHostGatewayRoutes(new optionalinboundEmailDeps)apps/api/src/services/agent-email/self-host-inbound.ts(no conflict)selfhost/(the gateway enforces length)apps/api/src/selfhost/build.ts(new),scripts/selfhost/celld-project.tswithSelfHostBuild()=installSpeechEndpoints()+withReverseTunnel(worker, generateCloudInit); replaces step 1's speech-only callapps/api/src/routes/nodes.ts,services/node-tunnel-config.ts(no conflict)isReverseTunnelInstallationcopyprovisionsExtensionTransportNodes; copy removedapps/api/src/db/migrations/0232_node_reverse_tunnel_leases.sql,packages/worker-core/src/schema.tsselfhost/migrations/0255, raw SQL) / branch shared migration + Drizzle tableIF NOT EXISTSapps/api/tests/unit/services/node-websocket-gateway.test.ts(no conflict)selfhost/reverse-tunnel/route.tsapps/api/tests/unit/services/node-reverse-tunnel-lifecycle.test.tsnode-agent-route.test.ts)Conflict table — step 3 (
096db08db, 60 conflicted files)apps/api/src/auth.tsvalidateLinkUserInfo,allowUnlinkingAll,getBetterAuthSecret/ branch linking comments,betterAuthSecretOptionsbetterAuthSecretOptions(versioned BetterAuth secret rotation, unlanded) kept in place of main'ssecret: getBetterAuthSecret(env)(now-unused import dropped)apps/api/src/services/linked-account-identity.ts(add/add)apps/api/src/services/gitlab-login-provider.tskeepLinkedAccountEmailfor trusted and untrusted (host-scoped id) accountsapps/api/src/services/email-sign-in.tsfindAccountByEmail(credential links excluded),providerSignInRequiredEmail, note-sent log / branch SMTP transport (resolveSystemEmailTransport)transport.kindadded to the log; duplicate branchproviderSignInRequiredEmailremovedapps/api/src/services/github-token-errors.ts(add/add)GITHUB_UNAVAILABLEapps/api/src/routes/github-installation-sync.tsapps/api/src/services/admin-setting-definitions.tsOrchestratorSettingName/ branch stalled-classifier settingsapps/api/src/index.tsartifactsConfigRoutes/ branch inline artifacts-enabled routeapps/api/src/services/platform-capabilities.tshasLocalAiCostMetering@simple-agent-manager/ai-proxyapps/api/tests/integration/gitlab-sign-in-trust.test.tsapps/api/tests/integration/{email-code-provider-link,github-link-social}.test.ts(add/add)apps/api/src/durable-objects/credential-setup-session/index.tsand tests (credential-setup-session{,-teardown}.test.ts,agent-credential-setup-native-vertical.test.ts)cleanup.ts,cleanup-recovery.ts,schema.ts,lifecycle-io.ts,d1-status.ts/ branch inline teardown with celld bounded join and resumed-scrub skipADD COLUMNset is a superset of the branch's, same names)apps/web/src/components/{AuthProvider,ConnectedAccountsSection,GitHubAppSection}.tsx,onboarding/choose-path/GitHubConnectGate.tsx,lib/auth.tsapps/web/src/components/compute-pool/ComputePoolOverview.tsx,lib/compute-pool-default-fit.ts(+test),onboarding/choose-path/AgentStep.tsx,pages/project-chat/{ChatInput,ProfileWizardPanel,useProfileChoice},tests/playwright/onboarding-inline-audit.spec.ts,tests/unit/pages/project-chat.test.tsxapps/web/src/components/triggers/EmailTriggerFields.tsx,pages/automation/editor/steps-start-when.tsxapps/api/src/services/hosted-git/backend.ts(add/add)registerArtifactsBackendFallback,resolveArtifactsBackendForCleanup,isArtifactsAvailable/ branch selection mixed with the DO backendservices/hosted-git/local-backend.ts(uses theHOSTED_GITbinding, never imports the DO class), registered as the fallback byselfhost/hosted-git.tsat loadapps/api/src/repo-hosting-ports/artifacts.ts(add/add),packages/repo-hosting/src/ports.ts,repo-browse/artifacts.tsresolve/ branch alsolocalRemoteFetchlocalRemoteFetch(in-process browsing of locally hosted repos)apps/api/src/routes/workspaces/runtime-git-token.tsusername: 'x'for a bound non-Cloudflare host / branchhost+ workspace-bound mint + 404errors.internal; branch workspace-bound token mint keptapps/api/src/services/workspace-git-source.ts,task-runner/workspace-dispatch-step.ts,routes/projects/crud.tsapps/api/src/routes/projects/project-create.tserrors.internal/ branch import URL, in-process README seed, 404apps/api/src/routes/projects/members.tsmember-invite-helpers.ts/ branchgetTokenHashKeygetTokenHashKey(c.env)re-applied on create and lookup (member-invite-helpers.ts) so invite links survive key rotationpackages/project-data/src/client/project-data-ensure-memo.tsshared-flight-abandonment.test.ts, main's memo test takenpackages/vm-agent/internal/bootstrap/bootstrap.go,hosted_artifacts_host_test.go(add/add)apps/api/src/services/platform-capabilities.ts(follow-up)isArtifactsAvailableinhosted-git/backend.tsapps/api/src/routes/projects/hosted-git-token.ts,tests/unit/services/hosted-git/tokens-and-limits.test.ts(no conflict)local-backend.ts; self-host case registers the fallback firstL13 area (all main's landed shape):
packages/ai-proxy/src/{ai-budget-settings,ai-model-usage (add/add),ai-monthly-cost-cap,ai-token-budget-counter,ai-token-budget,ai-token-usage-accounting,index}.ts,packages/shared/src/types/ai-usage.ts,apps/api/src/services/ai-token-budget.ts,routes/usage.ts,operator/model.ts,ai-token-budget-counter-model-usage.test.ts(add/add),AiBudgetSettingsSection.tsx→ main.operator/controller.ts→ main'sOperatorMonthlyCostCapErrormessage plus the branch'sLlmUnavailableErrormessage.routes/ai-proxy-upstream.ts(step-1withDirectStreamUsageremoved; identical to main).platform-capabilities.tsCapabilityEnvwidened toEnv(main'sisArtifactsAvailabletakes the whole env).useNewChatComposer.ts→ main.Post-merge fixes (after step 3)
d58e63d20gitlab.tsmoved to main's L6 shape plus only theallowPrivateNetworkopt-in. The unusedgitlab-host-policy.tswas removed.gitlab-sign-in-trusttest is main's plus the branch scope test. The celld entry test expectswithSelfHostBuild. Lint fixes.a488c0d36a4d398419• CRITICAL:
prepareCelldProjectprojects the self-host0255lease migration into the primary database (fresh boxes otherwise had no lease table after the shared0232was removed). Test added; it fails without the call.• The branch's duplicate
/link-socialgate was removed (main's L9/L10 plugin owns it).•
llm-endpoint-snapshotjoins throughsettleSharedFlight;range-report's local digest cache gets the reviewed allow directive (quality:shared-flight-joinspasses).• The dead
guardedFetchWithDeadlinewas removed.• Main's L11 production-shape pin was restored.
• Main's L9/L10/L13 web tests were taken.
7c7654a04a31c69e9fscripts/selfhost/fixtures/, because main'squality:no-secret-readback(#2841) skips fixtures.c74b26f36gitlab-host-policymodule.5463b81ecselfhost-inbound-email.test.tshad moved off the line its gitleaks digest names; the length pin is now in its owntests/unit/selfhost/inbound-email-gateway-secret.test.ts. Hosted-git conformance reads the credential host fromcloneUrl(main's L16 git-token response).4dd6fcff7Branch tests removed because main's landed shape replaced what they asserted. Main's tests for that shape apply.
services/gitlab-host-policypackages/repo-hosting/tests/unit/gitlab.test.tsservices/node-agent-redirectsnode-redirects.test.tsservices/task-runtime-liveness-node-probetask-liveness-transport-route.test.ts,task-liveness-no-driver.test.tsselfhost/task-title-endpointselfhost/artifacts-project-create-without-bindingerrors.internalproject-artifacts-creation.test.tsselfhost/monthly-cost-cap-without-gateway,selfhost/custom-endpoint-usage-accountingconnected-accounts-section,monthly-cost-cap-availability,onboarding-github-connect-gateaccount-linking-audit,monthly-cost-ceiling-auditPlaywrightservices/node-websocket-gatewayroute.tsThese test cases were dropped:
forwardToWorkersAI(llm-endpoint-callers,partial-cloudflare-gateway-unset): main'sllm-endpoint.test.ts.ai-proxy-upstream-gateway-urls): main'sdirect-upstream-metering.llm-chat-target): main's L12 fails closed.node-lifecycle-byo,workspace-git-token,handler-kill-switch,profile-account-bindings,session-snapshot-upload-relay,stuck-task-slept-session-liveness.Raised to the coordinator (pre-existing at
faa02a842, not introduced by this merge)The architecture reviewer flagged these. All of them were already in the integration tip before M4, so they are outside a merge PR's scope and belong to the slices that land them.
apps/api/src/index.tsexports the branch'sSandboxDOsubclass (durable-objects/sandbox-do.ts, celld-specific startup handling) to the Cloudflare Worker. The seam for it is the generated celld entry's class-export shadowing.isLocalHostedGitActivein Worker-loaded files (runtime-git-token,project-create,repo-hosting-ports/artifacts.ts,hosted-git-token). As a resultservices/hosted-git/*is in the Worker import graph, though inert on Cloudflare. Fix: extend main's L16 seam (workspace-boundcreateTokenoption,remoteFetch/import on the fallback) and move the modules underselfhost/.ARTIFACTS,SANDBOX,AGENT_EMAIL,R2_*,ANALYTICS. Check them against production's deployed values before they land.installAdminSettingDefinitions);routes/admin-ai-proxy.tsmonthlyCostCapAvailableduplicates L13'smonthlyCostCap.available);read-auth-sessiondisables the cookie cache on every/get-session;shared-flightraces its own timer on Cloudflare joins;mountHostedGitRouteandwithSelfHostBuild).Places I was unsure which side should win
packages/repo-hosting/src/gitlab.ts(changed in fix commitd58e63d20): step 1 kept the branch version. At the final head it takes main's L6 form (per-hop deadline, refusal propagates as main's guard error), with only the private self-managed GitLab opt-in (allowPrivateNetworkpassed toguardedFetch) re-attached. The branch'sgitlab-host-policy.ts(assertGitLabHostAllowed,gitLabRequestError502/504 mapping) had no callers left and was removed. The branch's two SSRF tests now assert main's refusal instead of a 502 code. If the 502/504 mapping is still wanted on self-host, it should land as its own slice.apps/api/src/services/gitlab-login-provider.ts: I took main's L6 file and re-attached the private-host opt-in andkeepLinkedAccountEmail(L9/L10) inline. Both stay in Worker-loaded code because there is no seam for them yet.apps/api/src/services/platform-capabilities.ts: L11 landed 3 capabilities. The branch's other 15 (artifacts, container runtime, guided setup, email, DNS, app deployments, observability, R2 presign, live log stream, monthly cap, local metering) stay in this Worker-loaded module because many branch callers use them. Main's test that pins exactly 3 keys cannot hold until they land, so the branch test file was kept.AI-proxy remainder: step 1 re-attached L13 pieces. Step 3 replaced them with main's landed L13 (
incrementProviderUsage(…, modelId), themonthlyCostCapobject, noenforcedflag, no forcedinclude_usage). Still branch-only and Worker-loaded:monthlyCostCapAvailableflag (routes/admin-ai-proxy.ts,AdminAIProxy.tsx)LlmUnavailableErrormessageskipReasonaiGatewayOnlyHeaderson/ai/anthropicThe coordinator should confirm whether main's L13 meant to drop the admin flag.
Branch L12 refinements dropped for main's shape:
withStreamUsageRequestedMain does not have these. The coordinator should confirm that none is still needed for self-host.
Reverse tunnel between steps 1 and 2 (resolved in step 2): L17a moved leases and provisioning to
selfhost/reverse-tunnel/behindinstallNodeTransportExtension.node-agent-route.ts,node-websocket-gateway.tsandroutes/self-host-gateway*.tsimport main'sselfhost/reverse-tunnel/config, so main's self-host-only import-graph test is expected to fail at step 1.L17b (step 2) brought main's
selfhost/reverse-tunnel/{entry,route,gateway}.tsandwithReverseTunnel, which resolved all of these (see the step 2 table).Reverse-tunnel lease table: step 2 removed the branch's shared migration
0232_node_reverse_tunnel_leases.sqland the Drizzle table, as main's L17a/L17b shape requires. A box that already applied 0232 keeps its table and leases, because main's self-host 0255 isIF NOT EXISTS. Fresh boxes get the table only from 0255. Removing an applied migration file is what main's design expects (see the 0255 header), but the coordinator should confirm it before the box upgrade proof.Inbound agent email (sam-mx) now lives under
selfhost/reverse-tunnel/, so it is mounted only bywithReverseTunnel. Every celld entry applies that, but a box without the reverse tunnel would still get the gateway route. The route keeps its own on-switch (AGENT_EMAIL_INBOUND_SMTP).Gateway decision range check: the branch re-checked the lease port range when it minted Caddy's
X-SAM-Upstream. Main checks it once, when resolving the route (selfhost/reverse-tunnel/route.ts). I took main's and deleted the branch test for the second check.Transport selection: main's reverse-tunnel
selectrequiresnodeRole === 'workspace'. The branch only excludeddeployment. I took main's.Private GitLab and key rotation (the
allowPrivateNetworkopt-in inpackages/repo-hosting/src/gitlab.tsandgitlab-login-provider.ts,auth.tsbetterAuthSecretOptions,getTokenHashKeyfor invite links): branch-only, unlanded, and in Worker-loaded code.Hosted git: the branch's local backend now lives in
services/hosted-git/local-backend.ts. It is Worker-reachable throughruntime-git-token,project-create, the repo-hosting port andhosted-git-token, but inert on Cloudflare (isLocalHostedGitActiveis false there). Onlyselfhost/hosted-git.tsregisters it into main'sregisterArtifactsBackendFallbackseam.ArtifactsBackendPortgained an optionallocalRemoteFetch.L19: I took main's teardown implementation. That replaced the branch's celld-specific bounded join of an inline cleanup (
settleSharedFlight) and its "resumed after interruption" scrub skip with main'scleanup_scrub_state/cleanup_sandbox_destroyed/joinCleanupFlight. The DO'sADD COLUMNset is a superset with the same names. The behaviour on a box whose celld request lost its client should be re-checked in the L19 box proof.ProjectData ensure memo: I took main's (it shares no in-flight ensure). The branch's celld shared-flight join with an abandonment retry is gone.
Email automation copy: main says SAM cannot confirm the sender. The branch said the mail server checks SPF/DKIM, which is true on the self-host sam-mx path but not on Cloudflare. I took main's.
Credential-setup/monthly-cap self-host tests: I deleted
tests/unit/selfhost/monthly-cost-cap-without-gateway.test.tsandcustom-endpoint-usage-accounting.test.ts, which tested the branch's pre-L13 shape. Main'smonthly-cost-ceiling.test.ts,usage-budget-routes.test.ts,llm-endpoint.test.tsanddirect-upstream-metering.test.tscover the landed shape. The deleted test saw a 503 on budget PUT without a readable ceiling setting (main fails closed); worth a box check.SMTP owner alert for a newly linked GitLab sign-in (branch test from box round R17 D1): L9/L10 now refuse implicit linking, which was that test's premise. I dropped the test in
d58e63d20. The alert on an explicit/link-sociallink over SMTP is untested.Checks run
Every step: install (frozen lockfile),
pnpm build19/19,pnpm typecheck38/38. Step 3 also rango build ./....Local validation (head
c74b26f36):pnpm lint: 23/23 pass.pnpm check:fastpasses, including the formatting ratchet, ESLint and the type-boundary ratchet.pnpm build: 19/19.pnpm typecheck: 38/38.pnpm test(turbo--continue):gitlab-host-policy.test.ts, which tested the deleted module; it is removed inc74b26f36.retired-trial.test.tsx; it passed on rerun.pnpm selfhost:test: 38 files, 582 passed, 2 skipped.reverse-tunnel-placement,selfhost-only-modules,speech-selfhost-only,reverse-tunnel-entry,reverse-tunnel-gateway.celld-projecttests pass, including the new0255projection case. It fails without the fix.quality:migration-safety,do-migration-safety,wrangler-bindings,shared-flight-joins,no-secret-readback.selfhost:testcovers the generated celld entry and config, the compose files and deploy steps, which is what the box build consumes.selfhost:live-testandhosted-git-smoke.shneed the box, which this task must not touch.PR CI on the final head
4dd6fcff795eabd0e5dd44dda600a20b03960fe4: PASS. Run 44302138902: 26 jobs succeeded, 6 skipped.ci.ymlonly triggers for PRs intomain, so it was dispatched withworkflow_dispatchon this branch, as for M3.5463b81ec). 44299885169 failed the self-host live join test (fixed in4dd6fcff7).5463b81ecand4dd6fcff7fixes were checked locally with gitleaks 8.30.1 (no new findings),test:hosted-git(20 passed) and the affected test files.Staging Verification Evidence
N/A by explicit task instruction: this PR targets the integration branch
sam/selfhost-pass-2, deploys nothing, and must not touch the self-host test box (the coordinator schedules the L17b and L13 box proofs after M4 merges).Specialist Review Evidence
a4d398419/7c7654a04: CRITICAL lease-migration projection, duplicate/link-socialgate,shared-flight-joins, dead deadline helper, L11 production pin. Pre-existing branch placements (HIGH-1SandboxDO, HIGH-4 hosted-git route branching, HIGH-5 capability inputs, MEDIUMs) are not introduced by this merge; raised to the coordinator belowa488c0d36); final shortstat, post-merge-fix section, corrected unsure items and the preflight migration line addedCodeRabbit Review Evidence
Review skipped — auto reviews are disabled(comment).coderabbit-reviewlabel. The trusted workflow ran and CodeRabbit replied "Review triggered" at 11:51:40Z.Agent Preflight (Required)
Classification
External References
N/A: merge of reviewed repository implementations; no new external API integration. M3 #2817 read before merging.
Codebase Impact Analysis
The self-host seams landed on main replace the branch's inline copies:
services/speech-backend.tswithselfhost/speech/services/node-transport-extension.tswithselfhost/reverse-tunnel/services/admin-settings-registry.tsinstallAdminSettingDefinitionsservices/platform-capabilities.tswithroutes/platform-capabilities.tspackages/ai-proxy(L12)The generated celld entry (
scripts/selfhost/celld-project.ts) is where self-host-only extensions are installed.Documentation & Specs
Merged main's docs. Corrected the speech citation and rate-limit setting name in
reference/configuration.md. The task file records the plan. No new product contract.Constitution & Risk Check
Principles X and XI: no new runtime constants. Main's landed versions replace duplicate branch implementations. Migration safety:
0232_node_reverse_tunnel_leases.sql, superseded by main's self-host0255,IF NOT EXISTS; unsure item 7)0255reverse-tunnel migration isIF NOT EXISTSover the branch's0232The primary risk is a silent merge incompatibility. It is covered by build, typecheck, the full test suite and the self-host suites on the final head.
🤖 Generated with Claude Code