Skip to content

M6: merge main b1ebe0314 into sam/selfhost-pass-2 (L22-L24, H2, sealed, rotation) - #2956

Merged
simple-agent-manager[bot] merged 131 commits into
sam/selfhost-pass-2from
sam/m6-merge-current-main-1zv8h6
Nov 21, 2026
Merged

simple-agent-manager[bot] merged 131 commits into
sam/selfhost-pass-2from
sam/m6-merge-current-main-1zv8h6

Conversation

@simple-agent-manager

@simple-agent-manager simple-agent-manager Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

M6 merges current main (b1ebe0314) into the self-host integration branch in six staged real merges, pushed after each. PR base sam/selfhost-pass-2. No rebase, no cherry-picks, no force-push to the integration branch. Do not merge: coordinator task 01M7XCE59V5X0WTNF1X3NFZP5J reviews and merges. Model: M5 #2899.

Rule: code that landed on main takes main's version; the branch keeps only what has not landed. Where main's shape differs, main wins and only the unlanded remainder is re-attached on top. Each conflict was judged against the branch's remainder as of M5 (git diff 114e1d98b 2f61cea9a).

Steps

Step Main ancestor merged Parent 1 (branch) Parent 2 (main) Merge commit Conflicts Pushed
1 L22a #2901, L22b #2902, L22c #2906 2f61cea9a 917077fef 2d2ec53b4 78 (63 add/add) yes
2 L23 #2917 2d2ec53b4 860718dc3 4abfff33b 16 (15 add/add) yes
3 H2 #2907 4abfff33b c8f84a8e5 67cb93d78 37 yes
4 L24 #2918 (4a40c528c), #2932, #2934 67cb93d78 51a2bd14d efb4cdc2b 23 (all add/add) yes
5 sealed secrets #2933 efb4cdc2b 77572b69e cf52d4d9b 29 (all add/add) yes
6 key rotation #2952 (main tip) cf52d4d9b b1ebe0314 9d11f2076 25 yes

Order change: on main's first-parent history L23 (860718dc3) landed before H2 (c8f84a8e5). Merging H2's commit would have pulled L23 in with it, so L23 is step 2 and H2 step 3. No stages were combined.

After step 6:

  • 0ddb00666: post-merge build fixes.
  • 77593bc39: review fixes.
  • ae2db5166: restored two tests the validator showed were deleted by mistake.
  • 6aacfcc87: the CI fixes below. Main wins on GCP providerless teardown, three superseded branch tests are removed, and a fixture gets DNS credentials.

The first push replaced the main commit that branch creation left on this PR's own output branch (a forced update of sam/m6-merge-current-main-1zv8h6 only).

Landing progress (git diff --shortstat origin/main...<head>)

Point Files + / -
Before (integration tip 2f61cea9a) 560 +63994 / -895
After step 1 465 +49525 / -703
After step 2 449 +46257 / -703
After step 3 396 +38730 / -674
After step 4 367 +33398 / -674
After step 5 272 +23417 / -674
After step 6 228 +16381 / -258
Head 6aacfcc87 223 +15767 / -246

Conflict table: step 1 (917077fef, L22, 78 files)

