Skip to content

M3: merge main into selfhost integration - #2817

Merged
simple-agent-manager[bot] merged 77 commits into
sam/selfhost-pass-2from
sam/m3-merge-current-main-bgbh6j
Nov 16, 2026
Merged

simple-agent-manager[bot] merged 77 commits into
sam/selfhost-pass-2from
sam/m3-merge-current-main-bgbh6j

Conversation

@simple-agent-manager

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

Copy link
Copy Markdown
Contributor

Summary

M3 merges main 726605541f01cbf8ca9e20f14bddf5f0e25115c6 into integration 9286831418dadd5db12ad68a36ffd3d44446beaf (after #2764). Real merge, PR base sam/selfhost-pass-2, no rebase/cherry-picks. Do not merge: coordinator task 01M7JMXS2JRW6QQMB1356ENPM3 reviews and merges. Model: M2 #2758, M1 #2736.

  • Merge commit 6c7d5deb0687b3034d74da3f6d8e4e84298fb025
  • Rule: code that landed on main takes main's version; the branch keeps only what has not landed.
  • Main brings L5a guard/lint rule, ComposeBuilderContainer v23, Inbox/question-asks, Insights, staging leases and agent-context split.
  • Landing progress (git diff --shortstat origin/main...<head>):
    • Before: 872 files, +87507 / -2379.
    • After merge commit: 854 files, +84431 / -2112.
    • Final reviewed head 0a4a5444f23de754cdbd7dd1d7978444f230109f: 855 files, +84286 / -2124 (includes CI routing/gate compatibility and task evidence).

Conflict table

File Main change / branch change Resolution
.github/workflows/ci.yml Aggregate gate / hosted git job Both; hosted-git added to aggregate dependencies, draft skip and self-host path filters
apps/api/src/lib/web-push.ts Overlapping L5a implementation Main's implementation
apps/api/src/routes/ai-proxy-passthrough-upstream.ts Overlapping L5a implementation Main's implementation
apps/api/src/routes/mcp/check-dns-status.ts Overlapping L5a implementation Main's implementation
apps/api/src/services/admin-settings-outbound-definitions.ts Main fail-closed redirect resolution / branch callers Main defaults/bounds/fallback, helper export and branch private GitLab setting
apps/api/src/services/admin-settings-registry.ts New exports/settings / branch-only exports/settings Union, no duplicate setting
apps/api/src/services/agent-sign-in/verify.ts Overlapping L5a implementation Main's implementation
apps/api/src/services/build-context-upload.ts New download / operator-store signing adapter Upload and download bind shared presign target
apps/api/src/services/jwt.ts New publish-job scope / extracted rotation verifier New scope in jwt-verify.ts, current key only; branch callback overlap retained
apps/api/src/services/outbound-fetch-settings.ts Main fail-closed redirect resolution / branch callers Main defaults/bounds/fallback, helper export and branch private GitLab setting
apps/api/tests/unit/lib/guarded-fetch-redirect-policy.test.ts Independent additions Union; main behavior retained
apps/api/tests/unit/lib/network-hosts.test.ts Overlapping L5a implementation Main's implementation
apps/api/tests/unit/routes/composable-credentials.test.ts Overlapping L5a implementation Main's implementation
apps/api/tests/unit/routes/deployment-environment-observability.test.ts Independent additions Union; main behavior retained
apps/api/tests/unit/routes/deployment-membership-auth.test.ts Independent additions Union; main behavior retained
apps/api/tests/unit/routes/mcp-check-dns-status.test.ts Overlapping L5a implementation Main's implementation
apps/web/src/lib/query-stale-times.ts Insights / platform capability TTL Both settings
apps/web/src/pages/project-chat/useProjectChatState.ts Shared composer extraction / runtime availability Main extraction; branch capability query moved to shared composer
apps/www/src/content/docs/docs/architecture/security.md Atomic owner election / GitLab guarded-provider citation Main election text plus corrected branch citation
eslint.config.mjs Fetch ratchet / vendored dgit exception Both config blocks
packages/app-deployment/src/image-resolver-outbound.ts Overlapping L5a implementation Main's implementation
packages/worker-core/src/index.ts New exports/settings / branch-only exports/settings Union, no duplicate setting
packages/worker-core/src/network-hosts/classify.ts Overlapping L5a implementation Main's implementation
packages/worker-core/src/network-hosts/guarded-fetch.ts Overlapping L5a implementation Main's implementation
packages/worker-core/src/network-hosts/index.ts Overlapping L5a implementation Main's implementation
scripts/quality/runtime-tunables-baseline.json Independent additions Union; main behavior retained

Silent breakages found and fixed

Area Repair
Main build-context download New download referenced removed getS3Client and Cloudflare bucket/key; now uses branch shared operator-store target, prefix included. Worker publish spec binds adapter.
Main shared composer Extraction omitted required instantEnabled; query moved into shared composer so Overview and Chat preserve install capability and first-profile runtime.
Main publish-job JWT New verifier would duplicate branch callback/terminal implementations; moved only new scope into canonical jwt-verify, exported through jwt.ts, previous keys still denied for publish jobs. Rotation/generation regression matrix added.
Auto-merged imports Duplicate classifier/guard imports in notification-push, notifications schema and composable credentials removed; main files retained.
CI selection/gate contracts Hosted-git included in required aggregate needs and draft skip. Self-host script/config changes select API units + hosted-git without unrelated Workers jobs; local generated/scratch files excluded from tracked-input scan. Runner budgets include one existing branch conformance job.
Branch deadline consumers Main guard has no deadlineMs; branch-only adapter composes one operation signal around unchanged main guardedFetch. GitLab 504 behavior and streaming/caller-abort preserved.

Outbound fetch inventory

Deleted old regex/AST inventory test and its now-unused allowlists/analyzer. Regenerated via node packages/eslint-plugin-sam/scripts/outbound-fetch-baseline.mjs --write: 28 files,36 sites, only decreases from main; no new baseline debt.

Every branch-added global site:

Site URL chooser / handling
selfhost/runtime-secrets.ts:fetchSecrets Inline acknowledgement: installer pins validated loopback key-agent URL and signed response contract.
services/github-app-manifest.ts:completeGitHubAppManifest Inline: fixed api.github.com manifest conversion; installer supplies encoded code only.
services/hosted-git/backend.ts:artifactsRemoteFetch (global reference and fallback call) Inline at both sites: SAM creates repository remote URLs supplied by Artifacts backend; hosted remotes served in-process.
services/llm-chat-target.ts:fetchChatTarget Inline: fixed Cloudflare Workers AI target; operator LLM endpoint path guarded.
packages/agent-email/src/smtp-client.ts socket import Inline: installation operator chooses SMTP relay; existing validated SMTP config/TLS/loopback rules retained.
services/hosted-git/import.ts:cappedFetch guardedFetch with host policy, redirect bound and byte caps.
services/gitlab-login-provider.ts:fetchGitLabUserInfo Main guard through whole-operation deadline adapter, configured host opt-in.
packages/repo-hosting/src/gitlab.ts:gitlabFetch Main guard through deadline adapter; private opt-in and admin redirects.
services/speech-endpoints.ts:send Main guard through deadline adapter; private opt-in and admin redirects.
Branch AI proxy / LLM chat requests guardedFetch; no added baseline.

DO binding fetches (HostedGitRepo init/delete/info, hosted HTTP stub), in-process app.fetch and ASSETS binding fetch are service calls, not global outbound requests; lint distinguishes these.

UI Screenshot Evidence

Playwright screenshots and specialist quality review: permanent screenshot evidence.

Surface: New Chat shared composer

Surface: Project Overview shared composer

Migration audit

  • Main v23 = ComposeBuilderContainer. Hosted git remains selfhost-only selfhost-hosted-git-v1; sync-wrangler-config and selfhost generator collision checks agree.
  • No new migration-number collisions. 20 historical duplicate-prefix groups already exist in both parents and in ordering allowlist. No applied migration renumbered.
  • 0232_node_reverse_tunnel_leases.sql stays unique; observability/0002 remains unique in its separate database.
  • Fresh SQLite:270 primary migrations +3 observability; upgrade integration schema through10 new migrations passes.
  • quality:migration-safety,wrangler-bindings,migration-ordering,do-migration-safety pass; config/migration tests6 files/180 tests pass.

Checks run

  • Build:18/18 pass. Typecheck:36/36 pass.
  • Focused JWT:5 files/96 tests pass; host/redirect policy:2 files/159 tests pass.
  • Web focused:6 suites/127 tests; Playwright:19 passed,1 intentional phone-only desktop skip. Screenshots reviewed, no visual regression.
  • pnpm lint:22/22 pass (SAM outbound rule included); pnpm selfhost:test:38 files,582 pass,2 skip.
  • Full pnpm test:39/39 tasks pass; API1131 files17101 pass,4 skipped; web429 files5360 pass; project-data53 files549 pass; app-deployment14 files190 pass.
  • Conflict-related focused suites:10 files233 tests; account13,proxy22,node deletion5,classifier6,download presigner5 tests pass.
  • First full run found6 stale assertions across4 files; all repaired: readable SQLite redirect settings, sole-user superadmin election, auth mock getAuth, asks schema fixture. Full rerun proves all green.
  • CI selection/draft/quality contracts:3 files,132 tests pass; targeted ESLint passes.
  • Final exact-head CI: PASS, workflow43936073442, head 0a4a5444f23de754cdbd7dd1d7978444f230109f. All7 Workers shards, aggregate gate,3 API shards,2 web shards, packages, hosted-git, build/typecheck, lint, deploy checks, Go/VM/CLI, volume mount and workspace quality passed. SonarCloud and CodSpeed also passed.
  • quality:file-sizes passes (none above800).

Staging Verification Evidence

Explicit user exception: integration merge PR, no staging deploy and no merge to main. Coordinator granted exclusive selfhost box. Upgrade from4809b097b to6860e5e95 passed with D1 migrations,3998-object backup and6s delta-copy downtime. Worker cfb46b4551a5c5e4, sealed bundlee46cd268 unchanged,7 services running. Agent-test workload sign-in succeeds. Real end-to-end task passed: workload user xw6b9p2gmYK2gXGYvP1il7nLPAWIgRkt submitted task 01M7JV47BE61YA0GSTB2D6S573; a GCP VM provisioned, delivered heartbeat at18:52:19Z, agent received prompt at18:54:24.876Z and returned pong at18:54:28.298Z. Session fecd7a45-2814-4af4-a103-05fdae25d121 stopped, workspace/node/profile deleted; API nodes/workspaces empty and cloud inventory confirmed only sam-box. Signed out200. Temporary SSH key/user/firewall, secret-bearing backup/log and local credentials removed. Box released on feature.selfhost-landing. Subsequent PR commits change only tests, CI and task notes; application runtime source is byte-identical to deployed6860e5e95 (checked git diff over API/package sources and selfhost scripts/config).

Specialist Review Evidence

Reviewer Status Outcome
cloudflare-specialist PASS Migration/config compatibility,180 tests and fresh/upgrade SQLite
security-auditor ADDRESSED Main guard/claims retained; JWT96 + host159 tests; GitLab fixtures repaired and passing
ui-ux-specialist ADDRESSED Composer runtime input repaired;127 tests +19 browser cases; screenshots reviewed
task-completion-validator PASS Implementation checked against task/request; all local suites pass; live smoke and final-head CI passed; coordinator owns review/merge
constitution-validator PASS Config-derived deadline/expiry, main classifier, injected S3 target; no new runtime constants
doc-sync-validator PASS First-user election README matches main; security citation follows branch provider

CodeRabbit Review Evidence

Requested via coderabbit-review label at20:20:58Z after exact-head CI passed. CodeRabbit responded at20:21:18Z: Review skipped — auto reviews are disabled on this repository (response); bounded wait ended immediately per repository rule. Trusted request workflow43948843962 subsequently failed PR is not open because the coordinator merged at20:22:42Z before its queued job resolved the PR. No retry/waiver. Coordinator review and merge recorded here; integration merge commit faa02a842dacdedb476059f37eabd043ae7c128c. M3 executor did not merge.

Agent Preflight (Required)

  • Preflight completed before code changes

Classification

  • cross-component-change
  • security-sensitive-change
  • docs-sync-change
  • ui-change
  • infra-change

External References

N/A: merge of reviewed repository implementations; no new external API integration. M2 #2758 read before merge.

Codebase Impact Analysis

Canonical packages/worker-core/src/network-hosts -> apps/api/src push/credentials/sign-in/DNS, packages/repo-hosting and packages/app-deployment image resolver. Branch capability -> shared composer -> profile runtime; publish callback -> jwt-verify -> generation guard; worker publish-job spec -> shared S3 target -> operator object store.

Documentation & Specs

Merged main docs and corrected security GitLab citation. Task contains audit and acceptance criteria. No new product contract.

Constitution & Risk Check

Principles X/XI: preserve existing interfaces through small adapters, use existing settings. Migration safety: no renumbering/deletion of applied SQL; DO tags checked. Main landed versions replace duplicate branch implementations. Primary risk is silent merge compatibility, covered by targeted and broad validation.

raphaeltm and others added 30 commits November 12, 2026 11:20
Replace only clear.click() with clear.tap() after the CDP touch gesture.
Retain assertions, four viewport projects, timeouts and zero retries.

Repeated failure on281da79:
https://github.com/raphaeltm/simple-agent-manager/actions/runs/43647857485/job/132609602580
Repeated same failure on4a8e7959:
https://github.com/raphaeltm/simple-agent-manager/actions/runs/43651116541/job/132619651688

Coordinator preaccepted this exact one-line change if the new candidate
failed at the same action (events1a8d26f4 and6cf45614). Draft/final-SHA
review and all CI/staging gates remain.
…s byte-identical

ubuntu-latest moved to ubuntu-26.04 on 2026-11-14. The cgo-enabled native amd64 vm-agent build
then produced different bytes for the unchanged release ba3ba01, and
publish-vm-agent-artifacts.sh refused to overwrite the immutable artifact, failing every
staging (run 43655924997, two attempts) and production deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit b39c0a3)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit a0f07c6)
Playwright cannot install Chromium on ubuntu-26.04 ('Playwright does not support chromium on
ubuntu26.04-x64'), so the staging smoke tests failed after a successful deploy (run 43657273196)
and the CI Playwright jobs and installer deploy would fail the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 74877d4)
simple-agent-manager Bot and others added 17 commits November 16, 2026 11:34
* feat(insights): store lifecycle phase timings (slice T)

Add lifecycle_phase_timings (migration 0250). recordLifecycleTimings and
recordRunnerPhase now store one row per phase as well as logging, in one
D1 round trip, resolving task, skill and profile inside the INSERT. The
daily lifecycle latency evaluation purges rows with
lifecycleLatency.retentionDays. Shared reads phaseDurationStats and
listPhaseTimings live in packages/operations.

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

* task: archive insights slice T task file

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

* fix(insights): index-backed task lookup, off-path runner writes, isolated purges

Review fixes for slice T:
- The INSERT finds the task by primary key or idx_tasks_workspace_id
  instead of walking the project's tasks per phase row; EXPLAIN QUERY
  PLAN test.
- TaskRunner hands phase writes to ctx.waitUntil, values captured at
  call time, so telemetry never sits between a step's state writes.
- Each daily purge is isolated and reports null on failure.
- lifecycle_phase_timings joins the deploy churning-tables list.
- Plain INTEGER PRIMARY KEY (no sqlite_sequence write per insert).
- Route test: a failed store still returns 200.

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

* chore: revert unrelated formatting in task-runner files

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

* test(insights): max phase list within bind limit; clarify best-effort and window docs

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>
…odex hook config validated (#2790)

* task: add agent-tooling-self-enforcement (active)

* feat(agents): Codex hook delivers path-scoped rules on file access (experiment)

* feat(agents): Stop test-quality gate rewritten and enabled for Claude Code and Codex; Codex hook validation

* feat(agents): rule 73 becomes a blocking Go check and leaves launch context

* fix(agents): backtick wildcard scopes in the generated rule index

* docs(quality): document the Stop gate, Codex rule delivery and the rule-73 check

* chore(quality): strict index access in new agent tooling

* chore: task status, CI guard for the rule-73 step, Stop gate scope notes

* fix(agents): track .codex/hooks; --check judges hook scripts and generated files by what git can see

* fix(quality): rule-73 checker covers the variants a Go review found (opts[i], receivers, generics, load-then-modify, truthiness forms, switch, anchored opt-out)

* refactor(quality): split guard classification out of check.go (file size limit)

* fix(agents): harden both hooks (input caps, fail-open state, regular files only, validated rule paths, quoted paths) and close Stop-gate test gaps

* chore(agents): ship Codex hook-config validation only; rule-delivery hook moves to sam/codex-rule-delivery-hook (Codex sessions in SAM do not run repository hooks)

* chore(deps): Dependabot covers the go-optional-fields module

* task: archive agent-tooling-self-enforcement

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Bumps [anthropics/claude-code-action](https://github.com/anthropics/claude-code-action) from 1.0.269 to 1.0.275.
- [Release notes](https://github.com/anthropics/claude-code-action/releases)
- [Commits](anthropics/claude-code-action@61a9c27...4d75e5f)

---
updated-dependencies:
- dependency-name: anthropics/claude-code-action
  dependency-version: 1.0.275
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
…hropics/claude-code-action-1.0.275

chore(deps): bump anthropics/claude-code-action from 1.0.269 to 1.0.275
* chore(deps-dev): bump @playwright/test from 1.62.1 to 1.65.0

Bumps [@playwright/test](https://github.com/microsoft/playwright) from 1.62.1 to 1.65.0.
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](microsoft/playwright@v1.62.1...v1.65.0)

---
updated-dependencies:
- dependency-name: "@playwright/test"
  dependency-version: 1.65.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

* chore(deps-dev): align staging Playwright and keep lock update focused

---------

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>
* task: add insights run receipt (slice R)

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

* feat(insights): run receipt operation, REST route and ProjectData facts (slice R)

Adds runReceipt in packages/operations (catalog operation sam_run_receipt) and
GET /api/projects/:projectId/tasks/:taskId/receipt: phases, outcome, account,
resources, tool calls by kind, and what slowed the run down, derived at read
time from records SAM already keeps. One bounded ProjectData RPC aggregates tool
calls and agent questions in SQLite. Project scope is in every SQL predicate,
foreign and missing tasks share one not-found, and the read stays within 7 round
trips. Tokens are not_reported and CI first-try not_recorded: never estimated.

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

* feat(web): Receipt tool in the chat rail for task-backed runs (slice R)

A Receipt tool in the session tool rail opens the Run receipt as a side panel
(desktop) or a full sheet (phone): outcome, where the time went, stat tiles,
the CPU line with tool-call markers from the existing per-minute resource
rollups, and what slowed the run down. TanStack Query with stale-while-
revalidate; a live run refreshes on RUN_RECEIPT_POLL_MS, a finished one does
not. Playwright audit at 375 and 1280.

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

* docs: Run receipt in the chat tool rail guide

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

* chore: sort operations exports

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

* fix(insights): address receipt review findings

- Ask titles follow the inbox's assignee visibility; waiting time still counts.
- Index comparable-run lookups (migration 0251) and cap before the event
  lookups; EXPLAIN QUERY PLAN test at 3k tasks.
- One-pass ProjectData scan bounded by messages read; status-event times via
  julianday(); asks newest-first; date-prefix window bound.
- One task-id source for rail and drawer; disclose the question cap.
- UI: CPU loading/error states, retry feedback, accessible PR link, CPU legend,
  light theme and scrolled mobile captures; route and drawer tests.
- Split the receipt reads into insights-receipt-reads.ts.

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

* chore: renumber receipt comparison indexes to migration 0252

Slice F already uses 0251 (pull_request_heads).

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

* fix(insights): keep receipt DO scan payload-free and bound asks to the run

The materialized message window now holds only each message's kind and call
id, never its tool metadata, so memory does not grow with payload size. Asks
are read inside the run's own time window. Adds the profile-index plan test.

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

* fix(insights): address CodeRabbit review on the run receipt

- Scope the account's ACP sessions to the run's window.
- Read one ask past the cap and disclose a cut-off list; the ask cap now
  comes from insights.receiptWaitingMaxQuestions.
- When the ProjectData read fails, waiting is a disclosed floor ('waiting'
  unavailable), never an exact zero.
- A live run with an open question is measured up to now.
- Single-column stat tiles below 360px; pinned clock in the receipt tests.
- Sort apps/web api exports after the main merge.

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

* style: format receipt files

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

* fix(insights): read a zero wait as 0s in the run receipt

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

* task: archive insights run receipt

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

* test(connector): count sam_run_receipt in the Workers catalog check

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(mcp): per-policy inject mode and size budgets for get_instructions

Every policy gets an inject mode: pinned (default for every existing and new
policy, always injected in full) or on_demand (listed by title and id, full
text only when relevant to the task, inside a budget). Knowledge gets a size
budget after its ranking; a total guard trims only discretionary content and
never pinned policies. Adds Phase 0 size telemetry.

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

* feat(web): pin or unpin policies from Agent context, with session size

Policies tab gets a phone-usable Pinned / On demand control per policy and a
summary of the characters pinned policies add to every agent session, both
measured with the API's own line renderer. Refetches no longer unmount the
tab (rule 48). Adds the vertical slice through /mcp and the real ProjectData
DO, unit tests for ranking (rule 65), the knowledge budget and the total
guard, the DO migration test, docs, and the Playwright audit scenarios.

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

* fix: address local review findings for inject mode and budgets

- Clamp budget settings to their registry range; out-of-range falls back
  to the default (a min relevance of 0 would show every on-demand policy).
- Over-budget note says what is true: every pinned policy in full,
  knowledge and on-demand text keep their own budgets.
- Bounded trim passes instead of a cliff to the floor.
- DO-side injectMode guard on create and update.
- Tests for size/warn logs, budget-pass fallback, on-demand trim and floor.
- UI: honest copy for inactive/expired policies, only text dimmed,
  aria-disabled keeps focus, accepted mode survives a failed refetch,
  per-project key reset, solid selected state with a check icon.
- Refetch-identity test held mid-flight with a deferred promise.
- Docs: rollback and over-budget wording, settings row, idea title in
  relevance text; revert unrelated list renumbering.

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

* revert(mcp): keep the CI-wait guidance in get_instructions

mcp-ci-wait-guidance.test.ts requires the event types, full head SHA and
reconcile timing in both entry points. That guard predates this change and
the trim saved ~550 characters, so the paragraph stays as it was.

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

* fix(mcp): total guard sends only the required floor when that alone is over budget

Staging2 showed the old over-budget branch was not monotonic: at a 40K
total the payload was 72.8K, larger than the 59.8K at 60K, because
knowledge and on-demand text kept their own budgets on top of an
over-budget floor. Now the floor (every pinned policy in full, the task,
the indexes) is sent alone with a note. Default total raised to 120,000 so
a project whose policies are all pinned (SAM, ~101K) keeps its ranked
knowledge at deploy; ~48,000 gives inline delivery in Claude Code, which
saves results over ~50,000 characters to a file (59,820 spilled).

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

* task: archive get_instructions inject mode and budgets

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

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(insights): projectFlow read and pull request head record (slice F)

Adds the shared projectFlow operation behind GET /api/projects/:projectId/insights/flow
and the additive pull_request_heads table plus pull_request_checks.first_failed_at that make
CI first try and flaky checks derivable at read time.

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

* feat(web): Insights page with Flow tab and Overview This week pane (slice F)

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

* test(insights): visual audit, format tests and public docs (slice F)

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

* fix(insights): address review findings (slice F)

- from_open is set only from GitHub's opened event (exact, never inferred)
- late check results for a PR's opening commit are kept after a push
- pull_request_heads cascades with its project
- idea evidence reads use one json_each statement each (no 96-id chunking)
- round-trip budget and webhook-ingest vertical slice tests
- UI: no cross-project placeholder data, amber only for waiting-on-you,
  refresh indicator in the header, chart summary line, mobile range size
- docs: API reference entry and wording corrections

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

* chore(insights): archive slice F task file; format api index

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

* fix(insights): no type-argument narrowing of D1 rows in the batch fallback

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

* test(web): project nav has 14 items with Insights

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

* ci: retrigger (synchronize event for 600093a was not delivered)

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

* fix(insights): ideas waiting longest lists ideas a person filed

Automation- and incident-filed ideas are folded away on the Ideas list; on
staging they filled the whole list.

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

* task: backlog staging Claude MCP tool call never sent

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

* fix(insights): CI tile does not claim checks are running when none reported

Staging found a pull request on a repository with no CI: it stays
undecided because no check ever reports, and the tile said "Waiting on
CI, 1 pull requests still running checks". Say no result yet instead,
which is true for both pending checks and no checks, and fix the plural.

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

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(web): bring the Tools page up to date

The Tools page marked the SAM Connector and GitHub App as "coming soon"
although both ship, listed a self-hosted runner that does not exist, and
had no MCP servers entry. Every card now links to where the tool is set
up; the Connector card hides when the installation turns it off.

The CLI page's quick start used a pasted session cookie and the
maintainer's production API URL. It now matches the CLI guide: browser
sign-in against this installation's API, project selection, chats and
tasks, plus the API-token route for scripts. Its version fetch moves to
TanStack Query. The CLI guide no longer tells readers to ignore it.

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

* fix(web): show the Connector card only once it is confirmed on

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: add staging-lease-fair-queue

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

* fix(staging): give the staging lease a fair queue

Reservations are append-only deployment records written by a new queue
job outside any concurrency group, so no later dispatch can cancel a
waiting agent's place. Only a branch that holds the lease or whose turn
it is reaches the serialized lease job. At release or expiry the head of
the queue gets a configurable grace period, then the next entry; a
releasing holder queues behind existing waiters; reservations expire.
Records are version 2, which older workflow copies refuse.

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

* fix(staging): address lease queue review findings

- An expired holder's reservation is no longer dropped, so it can take
  the slot again or queue behind waiters.
- A release enters the serialized group only when the branch holds the
  lease or is queued, and the lease job uses its own group
  (staging-lease-<installation>), so stray releases and older workflow
  copies cannot displace an entitled pending run.
- The lease job honours the turn the queue job saw (bounded to three
  grace periods), so a runner or group wait cannot cost the head its turn.
- History is read across up to five pages before failing closed.
- status parses string payloads for the recorded grace period.
- Docs: release only after your own deploy run finished.

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

* fix(staging): address CodeRabbit review of the lease queue

- A reservation made after the branch's old one expired goes to the back.
- A missed head that reserves again is placed by when it reserved, ahead
  of later reservations.
- When a waiter ahead leaves, every remaining entry keeps the end of the
  turn it was told (promisedEnd), so a sleeping agent cannot miss it.
- Snapshots keep recently missed entries for the admission slack, so a
  delayed lease job can still prove the turn it was let through on.
- Reservations record the grace period, so status is right before the
  first snapshot.
- Docs: release comes after every live check; rule 13 states the
  early-release turn window.

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

* docs(staging): keep root rule 13 within the launch context budget

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

* fix(staging): never write a queue record over a live pre-queue lease

A workflow copy from before the queue refuses any version-2 record, so a
reservation written over its live lease locks it out of renewing or
releasing. While the holder's record is version 1, the queue job writes
nothing and tells the caller to wake at the legacy expiry.

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(inbox): agent inbox tools inbox_read/inbox_write over shared operations (slice D)

Adds fileAgentAsk/fileAgentReview/updateAgentAsk/cancelAgentAsk/listAgentAsks/getAgentAsk in
packages/operations, the worker port (announce, withdraw, link checks), the MCP member tools and
domain groups, and makes request_human_input an alias of a blocking ask through the same
operation.

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

* feat(inbox): turn-end instruction, inbox_write chat card, blocking-only paused readers

- get_instructions carries one inbox paragraph for task-backed sessions; server instructions,
  request_human_input description and onboarding text point at inbox_read/inbox_write
- chat card InboxItemCard for inbox_write ask/review (shared typed-card list, compact matcher)
- readers meaning 'chat paused on a person' and the chat-message close only count blocking asks
- review notice wording

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

* test(inbox): agent inbox operations on real SQL, tenancy attacks with owner controls

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

* test(inbox): capability through /mcp per method, inbox_write card render and cross-harness

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

* docs(inbox): what agents file, inbox_write/inbox_read in tool tables, new admin settings

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

* feat(web): inbox item card polish and Playwright audit at 375/1280

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

* style: import order and formatting in inbox agent operations

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

* fix(inbox): review findings for slice D

- inbox_read and the similar-items check only see items addressed to the caller's person
- pr links pinned to the project's repository host and a numbered pull/merge request path
- reconciliation check-in hold and connector count ignore non-blocking asks
- similar scan reads at most inbox.similarScanMax rows; chat list uses the chat index;
  preview lookup keeps the primary key; idempotency key capped at 120 characters
- card: receipt is a mounted live region that takes focus, error copy by status,
  unique 'Open in inbox' label and 44px mobile target, stronger title

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

* task: slice D status and remaining work

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

* docs: keep agents.md account list numbering

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

* docs(inbox): inbox tools need a task-backed session

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

* task: slice D progress

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

* test(inbox): compact history keeps only the inbox_write item reference

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

* test(inbox): cross-user isolation (proven discriminating) and pull request host pinning

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

* task: slice D progress

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

* test(inbox): non-blocking asks do not pause a chat in the overview or chat index (discriminating)

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

* task: slice D progress

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

* test(inbox): request_human_input alias keeps title, schedule, live chat update and push

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

* task: slice D progress

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

* test(inbox): get_instructions carries the inbox paragraph once in task and conversation mode

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

* test(inbox): non-blocking asks and reviews outlive the expiry sweep; blocking asks expire

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

* test(inbox): SAM's check-in is not held by a non-blocking ask (discriminating)

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

* task: slice D progress

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

* test(inbox): share the inbox capability harness between slice A/G and slice D tests

Removes the duplicated seed and route helpers SonarCloud flagged.

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

* fix(inbox): import order in MCP registries; card test follows the unique link name, covers a server error

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

* ci: re-run checks on the rebased head

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

* task: backlog bug found on staging (task fails after three placement refusals)

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

* task: archive inbox slice D (staging verified)

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 Inbox

One list of every open ask (questions, permission requests, secrets,
approvals) built from one UNION ALL read over the stores each ask lives
in, with UI renders of the quick view and a phone item view, and the X
card for sharing.

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

* docs(www): address accuracy review on the Inbox journal post

Permission requests come from a synced index, so the post no longer
claims the Inbox involves no copies; the phone render now uses the shape
a real request_human_input question has (no links, no free text); and
the answer-race, badge, tier, archive and pagination wording now match
the code. Files a backlog task for the Inbox guide describing review asks
that nothing creates yet.

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

* docs(www): keep the Inbox X card lossless

Palette compression dithered the gradient; restore the original
Chromium render (the same file uploaded to the library).

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

* docs(www): qualify badge and pagination claims in the Inbox post

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

---------

Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…2809)

* task: add staging-lease-fair-queue

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

* fix(staging): give the staging lease a fair queue

Reservations are append-only deployment records written by a new queue
job outside any concurrency group, so no later dispatch can cancel a
waiting agent's place. Only a branch that holds the lease or whose turn
it is reaches the serialized lease job. At release or expiry the head of
the queue gets a configurable grace period, then the next entry; a
releasing holder queues behind existing waiters; reservations expire.
Records are version 2, which older workflow copies refuse.

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

* fix(staging): address lease queue review findings

- An expired holder's reservation is no longer dropped, so it can take
  the slot again or queue behind waiters.
- A release enters the serialized group only when the branch holds the
  lease or is queued, and the lease job uses its own group
  (staging-lease-<installation>), so stray releases and older workflow
  copies cannot displace an entitled pending run.
- The lease job honours the turn the queue job saw (bounded to three
  grace periods), so a runner or group wait cannot cost the head its turn.
- History is read across up to five pages before failing closed.
- status parses string payloads for the recorded grace period.
- Docs: release only after your own deploy run finished.

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

* fix(staging): address CodeRabbit review of the lease queue

- A reservation made after the branch's old one expired goes to the back.
- A missed head that reserves again is placed by when it reserved, ahead
  of later reservations.
- When a waiter ahead leaves, every remaining entry keeps the end of the
  turn it was told (promisedEnd), so a sleeping agent cannot miss it.
- Snapshots keep recently missed entries for the admission slack, so a
  delayed lease job can still prove the turn it was let through on.
- Reservations record the grace period, so status is right before the
  first snapshot.
- Docs: release comes after every live check; rule 13 states the
  early-release turn window.

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

* docs(staging): keep root rule 13 within the launch context budget

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

* fix(staging): never write a queue record over a live pre-queue lease

A workflow copy from before the queue refuses any version-2 record, so a
reservation written over its live lease locks it out of renewing or
releasing. While the holder's record is version 1, the queue job writes
nothing and tells the caller to wake at the legacy expiry.

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

* fix(staging): keep branches with new Durable Object migrations off primary staging

Durable Object migrations only move forward, so a branch that deploys a
migration tag main lacks blocks every main-based branch on that
installation until it merges. deploy-staging.yml now refuses such deploys
on primary staging before a place is reserved, and tells the agent to use
staging2. The comparison reads apps/api/wrangler.toml on the branch and on
origin/main, and fails closed when it cannot read every tag. Documents the
clean-up duty: tear staging2 down and redeploy main before releasing if
the branch has not merged.

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

* test(staging): exercise the migration guard's git path; tie it to the deploy condition

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

* fix(staging): run git by absolute path in the migration guard on runners

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>
…-outbound-fetch lint (#2751)

* feat(api): guard user-chosen outbound URLs (L5a: classifyHost, guardedFetch)

Port of the outbound-fetch guard from sam/selfhost-pass-2 (landing slice L5a):
- worker-core network-hosts: classifyHost (public/private/forbidden, every IPv4/IPv6
  literal spelling) and guardedFetch (host check before the request, manual redirects,
  each hop re-checked, cross-origin header allowlist, one deadline)
- admin setting outbound.maxRedirects (default 3)
- web push: endpoints must be public hosts at save; stored rows re-checked at delivery
  (skip + web_push.endpoint_refused, no URL in the log)
- composable credentials: base URL must be HTTPS on a public host at save; a stored
  private/metadata base URL is skipped and logged in resolveProxyUpstream
- agent sign-in issuer keys fetched through guardedFetch (no redirects)
- check_dns_status in its own module: same-origin hops only, fixed error categories
- deployment-release image resolver uses the shared classifier (OCI helpers split out)

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

* test(api): outbound guard through its real callers (L5a)

Classifier and guardedFetch suites; push send and save; credential save and use-time skip
through the real passthrough route (9 refusals proven red against main's isHttpsUrl);
JWKS fetch through the real agent sign-in route; check_dns_status; image resolver cases
the old local blocklist accepted (7 proven red against main).

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

* feat(quality): sam/no-unguarded-outbound-fetch lint rule with a per-file ratchet (F6)

Replaces the integration branch's regex/AST inventory of fetch call sites (finding F6) with an
ESLint rule over apps/api/src and every package the Worker bundles. It matches every value
reference to the global fetch ((0,fetch), Reflect.apply, fetch.call, globalThis/self.fetch,
fetch passed as a value) and cloudflare:sockets imports. Stage: ratchet. 44 pre-existing sites
in 32 files are held by outbound-fetch-baseline.json; a new unacknowledged site fails lint, and a
file whose count drops must lower its baseline. Sites guarded in this change are acknowledged
inline with the reason.

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

* docs: outbound requests to user-chosen URLs; L5a task file

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

* fix: address L5a review findings

- lint rule: acknowledge only directives that list the rule id; catch destructured and
  Reflect.get aliases of the global fetch
- outbound.maxRedirects: an unreadable setting refuses every redirect (0) instead of the default
- check_dns_status keeps httpStatus on a refused redirect
- remove guardedFetch's unused deadline option; un-export internal classify helpers
- tests: push DO save refusal and stored private row through the DO fan-out, PATCH of a
  configuration base URL, skip-then-next-candidate in resolveProxyUpstream
- docs: passthrough per-hop gap stated; admin-settings guide mentions outbound.maxRedirects

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

* test(api): fold the private base URL cases into the passthrough suite (no duplicated mocks)

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

* task: L5a staging recipe

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

* task: L5a staging2 evidence; backlog for misleading node-create offering message

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>
@coderabbitai

coderabbitai Bot commented Nov 16, 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

@simple-agent-manager

Copy link
Copy Markdown
Contributor Author

UI audit evidence: shared composer preserves self-host Instant/profile capability after main extraction. Six focused suites/127 tests pass; complete Playwright audits19 pass,1 intentional desktop skip for phone-only flow. The UI specialist opened and reviewed all six images: no clipping, overlap or viewport regression; long input scrolls internally and controls remain visible.

Screenshots stored permanently in SAM project library /engineering/selfhost/m3-pr2817/ (project access required):

@codspeed

codspeed Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing sam/m3-merge-current-main-bgbh6j (0a4a544) with main (5d1a247)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 (9286831) during the generation of this report, so main (5d1a247) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@sonarqubecloud

Copy link
Copy Markdown

@simple-agent-manager
simple-agent-manager Bot marked this pull request as ready for review November 16, 2026 20:20
@simple-agent-manager simple-agent-manager Bot added the coderabbit-review Trigger CodeRabbit review for opt-in PRs label Nov 16, 2026
@simple-agent-manager

Copy link
Copy Markdown
Contributor Author

Coordinator review (self-host coordinator, task 01M7JMXS2JRW6QQMB1356ENPM3): checked the merge parents (9286831 integration / 7266055 main) and the post-merge commits (fixture alignment with main's fail-closed redirect settings, outbound-fetch inventory test + analyzer deleted now that the lint rule replaces them, integration-branch-only ci.yml hosted-git filter/aggregate). Full CI 43936073442 passed on 0a4a544, the box upgrade + agent smoke passed and were cleaned up, and the specialist table is PASS/ADDRESSED. CodeRabbit: requested 20:20:58Z, answered "Review skipped: auto reviews are disabled", recorded per the CodeRabbit rule. Merging into sam/selfhost-pass-2 with a merge commit, as for #2758.

@simple-agent-manager
simple-agent-manager Bot merged commit faa02a8 into sam/selfhost-pass-2 Nov 16, 2026
37 of 38 checks passed
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