File(s) Main change / branch change Resolution
63 add/add files under scripts/selfhost/, deploy/selfhost/, apps/api/src/selfhost/build.ts, self-host API tests, shared-flight (worker-core, api lib, quality check) L22's reviewed versions / the branch's pre-landing drafts Main (whole file). The guided-login wiring inside celld-config.ts, deploy.ts, celld-project.ts, compose, README and .env.example was lost with them; see unsure item 1
llm-endpoint-snapshot.ts, platform-config-core.ts, compact-r2.ts + test, generate-keys.ts L22a bounded joins Main (whole file; hunk-level would have kept stale branch imports)
routes/deployment-release-placement.ts #2903 eligible-node reuse / branch: helpers split into deployment-release-node-runtime.ts (size), plus the appDeployments capability gate Main + the gate re-attached in provisionNodeForRelease. The branch's size-split file is deleted (main keeps the helpers inline)
strict-node-deletion-shared.ts, strict-node-providerless-reconcile.ts #2900 named teardown refusals / branch: GCP counts as a complete inventory, MANUAL_DELETION_HINT Re-attached at first, then reverted to main in 6aacfcc87: main's node-cleanup-never-requested-placeholder test pins GCP providerless teardown to a named operator refusal with no provider traffic. That is #2900's landed decision, and its operator removal path is how stuck GCP nodes leave
routes/nodes/manual-deletion.ts, services/node-manual-deletion.ts, schemas/nodes.ts (confirmNodeName), pages/Node.tsx, lib/api/nodes.ts, node.test.tsx, session-troubleshooting.md (auto-merged branch hunks) #2900 operator removal of stuck SAM-capacity nodes (Admin → Infrastructure) / branch: superadmin retirement on the Node page Main. Branch module deleted (see Deleted modules)
.github/workflows/ci.yml, root package.json, scripts/quality/README.md L22 self-host jobs and scripts Main's hunks. The branch's later-landing extras arrive with steps 2-6
ast-checks.ts shared-flight include Union (+ the branch's worker-core network-hosts include)
dependency-governance.test.ts, gitleaks-reviewed-baseline.json Union
ci-suite-selection.test.ts ceiling 33 (Self-host Live) / 33 (hosted git job) 34 at this step, back to main's 33 at step 3

Conflict table: step 2 (860718dc3, L23, 16 files)

File(s) Resolution
15 add/add egress-fence, fence-*, verify-fence, netns lab, metadata-proxy live test, celld/start.sh Main
dependency-governance.test.ts Union: main's egress-fence, Dockerfile.lab, metadata-proxy + the branch's docker-proxy, key-agent
deploy/selfhost/metadata-proxy/Caddyfile (branch-only, no conflict) Deleted: main's broker is the Node server (server.ts, token.ts, peer.ts); its Dockerfile copies no Caddyfile

Conflict table: step 3 (c8f84a8e5, H2, 37 files)

File(s) Main change / branch change Resolution
vendored dgit/*, selfhost/hosted-git.ts, hosted-git tests, fetch-http-client.ts, hosted-git-smoke.sh, selfhost-durable-objects.ts (add/add) Main
services/artifacts/{http,import,limits,local-backend,tokens}.ts (AU: git mapped the branch's services/hosted-git/* onto main's renamed services/artifacts/) Main keeps these under selfhost/hosted-git/ Deleted (old-location copies)
durable-objects/hosted-git-{repo,gc,ls-refs}.ts, routes/projects/hosted-git-token.ts (branch, no conflict) Main: selfhost/hosted-git/ Deleted
apps/api/src/index.ts Main: export const app in index.ts / branch: app lives in app.ts Main; app.ts deleted. The branch's SandboxDO subclass export kept (unlanded, see unsure 5)
repo-hosting-ports/artifacts.ts, packages/repo-hosting/src/{index,ports}.ts, repo-browse/artifacts.ts + test Main: backend extensions (binding.remoteFetch) / branch: localRemoteFetch port hook Main. The branch's unlanded GitLab allowPrivateNetwork field stays in ports.ts
routes/projects/project-create.ts, schemas/projects.ts Main refuses importUrl until a bounded importer exists / branch: in-memory importer Main; the importer is deleted (unsure 2)
routes/workspaces/runtime-git-token.ts, vitest.config.ts, direct-dependency-evidence.json Main
apps/api/src/env.ts (auto-merge) Main: HOSTED_GIT typed in selfhost/hosted-git/env.ts The branch's shared-Env HOSTED_GIT* removed
apps/api/package.json Auto-merge duplicated test:hosted-git Fixed; the branch-only isomorphic-git dependency (used only by the deleted importer) removed, lockfile refreshed
.github/workflows/ci.yml, ci-suite-selection.test.ts Main runs hosted git in API unit shard 1 / branch: a separate job Main (ceiling 33). ci.yml is byte-identical to main at head
tests/unit/selfhost/hosted-git-route-order.test.ts (branch) Main's selfhost/hosted-git.ts cites it, but main does not ship it Kept; now imports app from src/index

Conflict table: step 4 (51a2bd14d, L24, 23 files)

All 23 add/add (backup*, restore.ts, teardown*, created-resources*, install-record.ts, bucket-objects.ts, fakes) → main. Branch drafts with no counterpart on main were deleted: gcp-teardown.sh (nothing sources it), live/teardown-bucket.live.test.ts (imports an emptyBucket main does not export) and testdata/fake-docker-teardown.mjs (unreferenced). Two tests deleted here by mistake were restored in ae2db5166: adopt-check.test.ts and teardown-gcp-constants.test.ts, which main's teardown-gcp.ts:32 cites. wrangler.toml, package.json, pnpm-workspace.yaml and check-no-secret-readback.ts are byte-identical to main.

Conflict table: step 5 (77572b69e, sealed secrets, 29 files)

All 29 add/add (runtime-secrets*.ts, the key agent, secrets-*.ts, contract tests) → main. After step 6, two branch-only tests failed to compile against main's modules and were deleted (77593bc39). secrets-migrate.test.ts broke on the MigrateDeps shape and the runMigration arity. live/plaintext-purge.live.test.ts broke because purgeVersions and hasDocker are not exported. Main's live/secrets-migrate.live.test.ts and plaintext-scan.test.ts cover the same modules.

Conflict table: step 6 (b1ebe0314, key rotation, 25 files)

File(s) Resolution
22 add/add (rotate-*, key-rotation/*, better-auth-secrets.ts, encryption-key-fallback.ts, jwt-keys.ts, jwt-verify.ts, tests) Main
lib/secrets.ts, services/jwt.ts Main (whole file)
apps/api/src/env.ts Main's rotation, BetterAuth and JWT declarations. The branch's REVERSE_TUNNEL_* copies removed (main types them in selfhost/reverse-tunnel/config.ts). Kept from the branch: AI?: Ai, CONTAINER_RUNTIME_AVAILABLE, SANDBOX_CONTAINER_RUNTIME_AVAILABLE (the unlanded capability inputs, M4/M5)
strict-node-providerless-reconcile.ts Main (final; see step 1)
runtime-tunables-baseline.json Main + the two kept Env flags. Stale HOSTED_GIT_BACKEND / REVERSE_TUNNEL_* exceptions dropped

Byte-identical to main (git diff b1ebe0314 HEAD empty):

  • services/encryption.ts, file-encryption.ts, jwt.ts, jwt-keys.ts, jwt-verify.ts, encryption-key-fallback.ts
  • lib/secrets.ts, lib/better-auth-secrets.ts
  • selfhost/key-rotation*, selfhost/runtime-secrets*

Migrations

git diff b1ebe0314 HEAD is empty for:

  • apps/api/src/db/migrations (primary and observability)
  • apps/api/src/selfhost/migrations (primary and observability)
  • apps/api/wrangler.toml
  • the celld Durable Object list scripts/selfhost/selfhost-durable-objects.ts
  • celld-project.ts, celld-config.ts, deploy.ts

No migration exists on both sides under different names, so a box's ledger keeps matching.

Deleted branch modules (no-dead-code)

Deleted (path at 2f61cea9a) Superseded by (main)
apps/api/src/services/node-operator-retirement.ts + tests/unit/routes/node-operator-retirement.test.ts (2cb2cbd), plus their hooks in manual-deletion route/service, schemas/nodes.ts, Node.tsx, lib/api/nodes.ts, node.test.tsx, session-troubleshooting.md #2900 services/node-operator-deletion.ts, Admin → Infrastructure → Stuck nodes
apps/api/src/routes/deployment-release-node-runtime.ts #2903; helpers inline in deployment-release-placement.ts
apps/api/src/services/hosted-git/{http,limits,local-backend,tokens}.ts, durable-objects/hosted-git-{repo,gc,ls-refs}.ts, routes/projects/hosted-git-token.ts, apps/api/src/app.ts H2 #2907 apps/api/src/selfhost/hosted-git/*, selfhost/hosted-git.ts, services/artifacts/backend.ts, export const app in index.ts
apps/api/src/services/hosted-git/import.ts (+ project-create wiring, isomorphic-git dep) H2 #2907 refuses importUrl (400). Bounded importer: main's tasks/backlog/2026-11-19-bounded-selfhost-git-import.md, idea 01M7XMTPYXEW7MMG8YSW6X99M4
deploy/selfhost/metadata-proxy/Caddyfile L23 #2917 Node broker deploy/selfhost/metadata-proxy/{server,token,peer}.ts
deploy/selfhost/gcp-teardown.sh, scripts/selfhost/live/teardown-bucket.live.test.ts, testdata/fake-docker-teardown.mjs L24 #2918 teardown-gcp*.ts, teardown-box.ts, teardown.ts
scripts/selfhost/secrets-migrate.test.ts, live/plaintext-purge.live.test.ts #2933 live/secrets-migrate.live.test.ts; #2952 plaintext-scan.test.ts
apps/api/src/lib/network-hosts/index.ts (re-export shim, no importer) packages/worker-core/src/network-hosts/
apps/api/tests/unit/services/node-cleanup-gcp-providerless.test.ts (with the GCP allowlist in strict-node-*) #2900 named refusal plus operator removal (main's node-cleanup-never-requested-placeholder.test.ts)
apps/api/tests/unit/selfhost/node-transport-config.test.ts (asserted the branch's pre-L22 box-settings exports) L22 #2906 scripts/selfhost/box-settings.test.ts, caddy-logging-compose.test.ts, live/frpc-tls.live.test.ts
apps/api/tests/unit/services/selfhost-guided-login-gates.test.ts Not superseded: it tests the unwired guided-login gates. Recorded on idea 01M7XMTJAQG7P9R6FGQGY47R6C, to be restored with the re-port

Places I was unsure which side should win

  1. Guided login on celld (unlanded), kept unwired. Its wiring lived in L22/L23 files main now owns: celld-config.ts (main drops every container), deploy.ts, celld-project.ts, egress-fence.ts. Re-attaching means new nft rules in main's reviewed L23 fence. Coordinator decision: keep guided-login.ts, docker-proxy-policy.ts, deploy/selfhost/docker-proxy/, docker-compose.guided-login.yml and their tests on the branch, unwired. Add no fence rules. The exact 2f61cea9a wiring points are in idea 01M7XMTJAQG7P9R6FGQGY47R6C, which also requires a security review of the fence delta. One adjustment was needed: main moved celld to uid 7103, which collided with the proxy's default. The proxy now defaults to 7104, and its celld gid follows main.
  2. Hosted-git importer deleted, as main refuses importUrl (see Deleted modules).
  3. gcp-bootstrap.sh: main's version. The branch's --kms, --kms-only, --new-key-version, --restore-key-version and --teardown (R13 D2/D3/D5, R14) did not land. Main's sealed-secrets README documents the manual gcloud kms commands, and pnpm selfhost:teardown covers teardown.
  4. GCP providerless teardown: main wins. The branch let a GCP node with no instance id be torn down by an inventory lookup (a box fix from 2026-11-11). Main's #2900 chose a named operator refusal plus operator removal instead, and pins that in a test. Re-attaching the branch behaviour broke that test in CI, so the branch behaviour is dropped. If the inventory lookup is still wanted, it needs its own slice against main.
  5. Cloudflare-path differences from main that predate M6 (unchanged here, noted for the coordinator):
    • the SandboxDO subclass export in index.ts;
    • read-auth-session.ts forcing disableCookieCache on /get-session;
    • GitLab allowPrivateNetwork (default off).
  6. env.ts is main's except the M4/M5 capability inputs listed in step 6.

Checks run

Local, on the merged tree:

  • pnpm install --frozen-lockfile
  • pnpm build: 19/19
  • pnpm typecheck: 38/38
  • pnpm lint: 23/23
  • pnpm format:check ratchet: passes
  • tsc -p scripts/{selfhost,selfhost/live,deploy}: clean
  • apps/api vitest (full unit suite, on the 6aacfcc87 tree): 1228 files, 18849 passed, 5 skipped.
  • pnpm selfhost:test: 71 files, 1324 passed, 6 skipped. Run on 77593bc39; the two restored tests then passed on their own, 6/6.
  • quality:scripts:test: ci-suite-selection 71/71 after the filter fix. The rest of that run passed, except a local-only artifact failure caused by an untracked apps/www/public/scripts/mermaid-chunks build output.
  • Quality checks, all passing:
    • migration-safety, do-migration-safety, wrangler-bindings, runtime-tunables
    • direct-dependency-evidence, file-sizes, shared-flight-joins, no-secret-readback
    • type-boundaries, agent-context-budget --check
    • gitleaks:current, run locally with the checksum-verified pinned 8.30.1 the CI job uses: 48 reviewed, 0 new. Before the fix it failed with "duplicate entry", because the branch's K1 AWS group repeated main's sealed-secrets digests.
  • Every merged JSON file was checked for duplicate keys. This caught the duplicated test:hosted-git in apps/api/package.json.

CI (ci.yml only triggers for PRs into main, so it is dispatched with workflow_dispatch):

  • 44839183421 on 77593bc39: cancelled, superseded by ae2db5166.
  • 44839559555 on ae2db5166: failed 10 API unit tests (the three shards). Everything else passed, including Self-host Live (Docker), Self-host Email and all Workers shards. Fixed in 6aacfcc87, as described above.
  • 44843122303 on 6aacfcc87: PASS. 25 jobs succeeded and 8 were skipped (path-filtered or PR-only). Passing jobs include Self-host Live (Docker), Self-host Email (sam-mx + SMTP), all three API unit shards, all seven Durable Object Workers shards, both web shards, Validate Deploy Scripts, Code Quality, Secret Scan and the full-suite gate.
  • SonarCloud quality gate: passed.

The task file's last checklist items (reviews, CI, CodeRabbit) are recorded here, not in a further commit, so the PR head stays the CI-verified 6aacfcc87.

Effect on hosted SAM (Cloudflare) vs self-hosting

This PR targets the self-host integration branch, so nothing in it reaches hosted SAM until a later landing slice brings it to main. Compared with main, the branch carries these differences on the code the Cloudflare Worker runs:

  • the SandboxDO subclass export;
  • /get-session reads the session without the cookie cache;
  • the GitLab private-network admin setting (default off);
  • the appDeployments capability gate. It is always true on Cloudflare, since CF_API_TOKEN and CF_ZONE_ID are set.

All four predate M6. Everything else in the remainder is self-host-only (apps/api/src/selfhost/, scripts/selfhost/, deploy/selfhost/).

Staging Verification Evidence

N/A by task instruction: this PR targets the integration branch and deploys nothing. The shared test box app.vmtest.sam2.party stays on main and was not touched. The runtime proof is the dispatched CI run, including Self-host Live (Docker) on celld.

Specialist Review Evidence

Reviewer Status Outcome
architecture-reviewer ADDRESSED HIGH: dependabot.yml repeated the caddy, egress-fence and key-agent entries; fixed in 77593bc39 (only the docker-proxy entry differs from main). MEDIUM: dead apps/api/src/lib/network-hosts shim, deleted. MEDIUM: gitleaks groups duplicating main's, pruned (the duplicate made the scan fail) and verified with the pinned binary. LOW: type-boundary-baseline.json reflowed, restored to main's formatting; the local-record-guard count stays 1 for the docker-proxy. LOW: hosted-git-route-order.test.ts, which CI runs
security-auditor PASS 0 CRITICAL/HIGH. Crypto, auth, rotation and sealed-secrets files are identical to main. env.ts is safe. Hosted git is unreachable from the Worker entry and importUrl is refused. GCP inventory is complete and fails closed. Fence and metadata proxy are identical to main. MEDIUM: gitleaks entries; addressed with the pruning above. LOWs (SandboxDO, read-auth-session, allowlist) are recorded as unsure 4-5
task-completion-validator ADDRESSED WARN. MEDIUM: adopt-check.test.ts and teardown-gcp-constants.test.ts were deleted although main still exports what they test; restored in ae2db5166, both pass. MEDIUM: env.ts divergence was undocumented; now in the step 6 table and unsure 6. The merge chain, migrations, crypto identity and remainder tests were verified

CodeRabbit Review Evidence

  • Requested at 23:49:43Z: coderabbit-review label (its pull_request_target run 44839601990 was skipped, as on a draft) and the trusted workflow dispatched from main (run 44839603128).
  • Reply (2026-11-20T23:50:50Z): Review skipped: Too many files! (898 files changed against the base, as the merge brings main in). Per rule 25 the wait ended there. No re-trigger and no waiver requested; as with M5, a merge PR this size cannot get a CodeRabbit review.

Agent Preflight (Required)

  • Preflight completed before code changes

Classification

  • cross-component-change
  • security-sensitive-change
  • infra-change

External References

N/A: a merge of reviewed repository implementations, with no new external API integration. Read before merging: M5 #2899 body, the landing-plan idea 01M72M9AEB933ZY8269D376DKC updates, main's tasks/backlog/2026-11-19-bounded-selfhost-git-import.md.

Codebase Impact Analysis

  • apps/api: placement capability gate, providerless teardown, hosted-git seam, env.ts.
  • packages/repo-hosting: ports.
  • scripts/selfhost and deploy/selfhost: now main's, plus unwired guided login.
  • .github: ci filter, dependabot.
  • scripts/quality: baselines.

Documentation & Specs

  • Main's docs are merged.
  • session-troubleshooting.md was restored to main's text, since the branch retirement path is gone.
  • Task file: tasks/active/2026-11-20-m6-merge-main-into-selfhost-pass-2.md.
  • New ideas: 01M7XMTJAQG7P9R6FGQGY47R6C, 01M7XMTPYXEW7MMG8YSW6X99M4.

Constitution & Risk Check

  • Principle X: duplicate implementations deleted.
  • Principle XI: no new constants beyond the docker-proxy default uid.
  • Migration safety: no migration added, renamed or removed.
  • Main risk: a silent merge incompatibility. It is covered by build, typecheck, lint, the self-host suite, the quality checks and full dispatched CI.

🤖 Generated with Claude Code

dependabot Bot and others added 30 commits November 19, 2026 00:10
Bumps [globals](https://github.com/sindresorhus/globals) from 17.9.0 to 17.14.0.
- [Release notes](https://github.com/sindresorhus/globals/releases)
- [Commits](sindresorhus/globals@v17.9.0...v17.14.0)

---
updated-dependencies:
- dependency-name: globals
  dependency-version: 17.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix(infra): reconcile apex marketing redirect without DNS changes

* fix(infra): expose safe Cloudflare error codes for redirect plans

* fix(infra): use account-token-compatible single redirect

* fix(infra): preserve redirect ownership through managed teardown

* fix(infra): inspect exact redirect phase without pagination

* refactor(infra): simplify apex redirect plan construction

* fix(infra): show coexisting redirect rules in apex plan; skip unused pnpm cache

The read-only plan now reports the other rules in the dynamic redirect
phase (ref, description, expression, action, enabled) so overlaps are
visible before an apply. They are still never modified.

plan-redirect and apply-redirect skip pnpm install, so setup-node's pnpm
cache post-step failed with a path validation error after a successful
plan (run 44290463776). Cache only for provision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: record permission resolution and live plan; archive bare-domain routing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(infra): address apex redirect review findings

- Plan prints only ref/action/enabled/mentionsApex for other rules; the
  run log is public and rule expressions may hold private values.
- Replace the zone id with <zone> in printed paths and error messages.
- Non-JSON responses fail without quoting the body; a mutation result
  without rules fails with the intended confirmation error.
- Confirm unrelated rules by definition and order, not by
  Cloudflare-managed fields such as version or last_updated.
- Teardown redirect cleanup is continue-on-error like the Page Rule
  step; teardown.yml uses the secondary-zone expression main requires.

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: default CI waits to terminal suite and workflow events

* docs: record terminal CI guidance validation and rollout plan

* style: format CI guidance and task evidence

* docs: record full CI guidance validation and baseline reproduction

* docs: retain CI waits across individual workflow completions

* test: share terminal CI subscription fixture setup

* docs: record PR 2883 takeover and gate status

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-dev): bump @storybook/addon-a11y from 10.6.6 to 10.6.7

Bumps [@storybook/addon-a11y](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/a11y) from 10.6.6 to 10.6.7.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v10.6.7/code/addons/a11y)

---
updated-dependencies:
- dependency-name: "@storybook/addon-a11y"
  dependency-version: 10.6.7
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore(deps-dev): align Storybook family on 10.6.7

@storybook/addon-a11y 10.6.7 declares peer storybook ^10.6.7, but the
lockfile still resolved storybook and the other @storybook packages at
10.6.6. Bump storybook, addon-docs, react and react-vite together so the
whole family resolves to one version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

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>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(api): return conflict at compute pool node limit

* docs: record node-limit staging verification and draft handoff

* task: archive pool node limit conflict task

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Bumps [satori](https://github.com/vercel/satori) from 0.62.0 to 0.63.2.
- [Release notes](https://github.com/vercel/satori/releases)
- [Commits](vercel/satori@0.62.0...0.63.2)

---
updated-dependencies:
- dependency-name: satori
  dependency-version: 0.63.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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>
* chore(deps): bump lucide-react from 0.460.0 to 1.73.0

Bumps [lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react) from 0.460.0 to 1.73.0.
- [Release notes](https://github.com/lucide-icons/lucide/releases)
- [Commits](https://github.com/lucide-icons/lucide/commits/1.73.0/packages/lucide-react)

---
updated-dependencies:
- dependency-name: lucide-react
  dependency-version: 1.73.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore(deps): remove unused root lucide-react dependency

The root package.json declared lucide-react, but nothing at the root
imports it. apps/web, packages/ui and packages/acp-client resolve the
pnpm catalog version (0.460.0), so bumping the root entry to 1.73.0
changes no shipped code. Remove the dead entry instead. The app-wide
0.460 -> 1.x icon migration is tracked separately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

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>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(acp): serialize empty MCP headers and Amp env as arrays

* docs: record ACP serialization validation and draft release hold

* task: archive ACP MCP empty arrays task

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
#2880)

* task: track primary staging GCP provisioning repair

* task: start staging GCP repair

* refactor(api): separate GCP workload identity setup

* fix(api): preserve WIF issuer ownership and unsent allocation proof

* test(api): prove final allocation failure writes remain fenced

* docs: record GCP repair review and pending live gates

* fix(api): preserve resolved binding in unsent allocation proof

* fix(api): name GCP workload identity providers per installation

A provider trusts one issuer, but every SAM installation created the same
`sam-oidc` provider, so two installations could not share a Google Cloud
project: the second setup overwrote the first's issuer (the 2026-11-17
staging2 incident), and with the issuer guard it fails instead. VM and
deployment setup now derive the provider ID from BASE_DOMAIN (readable slug
plus a short hash). Explicit provider-ID overrides still win, and saved
credentials keep the IDs they were created with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: simplify normalized WIF provider slug trimming

* docs: record final GCP WIF repair verification and archive 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(inbox): archive every inbox kind without telling the agent

Raphaël (2026-11-17), extending the silent archive of questions and reviews
to every kind: "Make all of them silent".

- Tasks: archive closes the task with notified_at set in the closing write
  and admits no sam.inbox event, so no watching chat is woken. Done and
  reopen still wake.
- Secret requests: archiveRuntimeSecretRequest closes the request as declined
  with notified_at set, no notice; the expiry path no longer applies.
- Operations approvals: decideOperationsAction takes a required
  `delivery: 'notify_agent' | 'silent'`; inbox archive denies silently, the
  admin decision route and inbox answers still notify.
- Permissions (ACP interactions): archive resolves the inbox marker with
  reason `archived` and answers nothing; the interaction stays pending and
  answerable in its chat. The marker is projected once per interaction, so it
  does not return. New archiveInteractionAttention checks task:write, chat
  writer, and that the marker is this chat's pending interaction.
- Ports: explicit archiveInteraction / archiveSecret / archiveApproval.
- Copy and docs: inbox guide, API reference, Connector tool text, MCP
  assign/attach descriptions, noticeRetryMinutes, secret card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(inbox): audit a teammate's permission archive; skip every archived item in sweeps

From security review of #2873: archiving a permission now records the
session.shared_answer event for a grantee, as question archives do, and the
notice and undelivered-answer sweeps skip every archived item (an earlier
build's archived tasks included).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(inbox): archived permissions keep SAM's check-in hold; task watches wind down

From correctness review of #2873.

- HIGH: archiving a permission resolved its attention marker, and that marker
  is what keeps the silent-agent reconciliation off a chat whose agent waits
  on a person; after the hard stall SAM would cancel the prompt and check in.
  Archive now sets a new `inbox_archived_at` (DO migration
  082-attention-marker-inbox-archived, additive column + index) instead of
  resolving: the summary (inbox list, chat list) skips the marker, the
  summary delta re-reads chats with newly archived markers, and the item read
  reports it archived, while reconciliation still sees it unresolved.
- MEDIUM: an archived task's watches now wind down (closedTaskWatchHours), as
  a moot task's do, since no event does it.
- MEDIUM: request_secret and ops_request_action text says an inbox archive
  sends no notice; task watcher comments no longer list archive.
- The no-longer-emitted inbox.task.archived event type is kept, commented.

Tests: reconciliation candidates exclude a chat with an inbox-archived
permission and include it once the marker resolves (fails if archive
resolves the marker); the permission worker test asserts the marker stays
unresolved and the item leaves the inbox (failed before the delta change);
the summary delta plan uses the new index; the task test asserts its watch
expires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(inbox): remove the archived notice no archive sends any more

Every inbox archive is silent and the notice sweep skips every archived
row, so the archived outcome, its agent text and its notice headline
had no caller left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(inbox): address review on silent archive for every kind

- Connector sam_inbox_archive: an Operations approval can only be denied
  in the SAM app (requireWebApprovalDecision), so archiving one there is
  refused; results archive like questions.
- Reconciliation test: try the wrong-chat archive while the marker is
  still unarchived, so a missing session predicate fails the test.
- Task watch test: no expiry while open, then one within the archive
  window plus the closed-task grace.
- DO migrations test: migration 082 adds idx_attention_inbox_archived_at.

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>
* test(api): reproduce follow-up failure before first VM

* fix(api): hold follow-ups before initial VM placement

Keep pre-workspace task follow-ups in the durable inbox until startup is ready. Retained sleep history still delegates to recovery, while existing readiness retry and TTL policy bound the wait.\n\nThanks to leonceaklin for the diagnosis and prior approach in zebra-pig#17.

* chore(api): record startup delivery validation evidence

* test(api): share durable VM prompt claim harness

* docs: record first-VM follow-up staging validation

* task: archive hold first-VM follow-ups task

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
* fix: accept exact composable capacity source anchors

Align placement admission with the secret-free attachment/version anchors written by reconciliation. Keep real credential authority checks and cover reconciliation through allocation, reuse, and final reservation on migrated SQLite.

Adapted narrowly from zebra-pig#9; unrelated node-limit and ACP changes are excluded.

Co-authored-by: Léonce Aklin <18514574+leonceaklin@users.noreply.github.com>

* chore: record composable allocation review evidence

* test: format composable allocation regression and record full validation

* docs: record draft validation and deferred staging

* task: track pre-existing pinned-workspace allocation-guard 500 gap

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep composable placement authority within D1 expression depth

Staging showed the placeholder attach for a composable-credential workspace
failing on every NodeLifecycle alarm with "Expression tree is too large
(maximum depth 100)": SQLite nests an AND chain one level per term, and the
composed attach statement needed depth 102 (with or without the exact-anchor
change). The node booted but the workspace was never linked.

Group the capacity-authority EXISTS predicate into pool, source, candidate
and credential parentheses. Same terms and binds; the captured staging
statement drops from depth 102 to 76.

better-sqlite3 allows depth 1000, so the regression runs on Miniflare's D1,
which enforces the production cap. Reverting the grouping fails exactly the
two composable attach cases with the D1 depth error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: cover composable restart within D1 expression depth

The Cloudflare review measured reserveWorkspaceRestart at depth 106/107
before the grouping (80/83 after), the tightest caller. Add it to the
Miniflare D1 suite, and scope starter-machine picks to each fixture's
own pools since storage is shared within the file.

Reverting the grouping now fails exactly the four composable attach and
restart cases with D1's depth error; 12/12 pass with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: answer a pinned workspace on a node without authority with 409

Live staging of the composable anchor fix excluded the pool source and
re-sent the pinned request: no workspace was created, but the plain Error
from assertNodeAllocationPlanCurrent reached the global handler as HTTP
500 and opened a new error group in the staging log.

Authority drift now throws NodeAllocationAuthorityChangedError (an Error
subclass with the same messages; background provisioning callers are
unchanged). The pinned route calls assertPinnedNodeAllocationPlanCurrent,
which maps it to 409 CONFLICT; an unavailable database stays a server
fault. Closes tasks/backlog/2026-11-18-pinned-workspace-stale-allocation-
plan-returns-500.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: log pinned authority refusals and name the recovery action

Security review of the pinned 409: rule 11 wants a structured rejection
log with the identifying IDs, and the conflict message should tell the
caller what to do. Log node_allocation.pinned_authority_refused with
nodeId, userId, projectId and action 'rejected', and append "Choose another
node or omit nodeId." to the 409 message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: drive the pinned 409 through the real workspace route; archive task

Task-completion validation found the pinned-409 criterion claimed a route-level
test while the tests called the wrapper directly. Add one through
registerWorkspaceCreateRoute on real SQL: the owner control places on the
current node (201), and after excluding its source the identical request returns
409 with no workspace row. Pointing the route back at the unwrapped guard fails
it with the old 500.

Record the final-head staging evidence and mark the superseded 500 notes. Track
the deferred depth-headroom canary in the backlog, and archive the task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: point references at the archived composable anchor task

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Co-authored-by: Léonce Aklin <18514574+leonceaklin@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…25) (#2901)

* fix(worker): bound shared in-flight joins so a dropped flight cannot hang joiners (L22a, F25)

Per-isolate in-flight reads (admin settings, credential rows, kill-switch KV,
platform config, LLM endpoint snapshot, R2 archive operations) are now joined
through worker-core's joinSharedFlight/settleSharedFlight. A joiner waits at
most the flight's own deadline plus a 1 s grace, then starts its own read.
On the self-host celld runtime, where a disconnected request's ops are
dropped, the celld entry also makes joiners resume on their own timer. That
mode is off on Cloudflare.

Adds pnpm quality:shared-flight-joins (blocking in CI).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(worker): cover the two parameter-reached shared-flight joins; track compact-r2 eviction

Review fixes for L22a:
- abandonment tests for AdminSettingsCache and the LLM endpoint snapshot, the
  two join sites quality:shared-flight-joins cannot see (their cache entry is
  reached through a parameter); each proven red with its join reverted
- one import path for the shared-flight helpers in the Worker
- accurate header on the apps/api re-export; checker header and README list
  library-held flights (jose JWKS) and point at the behavioural tests
- compact-r2's non-eviction of an abandoned R2 operation on celld is tracked
  as a backlog task referenced from the code (rule 42)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(worker): cover the platform-config join cap and the celld own-timer R2 join

Task-completion-validator findings on L22a:
- the MAX_PLATFORM_CONFIG_JOIN_ATTEMPTS fallback answers from one
  unpublished read after three revoked reads (red with the cap raised)
- on celld a writer joining a pending R2 PUT resumes on its own timer, not
  on the PUT settling (red against main's compact-r2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(quality): clear SonarCloud complexity and await findings on shared-flight code

- llm-endpoint-snapshot: extract currentEntry/forgetEntry so
  resolveLlmEndpointSettings drops below cognitive complexity 15 (S3776).
- shared-flight: replace `await null` with `await Promise.resolve()` (S4123);
  both resume after exactly one microtask, after an already-settled flight's
  reaction has recorded the outcome.
- check-shared-flight-joins: split collectModuleHeldClasses, moduleRoot,
  resumptions, findSharedFlightJoins, listModulePromiseHolders and main into
  small helpers (S3776). Pure refactor: --inventory --json output is
  byte-identical to the previous script, and the full scan still reports
  2310 files, 0 findings, and still flags an injected direct await.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(worker): refuse a revoked platform-config fallback read; trace every root in the join check

CodeRabbit review of L22a:
- the attempt-bound platform-config fallback read now throws IoTimeoutError
  when a write revoked its generation while it was pending, instead of
  returning pre-write config (red with the check disabled)
- quality:shared-flight-joins collects every root of &&, ||, ?? and
  conditionals, so a module-scope boolean cannot hide a shared promise
  (red against the previous checker)
- README: the celld own-timer resume mode is opt-in, off by default

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(worker): share the platform-config abandonment setup; optional chain in snapshot

SonarCloud: new duplicated lines 4.0% (gate 3%), all from the three
platform-config cases repeating their setup, now two helpers. S6582 in
llm-endpoint-snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(project-data): wait for the R2 joiner to park before settling the PUT

The celld own-timer test settled the PUT after a fixed number of ticks. The
joiner hashes its body with real async crypto first, so under coverage load
it could reach HEAD after the PUT had settled and never join. Wait for the
timer the joiner registers on the pending operation instead. Still red
against main's compact-r2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(project-data): wait for the starter's PUT on a condition, not a tick count

Same race as the joiner one step earlier: under CI coverage load the starter
had not reached its PUT within 20 ticks. Stable over six parallel coverage
runs; still red against main's compact-r2.

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 draft-only provisioned node ownership fix

* fix(api): hold provisioned nodes for their placement owner

Adapt the shared hold predicate and initial regression approach from zebra-pig#28; preserve lifecycle provenance and bound crash-safe fallback upstream.

Co-authored-by: Leonce Aklin <18514574+leonceaklin@users.noreply.github.com>

* test(api): prove fallback admission budgets and boot interleaving

Record final base-red and fixed workerd evidence, serialize stepped test alarms, and preserve clean SQL fixtures between scenarios. Keep PR2855 draft-only.

* docs: record draft PR validation and staging blockers

* docs: preserve corrected-account staging handoff

* docs: checkpoint safe deployment candidate and staging queue wait

* docs: record merged-runtime CI success and staging reservation

* docs: record corrected-account ownership race verification

* test(api): pin provisioned-node fallback ownership scoping; allowlist staging2-applied 0257

Security review follow-up: real-SQL attack cases for a foreign node, a
foreign task owner, a both-foreign runner and a foreign project, each
paired with the owner control and proven discriminating by neutralizing
its guard. Keep 0257_node_task_provisioned.sql (applied on staging2 as
d1_migrations id 276) and allowlist the duplicate prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: record resume evidence and archive provisioned-node ownership task

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Co-authored-by: Leonce Aklin <18514574+leonceaklin@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
)

* feat(api): add private owner retained snapshot export

* feat(web): add owner retained-work downloads with phone validation

* fix(api): import ProjectData from the project-data package after main integration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: address retained-export security review after main integration

- Deny shared-session grantees (owner control still downloads); proven
  discriminating by neutralizing the owner predicates.
- Smoke-test that the export router does not shadow session detail.
- Recheck only ownership and served-bytes fields after streaming starts,
  so unrelated column writes cannot fail a valid download.
- Restyle the download control as a SAM Glass slab with raised actions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(web): retained export audit uses SAM Glass 44px targets; refresh evidence

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: move retained export reference beside chat routes; revert out-of-scope spec edit

Also point the Worker test at the project-data package for the ProjectData
type and record the integration and review work in the task file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: archive owner retained snapshot export task

* fix(api): export the verified retained generation after recovery re-routes the session

CodeRabbit: ensureSessionSnapshotForSleep refreshes workspaceId and
agentSessionId on the snapshot row while the last verified generation and
its manifest stay authoritative, so comparing them rejected a valid
capture. Validate by owner, project, session, key and integrity instead.
Regression test fails with the old comparison. Also sort test imports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): show retained download only for stopped or failed sessions; keep pane off <details>

The SAM Glass chat and immersive audits failed because the slab rendered for
every owned session, including active ones, and the pane class sat on a
<details> element whose closed content cannot host the fixed-position probe.
Gate the control on stopped/failed status (a sleeping-session test proves the
gate; it fails without it) and move the glass class to a wrapper div.

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>
…2902)

* feat(selfhost): celld build and deploy core, plaintext mode (L22b, WIP before L22a merges)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): pass the box's env file, state dir and secrets to the deploys an upgrade runs

selfhost:upgrade accepted --box-env/--state-dir but ran `pnpm selfhost:deploy --init` and
`pnpm selfhost:deploy` without them, so both resolved the checkout's default deploy/selfhost/.env
and .state: a different box, where --init could mint new platform keys. Every deploy call and the
printed rollback now carry --env-file, --state-dir and (new) --secrets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): never mint platform keys over an earlier deploy; write them atomically

- platform-keys.json is created only by `selfhost:deploy --init` on a state dir with no
  PRIOR_DEPLOY_EVIDENCE (project/wrangler.json, gateway.env, mail-collector.env, sealed key
  bundles); a plain deploy without the file refuses and names the backup to restore.
- An existing key with an empty value is an error instead of being regenerated.
- The file is replaced atomically (0600 temp, fsync, rename, dir fsync), keeping the previous
  content as platform-keys.json.bak.
- secrets.env may not override a platform key (installation id and gateway secret included)
  unless it repeats the generated value.
- --dry-run writes nothing: no state dir, no keys (placeholders in the output), no gateway.env
  or mail-collector files.
- The fleet bucket credentials are scrubbed from printed celld output.
- deploy/selfhost/.gitignore keeps .env, .state/ and backups/ out of the checkout's commits.
- deploy-plaintext.test.ts is deploy.test.ts: plaintext is the only mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): create-account reads the deploy's --secrets file and fails closed on --superadmin

create-account read BOOTSTRAP_OWNER_EMAIL from <state-dir>/secrets.env only, so a deploy that used
--secrets elsewhere left the owner undefined and the "--superadmin waits for the owner" guard
silently off. It now takes --secrets (deploy's default), and --superadmin refuses when that file
is missing, since a missing file cannot be told apart from one at another path. A present file
without BOOTSTRAP_OWNER_EMAIL is an install with no owner gate (bootstrap-owner.ts), so
--superadmin proceeds there. The fleet access key id is now scrubbed from celld output too.

CLI entry guards (create-account, generate-keys) compare real paths (scripts/deploy/entrypoint.ts),
so a symlinked or space-containing path no longer silently does nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(api): the Cloudflare entry must not reach scripts/ (scripts/selfhost included)

CLOUDFLARE_ENTRY_FORBIDDEN_PATHS adds `scripts/` to the self-host-only prefixes for the shared
entry's import graph. Proven by importing scripts/selfhost/versions.ts from apps/api/src/index.ts:
the shared-entry test reported it and went red; reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(selfhost): box-settings takes reverse-tunnel defaults and bounds from the Worker

The port range defaults, range-size cap, heartbeat timeout default/min/max, port-reuse multiple
and maximum reuse age move to apps/api/src/selfhost/reverse-tunnel/limits.ts (no imports, so the
node deploy script can load it); config.ts imports and re-exports them, and box-settings.ts
imports them instead of keeping its own copy. config.ts is prettier-formatted while touched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: select self-host suites by what they read, not by scripts/selfhost/**

- Validate Deploy Scripts also runs on packages/vm-agent/go.mod: vm-agent-artifacts.test.ts pins
  the Go build image to its go directive. The Go-modules runner budget goes 26 -> 27 (a real Go
  modules PR already started it through go.sum).
- api-unit lists the scripts/selfhost modules apps/api tests import and their transitive
  imports, plus scripts/deploy/durable-object-migrations.ts (imported by celld-config.ts), instead
  of all of scripts/selfhost/**. The deploy-scripts filter keeps apps/api/src/selfhost/**: its
  tests read the self-host migrations, limits and build entry there.
- Backlog: ci-suite-selection.test.ts does not follow `./x.js` imports to `x.ts`, so transitive
  reads through scripts/ modules go unchecked (found while verifying this list).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): refuse vm-agent build paths with a comma (docker --mount injection)

`--mount type=bind,src=<path>,...` is a comma-separated option list, so a comma in the cache dir
(or the source dir) would inject mount options. bindMount() refuses it; the cache dir is checked
before anything is created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(selfhost): name mechanisms instead of plan rounds; share REPO_ROOT, log and celld port

- Comments cite the code path or the observed behaviour instead of planning and integration-branch
  labels (box rounds, sibling tasks, L/F/T/B ids).
- selfhost-build.test.ts drops assertions about setting names that exist nowhere.
- REPO_ROOT, log and celldPort() (CELLD_PORT or compose's default, from BOX_RESERVED_PORTS) live
  in deploy-steps.ts; deploy, create-account, upgrade and celld-adopt use them. upgrade.ts no
  longer treats an empty CELLD_PORT as a port.
- Constants and helpers only their own module uses are no longer exported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: record L22a shipped evidence and L22b progress

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(api): prove the scripts/ prefix in the Cloudflare boundary list is live

Task-completion-validator: no real Worker file imports scripts/, so deleting
the prefix left every test green. A synthetic graph now asserts the Cloudflare
list reports a scripts/ file and the self-host list does not (red with the
prefix removed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): linear-time dotenv and bucket-prefix parsing; pnpm exec tsc in CI

SonarCloud S8786: the dotenv NAME=value regex (\s*=\s*(.*)$) and the
fleet-prefix slash trim (/\/+$/) backtracked quadratically (~1.5 s and
~1.2 s on 40k-character inputs). Both are now plain string parsing with
the same accept/reject behaviour (differentially fuzzed against the old
implementation, 300k inputs, 0 mismatches), with regression tests that
pin the accepted shapes, the rejected lines and the adversarial timing.

SonarCloud S6505/S8543: the deploy-script typecheck step used npx, which
can fetch packages at run time; pnpm exec runs the installed typescript.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(selfhost): clear SonarCloud code smells in the self-host scripts

Pure refactors, no behaviour change:
- S3776: split deploy.ts main(), buildCelldConfig, smtpWorkerVars,
  ensurePlatformKeys and runUpgrade into named helpers.
- S3358: celld release targets are a lookup table; the esbuild bin field
  is read by a helper.
- S4624 / S7744 / S7773 / S6557: no nested template literals, no
  spread of an empty fallback object, Number.NaN, endsWith('.env').
- S7785: deploy.ts and create-account.ts await main() at top level;
  create-account.ts keeps its isEntrypoint guard so importing it in
  tests does not run it.
- S5906: toBeNull / toBeUndefined matchers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): report a stored mixed-case account; owner guard in the sign-in test

parseAccountReport compares the reported address case-insensitively, as the
SQL's lower(trim(email)) match does. The integration helper now passes the
box's BOOTSTRAP_OWNER_EMAIL into createAccountSql, with a non-owner
--superadmin case proving nothing is inserted or promoted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): never regenerate a lost identity key; complete new groups only with --init

ENCRYPTION_KEY and SAM_INSTALLATION_ID have been in every platform-keys.json
ever written, so either one missing from an existing file was lost, not added
by a newer version: every mode now stops with a restore-from-backup error.
Any other group missing from an existing file is generated only by --init,
which selfhost:upgrade runs before deploying; a plain deploy refuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): replace gateway.env and the collector env files atomically

docker compose reads gateway.env and mail-collector*.env as env_files. They were
truncated and rewritten in place, so a concurrent compose start could read an
empty file and an interrupted write could leave one. They now go through
replacePrivateFile (0600 temp, fsync, rename), which also refuses an existing
file owned by another user, as the in-place writer did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): upgrade retries, box-scoped rollback, selected compose files

- A failed upgrade leaves the checkout at the target, so equal refs no longer
  mean "deployed": the upgrade records the ref it started from in
  <state-dir>/upgrade-pending.json and removes it only after health passes. A
  retry resumes from that ref, reruns every step (restarting the stack) and
  rolls back to it.
- Printed rollback compose commands use the selected box's compose files and
  .env, as the forward path does, shell-quoted.
- A change to any compose file COMPOSE_FILE selects, inside deploy/selfhost or
  not, restarts the stack.
- The rollback includes --init and the stack restart when --init changed
  generated state, on both the failure and the success path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): build the vm-agent with CGO_ENABLED=0

Go enables cgo only for a native build, and records CGO_ENABLED in the
binary: the amd64 vm-agent built on an amd64 box was cgo-enabled and
dynamically linked, the same release built on an arm64 box was not, and the
immutable release key refuses the second set of bytes. Verified locally with
go1.26.11: native amd64 build reports CGO_ENABLED=1 and dynamic linking, the
CGO_ENABLED=0 build is static and its sha256 differs. The Cloudflare pipeline
sidesteps this by pinning one runner; its arm64 binary is already a cgo-free
cross build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): spawn operator tools by absolute PATH lookup; time out graph walks at 60 s

SonarCloud S4036 (classified as vulnerability, gate needs A): commands are now
resolved once through commandPath(), which searches only absolute PATH entries,
so a file in the working directory can never stand in for pnpm, docker, bash or
sh. CI: the import-graph walks exceeded vitest's 5 s default on a loaded runner.

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: stranded platform node exit path

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(api): operator attestation path for stranded SAM-capacity nodes; name providerless teardown refusals

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(api): operator node deletion and named providerless refusals (workers, real D1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(web): Admin → Infrastructure stuck nodes panel with operator removal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(web): stuck nodes panel visual audit; copy and wrap fixes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: stuck SAM-capacity nodes and the operator removal path

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: update stranded node exit checklist

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(api,web): address review — audit before proof, refusal allowlist, platform-only lookup, claim denylist

- Write the operator audit row before the proof and refuse if it cannot be written; record refusals.
- Admit only refusals that mean SAM cannot see the server (OPERATOR_REMOVABLE_BLOCK_REASONS) and bind
  the CAS to the exact refusal read.
- Look up with the pinned or platform credentials only; refuse a providerless node whose ownership
  labels cannot be built while a credential could look.
- Task claim guard is a terminal-status denylist; pending workspaces also block.
- Only fence/CAS refusals map to 409 (NodeIncarnationFenceError); other errors surface.
- Stuck-node list shows only nodes with a recorded refusal; per-row operatorRemovable.
- Panel: sticky dialog actions, provider labels, guarded close, copyable name/label, details disclosure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(web): stuck nodes audit covers each confirmation gate, Escape, refresh failure, on-screen actions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: operator removal admission, audit order and lookup scope after review

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(api,web): CodeRabbit round 1 — build reservation in proof CAS, unreadable SAM credential is inconclusive, compare shown refusal, rank actionable nodes first

- Final proof write refuses while a Cloudflare build is reserved on the node.
- An enabled platform credential that cannot be read returns 503 instead of falling through to
  the operator's word.
- The UI sends the refusal it showed (expectedBlockedReason); a changed refusal is refused.
- Stuck-node list ranks operator-removable nodes first, so non-actionable rows cannot hide them.
- Real-worker (SELF) authorization test for the mounted routes.
- Backlog task for the pre-existing owner-path stranded-task case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(web): assert the shown refusal is sent with the removal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(api): refuse agent sign-in sessions on operator node removal by default (opt-in setting)

The owner's production policy on agents attesting a server is gone is still open, so the safe
default ships: an agent sign-in session gets 403 before any provider call or audit write unless
operations.operatorNodeDeletionAllowAgentSessions is on (read with no cache). The audit still
records agentSignIn either way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(api): allow audited agent sign-in sessions on operator node removal by default

Owner decision (ask 01M7RX9S6DG1NDNKPPHARGBT96, 2026-11-19 07:45Z): "Allow agents (audited)
everywhere". operations.operatorNodeDeletionAllowAgentSessions now defaults to ON; a superadmin
can turn it off. The audit keeps recording agentSignIn. The Workers test resolves the default
through the real resolver and covers the explicit OFF refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(api): agent-session setting fails closed when settings cannot be read

A failed settings read fell back to the default (now on), so an installation that had turned
agent-session removal off could admit one. unavailableValue: false keeps the opt-out; a successful
read with nothing stored still resolves to on. Unit test through the real resolver, red without it.

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 sticky deployment pool placement fix

* fix: retain eligible deployment nodes across pool provider reorders

* test: cover volume affinity and retained credential attribution

* docs: record sticky placement validation and reviewer evidence

* test: update compose submission mock for volume affinity reads

* docs: archive validated sticky placement implementation

* refactor: return explicit deployment admission result

* fix: retain volume affinity when manifest omits volumes

* fix: preserve exclusive admission for stored deployment volumes

* style: sort sticky deployment regression imports

* fix: report specific deployment node admission refusals

* fix: identify direct deployment placement mismatches

* test: expect direct placement diagnostic for legacy refusal

* refactor: isolate deployment rejection classification

* fix: retain node authority when relocating full sticky deployments

* refactor: separate deployment node score selection

* fix: preserve creating-node relocation authority

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
* fix(security): one owner per GCP workload identity pool

A stored GCP WIF credential could name any (project number, pool). SAM
signed an identity token for it, the user-level provider checked only
SAM's issuer, and its pool/* binding let one user impersonate another
user's (or the installation's) service account.

Worker side (no GCP change needed):
- gcp-wif-pool-ownership: a credential may name a pool only when no
  credential of a different owner (another user, or the installation)
  names it. Enforced at save (409) and before signing any token.
- gcp_wif_pool_index (migration 0262) indexes the pool each encrypted
  credential names, keyed by IV, reconciled in the same D1 batch as the
  owner read: writer-independent, one round trip per check, per-row
  fault isolation, fail-closed time budget.
- Token exchange takes an explicit requester; project credentials use
  the stored row's owner.

GCP side:
- User-level setup scopes the provider to assertion.user_id and binds
  attribute.sam_user/<userId>; re-running setup narrows an existing
  provider and removes the pool/* member. No issuer-only scope remains.
- Guided setup checks the pool before changing anything in Google.

Production audit (counts only): every GCP credential belongs to one
owner, so no existing connection is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(security): sticky GCP WIF pool claims and owner user_id claim

Review round 1 on the pool-ownership guard:
- Claims (gcp_wif_pool_claims) outlive the credential that made them:
  a disconnect or re-point leaves Google's pool/* trust in place, so it
  must not free the pool for another owner. First claim wins atomically;
  an operator releases a claim (documented in self-hosting).
- Sign user_id as the credential owner for user and project-scoped
  credentials, so project-attached credentials match the user-scoped
  provider; the cache key keeps its old shape.
- Partial indexes keep the probe proportional to cloud credentials
  (query-plan test), settings are read only when indexing, unparseable
  probe rows fail closed, unreadable rows retry after a window.
- Exchange refuses leading-zero project numbers and provider IDs or
  service-account emails that could alter the audience or IAM URL.
- Refusals log at warn; IAM conditions and policy version are kept.
- Vertical tests through the real resolver for project members.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(security): namespace fallback project_id; fail closed on WIF index limits

Review round 2 on the pool-ownership guard:
- When a token acts for no SAM project, sign the credential's own GCP
  project as gcp-project:<id>, so a typed gcpProjectId can never pass
  for another user's SAM project at a project-scoped provider.
- Cap D1 queries per check (gcpWif.poolIndexMaxQueriesPerCheck, exact
  statement count) and map indexing faults and malformed batch results
  to the designed 503; progress stays durable.
- Docs: corrected residual risk (pools SAM never recorded), release
  steps, new setting. Backlog task for probing open providers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(security): composable exact-path owner test; revert unrelated log-key rename

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: archive gcp-wif-cross-owner-pool-impersonation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: give each resave Workers test its own GCP pool (claims are sticky)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(security): CodeRabbit round on GCP WIF pool ownership

- Withhold first claims while another owner's credential is unreadable
  (it might name the pool); retry window default 10 minutes.
- Claim deployment pools: migration 0262 backfills unambiguous owners,
  and deployment setup checks ownership before mutating Google.
- Reconcile the index before any cloud credential delete, so a
  disconnect before the first post-deploy check keeps its claim.
- Read service-account IAM policies as version 3 so a conditional
  pool/* grant is removed; write version 3 when conditions remain.
- Fit each indexing page to the statement budget before any write,
  translate D1 rejections to the retryable 503, honour the configured
  retry interval, and read at most one foreign holder per source.
- Tests use the production error handler and build both tables from
  the real migration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(security): claim stored WIF credentials unconditionally; withhold only new first claims

Delta review: one unreadable row must not refuse existing users, and a
delete must leave its pool claimed. Stored credentials now claim at
index time; only a new credential's first claim waits while another
owner's row is unreadable (GCP_WIF_POOL_OWNERSHIP_UNRESOLVED, logged at
error level with the rows). Switching a WIF connection to a key records
the outgoing pool first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(security): narrow the unreadable-row withhold to GCP rows; fix fixtures

- Only an unreadable credential that could be GCP (legacy/platform rows,
  or a composable row a GCP configuration uses) withholds new claims, so
  a corrupt credential of another provider cannot block GCP setup.
- /api/gcp/verify shows the ownership refusal instead of a generic
  Google error.
- Fixtures: shared migration helper for hand-built SQLite schemas; real
  ciphertext for placeholder rows in the shared-D1 Workers suite;
  reconcile spy in the mocked project-credentials route test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: keep a reviewed secret-scan fixture line in place

The gitleaks baseline digest includes the line number; reuse the existing
sqlite-d1 import line instead of adding one above the fixture constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(security): unconditional WIF grant check; deployment owner on persist

- grantWifUserOnSa counts the scoped member as granted only in an
  unconditional binding, so a conditional grant cannot satisfy setup.
- Deployment setup persists the owner whose pool claim it checked, so a
  concurrent first setup by another member cannot leave a mismatched row.
- Docs: deployment-pool ownership per Google Cloud project; residual for
  the first reconciliation after an upgrade with an unreadable row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: reconcile WIF pools only before deleting a credential that can name one

Agent keys and non-GCP platform credentials no longer pay for, or wait
on, pool reconciliation when deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(security): record GCP pools before a project deletion cascades its credentials

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>
…n /deploy/selfhost/sam-mx (#2891)

* chore(deps): bump github.com/emersion/go-smtp in /deploy/selfhost/sam-mx

Bumps [github.com/emersion/go-smtp](https://github.com/emersion/go-smtp) from 0.25.1 to 0.26.0.
- [Release notes](https://github.com/emersion/go-smtp/releases)
- [Commits](emersion/go-smtp@v0.25.1...v0.26.0)

---
updated-dependencies:
- dependency-name: github.com/emersion/go-smtp
  dependency-version: 0.26.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* test(selfhost): verify SMTP protocol compatibility across upgrade

* docs(task): record SMTP validation and independent reviews

---------

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>
…#2892)

* chore(deps): bump alpine from 3.22 to 3.24 in /deploy/selfhost/sam-mx

Bumps alpine from 3.22 to 3.24.

---
updated-dependencies:
- dependency-name: alpine
  dependency-version: '3.24'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix(deps): validate pinned Alpine runtime and resolve Docker image findings

* docs: record Alpine runtime live verification and restored box

---------

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>
* chore(deps): bump @aws-sdk/client-s3 from 3.1141.0 to 3.1169.0

Bumps [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-s3) from 3.1141.0 to 3.1169.0.
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-s3/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.1169.0/clients/client-s3)

---
updated-dependencies:
- dependency-name: "@aws-sdk/client-s3"
  dependency-version: 3.1169.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix(deps): align S3 client and presigner dependency graph

---------

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>
* docs(www): journal post on GCP workload identity pool ownership

SAM's daily journal post about #2905: an issuer-only Workload Identity
provider plus a pool/* binding let one SAM user act as another's service
account; fixed by user-scoped Google trust and a one-owner-per-pool check
before SAM signs. Adds the X card.

Corrects the re-run guidance in google-cloud.md, self-hosting.mdx and
security.md: re-running setup on a pre-#2880 connection creates the
installation's own provider rather than rewriting sam-oidc, and the
Re-run Google setup button only appears when a connection reports an API
issue. Files a backlog task for a re-run control on healthy connections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(www): qualify the no-stored-secret claim in the WIF journal post

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(www): address CodeRabbit review on the WIF journal post

The old shared provider is not untrusted: its user_id mapping can still
match the user-scoped binding, though only for the owner's own tokens.
Qualify the provider update for the default per-installation ID, and
document the disconnect interruption, changed pool/SA settings and the
shared-installation cutover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(www): cover changed pool or service-account IDs in the rerun steps

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>
…structions) (#2909)

* docs: frame SAM as self-hosted, not SaaS, in the WIF journal post and agent instructions

The 2026-11-19 journal post on GCP workload identity pool ownership read
as if SAM were a multi-tenant service open to the public, and compared it
to GitHub Actions. SAM is an open-source, self-hosted control plane: each
installation belongs to one person or organization, usually a team. The
post now says who the bug was a risk to (other accounts on the same
installation), why it was still a real bug (trust between users exists only
where it is set up on purpose), and drops the SaaS comparison.

Adds a short "Self-Hosted, Not SaaS" section to root CLAUDE.md and a
matching line in the blog authoring guide. To stay under the launch-context
ceiling, trims a duplicated staging troubleshooting bullet, the pnpm
typecheck bullet that repeats Common Commands, and the Recent Changes
paragraph (kept as a one-line heading that speckit and /prioritize use).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(www): drop 'public multi-tenant service' framing from boundaries journal post

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: qualify the self-hosted threat model on signup approval

Signup approval is off by default (signup-approval.ts), so an internet-facing
installation with open signup admits strangers. Say so in root CLAUDE.md,
the blog authoring guide and the WIF journal post instead of 'not the
public', and point operators at Admin -> Users. Addresses Codex review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: address CodeRabbit review on self-hosted framing

- Post: guided WIF setup is the recommended keyless option; service-account
  JSON upload is also supported.
- Post: the exposed case needs only one user who connected Google Cloud
  plus another account; the audit reports stored owners without claiming
  no pool was ever named by someone else.
- CLAUDE.md and the authoring guide keep anonymous internet callers in the
  threat model; the cross-account wording covers cross-user isolation only.

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(selfhost): one-box compose stack, Caddy, frps and object store (L22c)

Brings the box runtime from the integration branch in plaintext mode: celld, Caddy, frps, the
bundled object store, the mail collector and sam-mx. Without the egress fence, key agent, docker
proxy and metadata proxy (and the files only they read: celld.env, egress-fence.nft,
key-agent/agent.env, celld/start.sh), and without the key-rotation Caddy fragment.

F11: the two local images (caddy, sam-mx) are never pulled (pull_policy: never) and are built only
by an explicit `docker compose build` or when missing. The Caddy Dockerfile pins both images by
digest and both modules by version, fetches modules only from proxy.golang.org with sum.golang.org
verification and GOTOOLCHAIN=local, and fails unless the binary carries exactly those versions.
Its build context is empty (.dockerignore), so Caddyfile edits never touch the build.

F21: the gateway-route variant matcher reads the raw request target and accepts any encoding
depth of every character of "api" and "self-host", backslash separators and absolute-form
targets (L1), matches only an "api" segment followed by a "self-host" segment instead of any path
containing "self-host" (L6), refuses dot-segment targets naming self-host in any encoding, and
caddy-ratelimit limits frp connections per client address (L7, SAM_FRP_LOGIN_RATE_LIMIT_*).
start.sh refuses any box port inside the lease range, as compose actually runs it (L5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): check box ports as docker compose runs them (F21 L5)

Compose takes a variable from the shell before the .env, so `CELLD_INTERNAL_PORT=20001 docker
compose up` put celld's operator API inside the lease range the deploy had checked against the
.env only. The deploy (and upgrade's box loader) now apply shell overrides of every
BOX_RESERVED_PORTS name before the range check and report each one. The deploy harness strips
those names from the test runner's environment so the suite stays hermetic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): upgrade rebuilds an image only when its build inputs changed (F11)

`selfhost:upgrade` ran `docker compose up -d --build` whenever any compose input changed,
rebuilding (with network access) on every such upgrade. It now compares each locally built
service's build section in docker-compose.yml at both refs and the files in its build context
(a context whose .dockerignore is `*` counts only its Dockerfile), builds only the changed
services the box runs with an explicit `docker compose build <service>`, and restarts with a
plain `up -d`. The printed rollback rebuilds the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(selfhost): GCP node trust bootstrap (pnpm selfhost:gcp-bootstrap)

The integration branch's gcp-bootstrap.sh, trimmed to the node trust a plaintext box needs: the
install-dedicated workload identity pool, the issuer-scoped OIDC provider, the node service
account and its bindings, and the credential JSON to paste in Admin -> Credentials. Without the
Cloud KMS key for sealed secrets (--kms, --kms-only, key versions) and without --teardown and its
created-resources record, which only teardown read. Adds the selfhost:gcp-bootstrap and
selfhost:live-test scripts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(selfhost): short operator README for the experimental box

Replaces the integration branch's ~1,400-line README with a short operator note, marked as an
experimental test-box setup and not a supported deployment: prerequisites, the fresh-install
sequence, upgrade (no automatic backup), image builds, R2_S3_REGION for s3:// stores, the lease
port range and gateway secret, the frp rate limit, email, and what is not included yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(selfhost): Docker live suite for the box runtime, CI job on self-host paths (D9)

Brings the live suite from the integration branch: caddy-fragments, access-log-keep-warm,
mail-collector, frpc-tls, celld-redirect and shared-flight-cancel, with the harness and celld lab.
Caddy runs from the image deploy/selfhost/caddy/Dockerfile builds, through start.sh, as compose
runs it. New cases: encoded letters at any depth, backslash separators, dot segments and
absolute-form targets never reach the gateway route (L1); public paths naming self-host still
reach celld (L6); frp connections over the per-address limit get 429 (L7); start.sh refuses a box
port inside the lease range and bad rate-limit values (L5). shared-flight-cancel loses its key
agent case (sealed secrets are held) and talks to a plain slow upstream instead.

CI: a Self-host Live (Docker) job runs `pnpm selfhost:live-test` only when deploy/selfhost,
scripts/selfhost or apps/api/src/selfhost change, not for packages/cloud-init and not nightly.
Validate Deploy Scripts builds the API's workspace dependencies first (the GCP bootstrap test
parses with the real credential codec). Dependabot watches the Caddy Dockerfile's digests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(selfhost): README describes upgrade retry and box-scoped compose commands

The upgrade from PR 2 records an unfinished upgrade in .state/upgrade-pending.json and retries
from it, and runs and prints every compose command with the box's .env and selected compose
files; the explicit image rebuild (F11) does the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* style(quality): drop useless quote escapes in dependency-governance test

ESLint no-useless-escape: \' inside a template literal is just '. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci(selfhost): run box static tests on deploy/selfhost changes; route redaction guards run with route changes

deploy-scripts now selects deploy/selfhost/**, so compose, Caddy and gcp-bootstrap
changes run the static tests that read them. The credential-route scan moves out of
scripts/selfhost: the API half into an API unit test, the App.tsx half into a web unit
test, so each runs with the suite CI already selects for those routes (App.tsx in the
API unit filter would have started the API suite on every web routing change).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci(selfhost): drop the workspace build from Validate Deploy Scripts

Only two things needed built packages: gcp-bootstrap.test.ts parsed the printed
credential with parseGcpCredential (imports shared and worker-core dist), and the
scripts/selfhost type check covered live/, whose shared-flight test imports
worker-core. The parser contract test moves to the API unit suite, which builds and
also runs when the parser changes; live/ gets its own tsconfig, type-checked in the
Self-host Live job after its build. pnpm selfhost:test now passes with every
@simple-agent-manager import aliased to a missing module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): gcp-bootstrap refuses a shared pool, pins its APIs and roles to the guided setup

- An existing --pool-id is reused only when every provider in it (deleted ones too) is
  PROVIDER_ID trusting this install's issuer: the service account binding is pool-wide.
- The binding comment no longer claims the pool is this install only: it admits any
  token the install signs for the provider's audience, and SAM does not yet stop a
  user credential from naming the pool (SAM task 01M7SB8FRZ08M5NEX9WGM74X61). README
  and the script say to use a project dedicated to SAM's nodes.
- NODE_APIS / NODE_ROLES document why cloudresourcemanager, aiplatform and
  roles/aiplatform.user are left out; a test fails when the script drifts from
  GCP_REQUIRED_APIS or gcp-setup.ts SA_PROJECT_ROLES.
- A trailing flag with no value is a clear error; --help prints the whole header.
- README: the access log redacts path credentials on the listed routes only, and an
  .env build-arg change needs docker compose build caddy (upgrade never sees it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): celld and frps run with no capabilities and a read-only root

Both listen only on loopback ports above 1023. celld writes only CELLD_WATCH (its
volume) and gets a tmpfs /tmp; checked on the pinned image with cap_drop ALL,
no-new-privileges and a read-only root: a Worker and a SQLite Durable Object serve and
keep their state across a restart, and /tmp stays empty. frps logs to the console and
starts read-only. A static test pins the settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): the bundled object store refuses a root secret under 24 characters

Its root credential reads every Worker secret in the fleet bucket. The entrypoint check
moves from 8 to 24 characters (.env.example and README say so); a test runs the compose
entrypoint under /bin/sh with the image entrypoint stubbed. The deploy test fixture's
fleet secret is lengthened to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): reserve sam-mx's port and check box ports before anything starts

S4:
- SAM_MX_LISTEN (sam-mx's public SMTP listener, default :25; the port after the last
  ':') joins the reserved box ports: the deploy, upgrade and Caddy's start.sh refuse
  it inside the lease range. compose passes it to Caddy.
- loadBoxEnv (box-settings.ts) reads the .env, applies shell port overrides and checks
  the range, so selfhost:deploy refuses before writing platform keys and
  selfhost:upgrade before it fetches, checks out or runs docker compose.
- start.sh checks each lease-range bound is a plain number: a malformed one such as
  1:2 made the -ge test error, which if read as false, silently skipping the check.
- celld, frps and the mail collector have no capabilities, so their ports must be
  1024 or above.

A6: deploy.ts and upgrade-lib.ts share loadBoxEnv instead of each parsing the .env and
applying overrides; SELFHOST_DIR lives in deploy-steps.ts and COMPOSE_PATH derives
from it. The live harness's caddyBoxEnv takes its names from BOX_RESERVED_PORTS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): strip client X-SAM-* headers on every route, not only node sockets

A site-level request_header -X-SAM-* sorts before every handle, so the catch-all route
to celld drops them too, and node-ws.caddy's forward_auth still copies the Worker's own
X-SAM-* answer afterwards (the live forward_auth tests pass unchanged). A live test sends
forged X-SAM-* headers to api, app and a preview host and checks celld sees none; it
fails with the directive removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(selfhost): one Caddy runner, HTTPS client and Docker skip rule for the live suite

A3: caddy-fragments, access-log-keep-warm and mail-collector each built the same docker
run (host network, cap-drop ALL + NET_BIND_SERVICE, the caddy dir, start.sh), logs
reader, TLS wait, teardown and https client. harness.ts now has startCaddy,
runCaddyToExit and httpsGet; DOCKER and hasDocker move there from celld-lab.ts and
every docker call uses DOCKER; every Docker test uses skipWithoutDocker (skipped
without Docker locally, never in CI). celld-lab.ts's header names its real consumers,
and celld-redirect writes its project with writeProject.

S6: start() and celld deploy pass children an allowlisted environment (PATH, HOME,
TMPDIR, LANG, RUST_LOG, DOCKER_*) instead of the whole host environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(selfhost): type the malformed-range cases for the selfhost type check

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(tasks): L22 task file records PR 2 shipped and PR 3 progress

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(quality): reviewed baseline entry for the deploy harness fleet fixture

The PR-range Gitleaks scan flags the deploy test harness's fixed objectstore secret,
lengthened in 6ffc0c8 to meet the 24-character minimum. It is a synthetic fixture;
the entry pins that exact finding and expires in 30 days.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): resolve every compose-interpolated variable from the shell, not only ports

Docker Compose takes every variable its files interpolate from the invoking shell before
--env-file, but the deploy and upgrade applied shell precedence only to BOX_RESERVED_PORTS.
An exported CELLD_BUCKET or SAM_DOMAIN made selfhost:deploy publish with the .env value while
docker compose ran celld and Caddy with the shell's.

loadBoxEnv now collects the variables referenced in docker-compose.yml and every file the box's
COMPOSE_FILE selects (composeFilesFor, moved to compose-env.ts so box-settings can reuse it
without an import cycle), and applies a differing shell value for each, plus every box port.
Each override is reported by name only. withComposePortOverrides is renamed
withComposeShellOverrides; README and .env.example describe the general rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): refuse a bare port for SAM_MX_LISTEN

SAM_MX_LISTEN=2525 passed both the deploy's and Caddy start.sh's checks, but sam-mx hands it to
Go's net.Listen("tcp", "2525"), which fails with "missing port in address", so the inbound-mail
service restart-looped. Both validators now require a listen address with a host/port separator,
[host]:port (:2525, 0.0.0.0:2525, [::]:2525), and refuse a bare port with a clear message. The
live Caddy harness passes `:<port>` for listen addresses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(selfhost): verify Caddy's certificate in the live suite (Sonar S4830, S5527)

httpsGet turned TLS verification off (rejectUnauthorized: false). The live harness now reads the
root of the Caddy container's internal CA (/data/caddy/pki/authorities/local/root.crt) once
Caddy starts, and httpsGet trusts exactly that root with `ca` and checks the certificate against
the request's host (servername, lowercased), so certificate and hostname checks stay on. Every
request's Host is inside the *.SAM_DOMAIN wildcard Caddy serves, so no test needed a mismatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci(selfhost-live): install dependencies without lifecycle scripts (Sonar S6505)

Nothing in the job needs one: celld runs esbuild's own bin entry (resolveEsbuild), which finds
the platform package without esbuild's postinstall, and the build and live tests pass after a
fresh `pnpm install --frozen-lockfile --ignore-scripts`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): run the Caddy image as a non-root user (Sonar S6471)

The image now ends with USER 7101:7101. setcap gives /usr/bin/caddy cap_net_bind_service, so the
unprivileged process still binds 80/443 with NET_BIND_SERVICE as the one capability compose
leaves it (checked: uid 7101, CapEff 0x400, listening on :80 and :443 with --cap-drop ALL
--cap-add NET_BIND_SERVICE). /data and /config belong to 7101 in the image.

A box upgraded from a root Caddy has root-owned 0700 files in caddy-data and caddy-config, which
uid 7101 could not read. A one-shot caddy-volumes service (root with only CHOWN and
DAC_READ_SEARCH, no network, no-new-privileges) chowns both volumes to 7101 before every Caddy
start; Caddy depends on it completing. DAC_READ_SEARCH is needed for the second and later runs
(without it chown cannot walk 7101-owned 0700 directories).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(selfhost): clear Sonar code smells in the box scripts

- S131: every `case` in caddy/start.sh and gcp-bootstrap.sh has a default arm.
- S7688: gcp-bootstrap.sh is a bash script, so its tests use [[ ]].
- S7776: INHERITED_ENV (live harness) and UNPRIVILEGED_LISTENERS are Sets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(selfhost): read the non-root Caddy's environment as a privileged reader

Caddy now runs as uid 7101 from a binary with a file capability, which makes the process
non-dumpable: its /proc/1/environ is readable only by root with CAP_SYS_PTRACE, so the
password-hash check reads it with `docker exec --privileged --user 0`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(selfhost): README and gcp-bootstrap messages from the fresh BOX install

A fresh install from the README (box round R18) found:
- pnpm install needs a C/C++ toolchain (better-sqlite3);
- step 3 writes .state/secrets.env before .state exists;
- the first minutes after adding the GCP credential look broken (IAM propagation:
  impersonation 403s, migration-pending, possibly an hour of 'Price unavailable');
- an API-created node defaults to a Hetzner location;
- without a GitHub App or GitLab no project, so no agent session, can be created;
- gcp-bootstrap's expected first IAM-binding failure printed no retry notice, and its
  shared-pool refusal named the wrong cause for a second provider trusting the same issuer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(selfhost): build steps share the box's egress; task file records BOX R18 and owed proofs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(tasks): format L22 task file

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): GCP bootstrap trusts platform tokens only; refuse disabled pools

Security re-review after #2905 (MEDIUM): the bootstrap provider admitted
every token of this install's issuer, with a pool/* binding. A user who
claimed the pool in SAM before the operator saved the platform credential
could still reach the node service account.

- Provider condition adds assertion.user_id.startsWith('platform:'). SAM
  signs platform:<userId> only for the installation's own credential
  (gcpIdentityTokenUserId). Re-running narrows a provider made by an
  earlier version (update-oidc).
- Refuse a disabled pool or provider (state stays ACTIVE when disabled,
  and neither exchanges tokens) with the enable command (Codex review).
- README and the binding comment describe #2905's guard instead of the
  stale "known gap".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): Codex review round on L22c (overlays, state dir, profiles, GCP reuse)

- Upgrade: merge build sections across every compose file COMPOSE_FILE
  selects (tracked overlays read at both refs, untracked ones from disk),
  so an overlay's build change triggers the explicit rebuild.
- Upgrade: when --state-dir (or a .env outside deploy/selfhost) puts state
  where compose would not look, pass SAM_SELFHOST_STATE_DIR (absolute) to
  every compose command it runs and prints.
- Box env: compose control variables (COMPOSE_FILE, COMPOSE_PATH_SEPARATOR,
  COMPOSE_PROFILES) take the shell value first, as compose does, so the
  mail-collector/inbound-mail settings match the profiles compose starts.
- GCP bootstrap: refuse a disabled service account; set a reused
  provider's audience back with its condition.

Each guard was removed once and its test went red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): refuse SAM_MX_LISTEN with an unbracketed IPv6 host

Go's net.Listen refuses `::2525` ("too many colons in address"), so the
inbound-mail service would restart-loop. Deploy (box-settings) and
Caddy's start.sh now require a host free of ':' or a bracketed IPv6 host.
Codex review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): COMPOSE_PROFILES=* enables the mail profiles

Docker compose reads `*` as every profile, so the collector and sam-mx
start; mailCollectorEnabled and inboundMailEnabled now agree, so the
deploy configures the Worker for the services that actually run.
Codex review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): refuse stale pool bindings; list-form build args; README compose cwd

Codex review on 3e3ef8d:
- GCP bootstrap (P1): add-iam-policy-binding only adds a member, so a
  node account reused after a --pool-id change stayed impersonable through
  the old pool. Refuse while any other member holds workloadIdentityUser,
  with the remove-iam-policy-binding command.
- imageRebuilds: normalise list-form build args to a mapping before the
  merge by name, so a base-only arg change still rebuilds.
- README fresh install: run compose from deploy/selfhost so .env's
  COMPOSE_FILE overlays apply (a -f replaces them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): port bounds in Caddy's start guard; repo-root build context

Codex review on 5396252:
- caddy/start.sh: a compose run from another shell can override a port
  the deploy never saw; refuse values outside 1-65535 (1024 minimum for
  the services with no capability), as box-settings does.
- imageRebuilds: an overlay build context at the repository root (`../..`)
  normalised to '.', so no changed path matched; count every non-README
  file there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(tasks): L22c gates done; agent session proven on #2906 + #2907

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): refuse stray impersonators before granting node roles

Codex P1 on a42fdbb: the workloadIdentityUser scan ran after the
project role grants, so a reused service account with an unrelated
impersonator gained Compute Instance Admin and Security Admin before the
script refused. The scan now runs before any grant; the rotation test
asserts that neither the impersonation binding nor a project role is
granted before the refusal (red with the old order).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): fail-closed service-account policy check in gcp-bootstrap

Security re-check (MEDIUM-1, LOW-1/2/3) and Codex P1 on e140443:
- Read the node account's IAM policy as JSON and parse it strictly (node):
  refuse output that is not a policy, any conditional binding, and any
  member other than this pool's workloadIdentityUser on ANY role
  (serviceAccountTokenCreator, serviceAccountUser, ...). A filter that
  silently matched nothing could otherwise let the grants through.
- Key the check on the first existence probe instead of a second one
  that a transient error could skip; a just-created account is skipped.
- Drop bash-4-only ${x,,}; sanitise the member printed in the remedy.
Each guard deleted once turns its test red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): refuse a reused node account with user-managed keys

Codex P1 on 3f3c953: a user-managed key authenticates as the service
account with no IAM binding, so the policy scan could not see who holds
one, and the script then granted Compute Instance Admin and Security
Admin. Before any grant, list the account's user-managed keys
(--format=json, parsed strictly) and refuse any key or unparseable
output; nodes use workload identity only. Each guard deleted once turns
its test red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(tasks): L22c merges now on Raphaël's decision; agent-session proof moves to H2

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>
Bumps [github.com/compose-spec/compose-go/v2](https://github.com/compose-spec/compose-go) from 2.16.2 to 2.17.0.
- [Release notes](https://github.com/compose-spec/compose-go/releases)
- [Commits](compose-spec/compose-go@v2.16.2...v2.17.0)

---
updated-dependencies:
- dependency-name: github.com/compose-spec/compose-go/v2
  dependency-version: 2.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [isomorphic-git](https://github.com/isomorphic-git/isomorphic-git) from 1.44.12 to 1.44.15.
- [Release notes](https://github.com/isomorphic-git/isomorphic-git/releases)
- [Commits](isomorphic-git/isomorphic-git@v1.44.12...v1.44.15)

---
updated-dependencies:
- dependency-name: isomorphic-git
  dependency-version: 1.44.15
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
simple-agent-manager Bot and others added 14 commits November 20, 2026 16:44
…ckoff (#2937)

* fix(api): retire never-requested node rows and honour cleanup failure backoff

Node rows whose provisioning stopped before any provider create keep the
insert-time absence proof (proof = created_at, transport NULL). Strict
teardown refused them for lacking a managed placement fingerprint, so the
cleanup sweep failed on them forever. Name that state and accept its proof.

A failed cleanup attempt now waits its full failure backoff instead of the
5-minute refusal re-check (or zero past the stranded deadline). Uncertain
providerless error rows are parked in destroying, and the non-Hetzner
reconcile refusal is a named teardown_allocation_unresolved.

Idea 01M7GVRC956Q8JMGCRP1PQ4R5B.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(rules): a refusal cadence must not replace a failed attempt's backoff

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(api): keep failure backoff across the stranded sweep; review fixes

The stranded sweep's provenance re-check rewrote a failed attempt's backoff to
5 minutes in the same tick, so a parked row past its deadline was attempted on
every tick. The re-check now only moves the retry later.

Review fixes: the refusal diagnosis no longer reports provenance for a
never-requested placeholder; parking requires node_role = 'workspace'; tests
for the past-deadline cadence and operator anomaly, the provisionNode claim
invariant, and the diagnosis exemption.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: archive never-requested node cleanup task

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(api): pass resolved cleanup deadlines to max-lifetime and sibling phases

A providerless error row parked by a failed max-lifetime attempt computed its
retry against the 30-minute default instead of the admin-configured
operations.nodeCleanupBlockedRetirementMs (Codex review).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: backlog absence proof for post-claim pre-create provisioning failures

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: scope never-requested retirement to failures before the identity claim

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): journal post on the glass outline that scrolled away

SAM's daily journal entry on #2943: a pane's rim and frost are
absolutely positioned pseudo-elements, so a pane that is its own scroll
container carries them away with its content. Covers the frame and
scroller fix, the computed-style Playwright guard, and the one-row
inbox header from #2942. Includes before/after renders of the real
Inbox with mock data in both themes and the 1200x675 X card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(www): correct outline post details from accuracy review

Fix the min-h-0 explanation (a scroll container's automatic minimum is
already 0), say the guard runs in both themes only in the chat audit,
note the fix also added a wrapper div, mark simplified excerpts, gloss
scroll container, containing block and computed style, and correct the
header paragraph (same page, not same pane).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(www): name both simplifications in the Inbox excerpt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(www): drop the viewport claim for the scrolling-pane guard

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: inbox replies web UI

* feat(web): reply to inbox items from a conversation view with the chat composer

The inbox item reads as a conversation: the ask is the agent's first message,
then the person's replies and the agent's responses in time order, with the
answer controls on the newest agent turn. The project chat composer (with
attachments) is pinned under the item and posts to the reply route; the old
one-shot Reply and free-text answer paths are removed. Rows show who replied
and when the agent responded; Archived marks items with the agent; the chat
shows a Re: chip on inbox replies that opens the item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(web): inbox replies visual audit; polish reply times, names and with-agent state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(web): visual audit for the inbox reply chip in the project chat

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(web): sort query-option exports

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): address review on inbox replies

- Open an item the agent responded on at its latest response; announce a new
  response that arrives while it is open
- Refresh the open item from inbox notifications, and re-read it every 30s
  (configurable, paused when hidden) while the reply is with the agent
- Keep a closed item opened by link (a Re: chip) instead of closing it as stale
- Strip only the appended Attached Files section from a reply
- Decline notice shows once there is a draft; meta before the controls, which
  are a labelled group; 'Show more' keeps focus; 44px solid Re: chip
- Light-theme and wide code block coverage in the visual audit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): show a person's comment in an agent response thread as theirs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): order thread follow-ups by time and read later responses first

Follow-ups in an agent response thread are turns of their own, placed by
their own time; the controls follow the newest agent turn. When the first
page has later responses, they are read straight away (bounded,
VITE_INBOX_RESPONSE_AUTO_PAGES) so the controls and the opening scroll land
on the newest response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: archive inbox replies web UI

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>
Bumps [@hono/valibot-validator](https://github.com/honojs/middleware/tree/HEAD/packages/valibot-validator) from 0.6.1 to 0.6.2.
- [Release notes](https://github.com/honojs/middleware/releases)
- [Changelog](https://github.com/honojs/middleware/blob/main/packages/valibot-validator/CHANGELOG.md)
- [Commits](https://github.com/honojs/middleware/commits/@hono/valibot-validator@0.6.2/packages/valibot-validator)

---
updated-dependencies:
- dependency-name: "@hono/valibot-validator"
  dependency-version: 0.6.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 7.0.0 to 7.1.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@b7ad1da...d8cbb80)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat(web): open Library references in a preview over the current screen

Clicking a reference to a Library file (inbox link chips, idea Related rows,
the Comments page, workflow step outputs, markdown links in chat and inbox)
now opens the Library's own viewer over the page instead of navigating to the
Library. The open preview lives in history state at the same URL, so x, Escape
and a phone's Back close it and the page underneath never remounts. Desktop
shows the viewer as a glass overlay over a scrim; phones keep it full screen.
The viewer gains an Open in Library action.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(web): audit Library previews opened from the inbox; wrap long names; docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): address review of in-place Library previews

- Reuse useDialogFocusTrap in the viewer (recaptures stray focus; only the topmost viewer listens)
- Escape closes the comments panel first and never discards typed text
- Phone header: name and Close on the first row, controls on a second
- Size the rendered/source segments to their labels; useId for the title
- Audit: scroll position and typed answer survive, glass-live overlay, light theme

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(web): load the Library viewer only when a preview opens

The app-level preview provider sits in the protected layout, so a static import
pulled the viewer (markdown, media, comments) into every cold load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): route the chat Related drawer through the in-place preview; review fixes

- Related drawer file rows open through the history-backed provider, so a
  phone's Back closes the file and keeps the chat and panel (CodeRabbit)
- Provider keeps the original opener for a whole preview session and returns
  focus to it when a replaced preview closes (CodeRabbit)
- Markdown links resolve relative hrefs against the page URL (CodeRabbit)
- Audit asserts overflow on the markdown viewer (CodeRabbit)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): Open in Library keeps the comment thread the preview was opened on

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): record the preview opener at the start of every session

A preview opened from inside the Library page's own viewer now returns focus
there after a replaced preview closes (Codex review).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(web): Related drawer file rows are Library links that open in place

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): keep the Library preview's inner scroller after rebasing onto #2943

#2943 moved the preview pane's scrolling onto an inner div so the glass
rim and frost stay put. The rebase took this branch's version of
FilePreviewModal, so re-apply that structure, and run
assertNoScrollingGlassPanes in the in-place preview audit so the overlay
presentation is covered too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(web): type the half-written reply in the inbox reply composer

#2953 replaced "Type a different answer" with the chat composer, so the
page-underneath audit now types into "Reply to the agent".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(tasks): archive the in-place Library preview 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(deps): bump mermaid from 11.14.0 to 12.3.0

Bumps [mermaid](https://github.com/mermaid-js/mermaid) from 11.14.0 to 12.3.0.
- [Release notes](https://github.com/mermaid-js/mermaid/releases)
- [Commits](https://github.com/mermaid-js/mermaid/compare/mermaid@11.14.0...mermaid@12.3.0)

---
updated-dependencies:
- dependency-name: mermaid
  dependency-version: 12.3.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix(mermaid): keep classic dagre rendering and lazy docs bundle on Mermaid 12

Mermaid 12.2 centres mindmap labels itself, so drop our duplicate
text-anchor that shifted the root label 36px. Pin look: classic and
layout: dagre so v12's neo/ELK defaults do not restyle diagrams or fetch
the ELK chunk. Load Mermaid on docs pages only when a diagram exists and
code-split the marketing bundles so ELK stays a lazy chunk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mermaid): address review: text fallback, accurate security doc, single DOMPurify

Render a failed docs diagram's source as text rather than HTML, state
that the sanitizer (not Mermaid) is what strips foreignObject output,
align DOMPurify with the 3.4.18 Mermaid now resolves, and file the
pre-existing docs issues found while reviewing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

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>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Bumps [esbuild](https://github.com/evanw/esbuild) from 0.28.1 to 0.28.2.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](evanw/esbuild@v0.28.1...v0.28.2)

---
updated-dependencies:
- dependency-name: esbuild
  dependency-version: 0.28.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix(deps): bump typescript-eslint from 8.72.0 to 8.73.0

Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.72.0 to 8.73.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.73.0/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-version: 8.73.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix(deps): align TypeScript ESLint parser and plugin at 8.73

---------

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>
…#2954)

* feat(incidents): watching disposition with spike escalation and quiet expiry

Triage can set a claimed incident to watching (resolve_incident outcome
"watching"). Recurrences then only record exact new occurrences into hourly
buckets and refresh the signature's idea; a spike re-queues it with a reason;
a quiet period expires it. list_incident_queue/get_incident return frequency
fields and sort by frequency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(incidents): watching recurrence, spike, quiet expiry and read-surface coverage; docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(incidents): isolate watched recurrences, cap them per run, baseline from watch start

Review fixes: one failing watched signature can no longer abort the hourly
run; recordings are capped (operations.incidentWatchMaxRecordsPerRun) and idea
refreshes bounded by the group limit; the spike baseline covers the hours since
watching began; the normal-path update skips watching rows; user reports cannot
be watched. Tests for the CAS race, isolation, engaged/missing ideas, settings
overrides and fallback, expiry round trip and the watch claim fence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: archive incident triage watching disposition task

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: backlog staging debug-agent model 410

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(incidents): count watched errors once by id; never drop or expire unrecorded recurrences

CodeRabbit/Codex review fixes:
- dedupe watched recurrences by platform error id (migration 0265) instead of a
  last_seen_at watermark, so late-committed and same-millisecond errors count once
- record every watched signature in the window (drop the per-run record cap);
  idea refreshes stay capped by the group limit
- quiet expiry skips watched signatures whose recording failed this run
- the ordinary update skips watching rows and re-routes a row watched mid-run
- reject a watch reason that sanitizes to nothing
- SQL frequency ranking uses the parser's bucket rules
- list_incident_queue discloses truncation (hasMore)
- template: a person's report cannot be watched

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(incidents): count a burst in the watch decision's own hour toward a spike

Staging showed 55 occurrences right after a watch decision never escalating:
the spike skipped the decision's hour bucket entirely. The hour now counts,
minus the occurrences it already held at the decision (migration 0266,
watch_spike_offset), so a burst triage already saw still does not re-queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(incidents): no quiet expiry on a full error window; refresh budget counts attempts

Codex review: a noisy signature filling the newest-first error window could hide
a watched signature's recurrence and let it quiet-expire, so expiry skips a
truncated window. The idea-refresh cap now counts every attempt, including
engaged or refused ideas.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(incidents): retry a lost watched-record race; prorate the spike window boundary

Codex review: a run that lost the compare-and-set dropped its unique
occurrences; it now re-reads and merges (bounded to 3 attempts). The spike
window's boundary hour bucket counted in proportion to its overlap instead of
being dropped, with the same rule for the baseline; a decision inside the
window still counts exactly from its hour minus the offset.

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>
…otate) (#2952)

* feat(selfhost): platform-key rotation for sealed boxes (selfhost:secrets rotate)

Ports pnpm selfhost:secrets rotate from sam/selfhost-pass-2 onto main: the CLI
(scripts/selfhost/rotate-*.ts, adapted to main's async bundle store), the
Worker passes and HMAC-authenticated control endpoint (selfhost/key-rotation/),
read fallbacks in encryption.ts / file-encryption.ts, the JWT previous-key
overlap (jwt.ts split into jwt-keys.ts / jwt-verify.ts), BetterAuth versioned
secrets and TOKEN_HASH_KEY.

Every rotation variable is honoured only inside a self-host rotation scope
that the celld wrapper alone turns on (registerRotationKeys), so a Cloudflare
Worker with any *_PREVIOUS, JWT_KEY_ID or BETTER_AUTH_SECRET_VERSION set
behaves exactly as before (rotation-scope-cloudflare.test.ts, each gate proven
discriminating). gcp_wif_pool_index.iv is an index marker, not ciphertext.
plaintext-scan rotationAdvice and the README now point at rotate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(selfhost): plaintext listing advice names rotate

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(api): a broken JWT_PUBLIC_KEY stays a server fault after the jwt split

verifyPlatformJwt imported the current key inside its callers' try, so a
misconfigured key became a 401 (publish-job) instead of the 500 main gave.
Also moves the terminal-token docblock back above verifyTerminalToken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test/docs: JWT verification lives in jwt-verify.ts after the split

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): rotate takes --encryption-key-file for its first backup

Main's backups are always encrypted; the ported rotate called runBackup with no
key and stopped at its first step on a real box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(api): TOKEN_HASH_KEY is honoured only inside the self-host rotation scope

A Cloudflare Worker with TOKEN_HASH_KEY set would have rehashed every bearer
token lookup; now it ignores the var like every other rotation variable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: archive self-host key rotation landing slice

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* task: record verification state for the rotation landing slice

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): rotation resumes never skip a JWT overlap check or a verify round

Codex review on #2952:
- P1: a run stopped after the JWT overlap deployed but before its deadline was
  recorded read the missing deadline as past and retired the old key unverified.
  Resume now re-checks the JWKS and records the deadline from the bundle first.
- P2: a run stopped mid-verify resumed at the next round; in the last round that
  verified nothing and rolled back a finished migration. Resume now finishes the
  recorded round's verify pass.
Both regressions proven red without their fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(selfhost): live rotation test uses main's key-agent socket channel

The ported live test still configured the pre-F9 HTTP agent URL and a root
agent; it now runs the agent as compose does (non-root, no capabilities) and
the probe through runtime-secrets-socket.ts. Passes locally on Docker + celld.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): rotation resumes keep the run's timing options; state files written atomically

Codex review on #2952:
- P1: --jwt-overlap-hours / --stored-lifetime-minutes are recorded in the
  journal and every resume uses them; a resume passing another value is
  refused. Regression proven red with the recorded options ignored.
- P1: the journal, its archive, the sealed snapshots and gateway.env go through
  replacePrivateFile (temp file, fsync, rename, directory fsync), so a stop
  mid-write leaves the old or the new file whole.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): gateway rotation counts only HTTP 200 as acceptance

Codex P2 on #2952: a 5xx from the authenticated frps-plugin path passed as
'accepted'. The probe now requires 200 or 401 and fails (rolling the key back)
on anything else. Regression proven red with the old check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): resident objects refresh the rotation fallback; JWT overlap follows the deployed token lifetime

Codex review on #2952:
- P1: a Durable Object that outlived a bundle change kept the fallback map of its
  constructor's bundle. Every runtime-secrets load (background refreshes
  included) now re-registers it. Regression red before the fix.
- P1: the 13 h JWT overlap assumed a 24 h callback token renewed at half life.
  The default is now 90% of the deployed CALLBACK_TOKEN_EXPIRY_MS (the latest
  renewal ratio a VM agent accepts) plus 1 h: 23 h by default, 45 h for a 48 h
  token. --jwt-overlap-hours still overrides it, 0 still a hard cut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): retirements drain the previous version's requests; refuse a root rotation that leaves an equal purpose key

Codex review on #2952:
- P1: a request that started on the previous deployment finishes there (celld)
  and can write under the old value after a zero-wait retirement. Every
  retirement now waits at least CELLD_HANDLER_BUDGET_S (default 300 s) plus
  1 min; short waits are waited out in the run.
- P1: rotate encryption-key alone refuses while CREDENTIAL_ENCRYPTION_KEY or
  LIBRARY_ENCRYPTION_KEY holds the same value (the old key would stay in use).
- P2 (archive-search cursors signed with ENCRYPTION_KEY restart once):
  documented in the plan and README; fix deferred to idea 01M7X4Y58JAXTGYXCDKC4Q5MM9
  because it touches the shared Cloudflare path.
Guards proven red without their fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): a resume never reports success for a rolled-back key; equal-value guard covers every AES key

Codex review on #2952:
- P1: a resume after an earlier rollback closed the run with exit 0. It still
  reseals and archives, but now fails listing the keys that were not replaced.
- P1: the equal-value guard compared only the root key; it now refuses any
  selected AES key whose value an unselected one also holds.
Both proven red without the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): a rollback drains from its reverse deployment

Codex P1 on #2952: the rollback's drain was anchored to the forward switch,
so a forward migration that outlasted the drain retired the new value at
once. The reverse deployment time is recorded and the drain starts there.
Proven red with the old anchor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): encryption-key retirements wait the drain plus the value lifetime, rollbacks included

Codex P1 on #2952: a write to KV or a Durable Object made during the drain
lives for the stored-value lifetime after it, and a rollback skipped that
wait altogether. Both directions now wait drain + lifetime (BetterAuth,
D1-only, keeps the drain). Proven red with the old max().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): a BetterAuth rollback restores the old secret under its original version

Codex P1 on #2952: rolling back a second or later rotation re-labelled the old
secret with a new version, leaving tokens still enveloped as $ba$<original>$
without a key; the reverse migration could not be proven. The snapshot's
version is restored (an unversioned original still gets a new one). Proven red
before the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): stale rotation-lock takeover is exclusive

Codex P2 on #2952: two runs that both saw a stale lock could each remove it
(and the other's new lock). Takeover now happens under an O_EXCL takeover
file and removes the lock only if it still holds the stale content.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): count reverse-tunnel leases committed during the drain as old-key leases

Codex P1 on #2952: a lease request that started on the previous deployment can
commit after the switch with a credential derived from the old key; the report
cut off at the switch missed it. The cutoff is now switch + drain (errs toward
a needless replacement, never a missed one). Proven red with the old cutoff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): a rotation resume keeps the request drain the run started with

Codex P1 on #2952: a resume recomputed the drain from the current box env, so
lowering CELLD_HANDLER_BUDGET_S mid-rotation could retire a value before old
requests drained. The drain is recorded in the journal with the other timing
options. Proven red without the record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): a root-key rotation with every role overridden is expiry-only, not stuck

Codex P1 on #2952: with CREDENTIAL_ENCRYPTION_KEY and LIBRARY_ENCRYPTION_KEY
both set to their own values, no stored role rotates with ENCRYPTION_KEY, and
the 'not deployed' guard stopped every resume. The control status now reports
the deployed *_PREVIOUS names; with one deployed the rotation has no row
locations and finishes after the value-lifetime wait. Proven red before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): a resumed JWT overlap counts its deadline from the resume, not the seal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): the stored-value wait covers a URL interaction's deadline margin

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): a gateway rollback survives a failed consumer restart; the stored-value floor counts the URL deadline margin

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(selfhost): a resumed gateway rollback always restarts the consumers; a failure before the snapshot stays resumable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(selfhost): the live rotation test records the request drain instead of sleeping it out

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>
L22a #2901, L22b #2902, L22c #2906: celld build and deploy core, box
runtime. Landed code takes main's version; the unlanded branch remainder
is re-attached after the last stage. Conflict table in the PR body.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
L23 #2917: egress fence and metadata token proxy. Main's version of
every fence and metadata-proxy file; the branch's Caddy-based metadata
proxy config (deploy/selfhost/metadata-proxy/Caddyfile) is superseded
by main's Node broker and removed. L23 landed before H2 on main, so it
is merged first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
H2 #2907: self-host-only SAM-hosted git. Main moved hosted git under
apps/api/src/selfhost/hosted-git/ behind the artifacts seam; the
branch's old-location modules are removed (services/hosted-git/* that
git mapped onto services/artifacts/*, durable-objects/hosted-git-*,
routes/projects/hosted-git-token.ts, app.ts) along with its separate
CI job (main runs the suite in API unit shard 1). The branch's public
repository importer is dropped: main refuses importUrl until a bounded
importer exists (tasks/backlog/2026-11-19-bounded-selfhost-git-import.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…M6 step 4)

L24 #2918 (4a40c52): backup, restore, upgrade rollback, exact-ownership
teardown; #2932 legacy compose adoption; #2934 restore keeps fence rules
readable. Main's version of every operations file. The branch's earlier
drafts that main's modules no longer export into are removed:
deploy/selfhost/gcp-teardown.sh (main: teardown-gcp*.ts),
adopt-check.test.ts, teardown-gcp-constants.test.ts,
live/teardown-bucket.live.test.ts, testdata/fake-docker-teardown.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codspeed

codspeed Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing sam/m6-merge-current-main-1zv8h6 (6aacfcc) with main (64b9d2c)2

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩

  2. No successful run was found on sam/selfhost-pass-2 (2f61cea) during the generation of this report, so main (64b9d2c) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

raphaeltm and others added 5 commits November 20, 2026 23:25
…ep 5)

#2933: sealed Worker secrets on by default (F9 socket channel, F10
non-root agent). Main's version of runtime-secrets, the key agent and
the secrets CLI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n (M6 step 6)

#2952: platform-key rotation for sealed boxes. Main's version of every
rotation file and of the shared crypto and auth files (encryption.ts,
file-encryption.ts, jwt.ts, jwt-keys.ts, lib/secrets.ts,
lib/better-auth-secrets.ts): byte-identical to main. env.ts takes main's
rotation declarations; the branch's REVERSE_TUNNEL_* copies leave the
shared Env (main types them in selfhost/reverse-tunnel/config.ts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- repo-hosting ports: keep the branch's unlanded GitLab allowPrivateNetwork
  field; the localRemoteFetch hook is superseded by main's artifacts seam.
- projects router and CreateProjectSchema: main's (hosted git token route
  is mounted by selfhost/hosted-git; importUrl declared once).
- platform-capabilities: Artifacts availability from services/artifacts/backend.
- Task file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… dead shims)

- dependabot: drop the branch's second caddy/egress-fence/key-agent entries;
  only the unlanded docker-proxy entry remains beside main's.
- gitleaks baseline: drop the branch K1 AWS group (same digests as main's
  sealed-secrets group: "duplicate entry") and the intermediate-range K1
  group (its commits are in the base, not this PR). Current-tree scan passes.
- type-boundary baseline: main's formatting; local-record-guard 1 kept
  (unlanded docker-proxy shapes.ts).
- guided login (unwired): main moved celld to uid 7103; the docker proxy
  default moves to 7104 and its celld gid follows main.
- ci.yml: api-unit filter keeps deploy/selfhost/** for the branch-only
  node-transport-config test that reads the box's frps and Caddy files.
- Remove dead apps/api/src/lib/network-hosts shim (main imports worker-core),
  and two branch tests that no longer compile against main's landed modules
  (secrets-migrate.test.ts, live/plaintext-purge.live.test.ts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both test code main still exports (celld-adopt.ts adoptAndCheck;
teardown-gcp.ts firewall rule names, whose comment cites this test as the
pin to packages/providers' values). They were removed in step 4 by
mistake; both pass against main's modules. (task-completion-validator)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simple-agent-manager simple-agent-manager Bot added the coderabbit-review Trigger CodeRabbit review for opt-in PRs label Nov 20, 2026
@raphaeltm

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Action not completed

Review skipped: 898 files exceed the limit of 100.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…d branch tests

CI 44839559555 failed 10 API unit tests:
- main's node-cleanup-never-requested-placeholder test pins GCP providerless
  teardown to a named operator refusal with no provider traffic (#2900, idea
  01M7GVRC956Q8JMGCRP1PQ4R5B). The branch's COMPLETE_INVENTORY_PROVIDERS
  (gcp) contradicts that landed decision: strict-node files are back to main,
  and the branch-only node-cleanup-gcp-providerless.test.ts is removed.
  Stuck GCP nodes leave through #2900's operator removal.
- deployment-sticky-placement (main): its fixture now has CF_API_TOKEN /
  CF_ZONE_ID, as every Cloudflare install does, so the re-attached
  appDeployments capability gate admits provisioning.
- node-transport-config.test.ts (branch): asserted the branch's pre-L22
  box-settings exports; main covers frps/Caddy in scripts/selfhost tests.
  Removed, and ci.yml is main's again (its api-unit filter addition existed
  only for this test).
- selfhost-guided-login-gates.test.ts (branch): exercises guided-login wiring
  that is deliberately absent (coordinator decision); recorded on idea
  01M7XMTJAQG7P9R6FGQGY47R6C for the re-port.

Local: apps/api vitest 1228 files, 18849 passed, 5 skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@simple-agent-manager
simple-agent-manager Bot marked this pull request as ready for review November 21, 2026 00:48
@simple-agent-manager
simple-agent-manager Bot merged commit 77fbfd9 into sam/selfhost-pass-2 Nov 21, 2026
38 of 39 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T00:49:48.779965Z 6aacfcc Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coderabbit-review Trigger CodeRabbit review for opt-in PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant