Skip to content

Per-installation capability receivers + audiences (multi-receiver option a) - #250

Draft
jaydubya818 wants to merge 1 commit into
fix/hosted-capability-policy-owner-scopefrom
claude/mc-multi-receiver-20261117
Draft

jaydubya818 wants to merge 1 commit into
fix/hosted-capability-policy-owner-scopefrom
claude/mc-multi-receiver-20261117

Conversation

@jaydubya818

Copy link
Copy Markdown
Owner

Option (a) of MC-MULTI-RECEIVER-PLAN.md: per-installation capability receivers and audiences, so tester-N installations can be admitted on the same MC deployment without sharing Jay's installation id, epoch, recovery switch or audience. Branch + CI only. Not pushed to Convex.

Changes

  • New convex/lib/capabilityReceivers.ts: optional MC_CAPABILITY_RECEIVERS_JSON = {"<installationId>": {"epoch", "recoveryState"}}. Malformed map → no receiver configured (deny all). Unknown installation → CAPABILITY_INSTALLATION_UNQUALIFIED.
  • requireCapabilityReceiverRecovery(installationId, incarnation): per-installation epoch/recovery when the map is set. Call sites: capabilityAdmission.ts, sofieExecutionPermitState.ts (readApproved), capabilityChallenges.ts, capabilityWorkControl.ts (identity[3], identity[5]), capabilityLifecycleInventory.ts.
  • Installation gate (=== MC_CAPABILITY_INSTALLATION_ID) → capabilityReceiverConfigured(binding.installationId) at the same three sites; "must be set" check → capabilityReceiversConfigured().
  • MC_SOFIE_INSTALLED_ORIGINS accepts optional audiences: {"<installationId>": "<origin>"}; installedEnrollment and controlConnection compare against installedAudienceFor(origins, enrollment.installationId). audience stays the default; issuer stays singleton. Malformed audiences → deny.
  • connectionLifetimeCap: skip a malformed confirmation installation entry instead of return null (one tester's typo can no longer deny Jay's 7-day renewal).

Backward compatibility

With MC_CAPABILITY_RECEIVERS_JSON absent, the installation gate and recovery check run the exact legacy singleton logic (an equivalence test compares against the pre-change implementation over a grid of env/input combos). Without audiences, every installation uses the single audience. Jay's live env needs no change.

Tests

New convex/__tests__/capabilityMultiReceiver.test.ts (13 tests): legacy jay-only unchanged; jay + tester-1 admitted only with own epoch; tester using jay's epoch quarantined; quarantining one installation leaves others; per-installation Work freeze; unknown installation refused; malformed map denies all; per-installation audience (tester can't use jay's, jay can't use tester's); malformed audiences denies; malformed tester confirmation entry keeps jay's cap (both iteration orders). 4 of them fail against 12e636d source (audiences + lifetime cap), as expected.

Local: tsc -p convex/tsconfig.json clean; vitest run convex/__tests__ 199 files / 1849 tests passed; check-convex-authorization PASS; check-runtime-contract output identical to base.

Not in this PR

  • hosted-config/mc-stage1-checklist.mts (lives outside this repo) should learn the map form before tester env is set; it still PASSes for Jay under legacy env.

Rollback

Redeploy 12e636d (npx convex deploy from a checkout of 12e636d). No schema change; env unchanged because the new vars are optional.

🤖 Generated with Claude Code

https://claude.ai/code/session_012LggsLdugimXyao6ECTRNB

…and per-installation audiences

Option (a) of the multi-receiver plan. Replaces the singleton installation id, receiver epoch and
recovery state checks with a per-installation receiver map, and lets MC_SOFIE_INSTALLED_ORIGINS
pin an installation to its own audience. Both new configs are optional: when
MC_CAPABILITY_RECEIVERS_JSON is absent the legacy singleton checks run unchanged, and without
`audiences` the single `audience` governs every installation.

Also: connectionLifetimeCap skips a malformed confirmation installation entry instead of
returning null, so one tester's bad entry cannot deny another owner's 7-day renewal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012LggsLdugimXyao6ECTRNB
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
mission-control-ui Ready Ready Preview Nov 18, 2026 3:11am UTC

Request Review

@jaydubya818 jaydubya818 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review decision — REQUEST CHANGES on MissionControl #250 at 756fb53.

Three failures are reproduced by tests.

Fix branch codex/mc-250-review-fixes-20261117 at 8955c6d is based directly on this PR head.

8955c6d

  1. P1 — a malformed receiver entry quarantines every installation. In convex/lib/capabilityReceivers.ts:22-25, returning an empty map from inside the loop discards already validated receivers. A bad tester-1 entry makes jay and tester-2 return CAPABILITY_INSTALLATION_UNQUALIFIED. The fix skips the malformed entry, and tests verify valid installations continue while the bad installation refuses.
  2. P1 — a malformed audience entry blocks every installed connection. In convex/lib/installedSofieConnection.ts:15-19, validating every entry inside installedOrigins rejects the whole object. Both normal connections and long-lived lifecycle/control connections use this helper. The fix validates only the requested installation at lookup. A valid jay entry remains usable with a malformed tester entry.
  3. P1 — a missing audience entry borrows the default audience. In convex/lib/installedSofieConnection.ts:24-27, installedAudienceFor falls back to the owner audience even when a per-installation map is enabled. A configured tester receiver can therefore carry the owner's audience when its entry is absent. The fix requires an explicit valid entry once the map is enabled. With the map absent, legacy behavior is preserved.

Verified on the proposed fix branch.

  • Legacy fallback passes the pre-map recovery decision grid and the full jay admission test.
  • Actual signed tester-1 admission receipts are refused when replayed as jay or tester-2 at the result readback boundary. Both source policy permits are also refused across those installations, even with shared trusted source keys.
  • All three audiences accept only their own enrollment origin. A receiver's epoch or recovery state remains scoped to its installation.
  • Malformed confirmation-installation entries preserve jay's seven-day renewal cap in either iteration order.
  • There is no Convex schema change in this PR. The schema is byte-identical to base 12e636d. No data migration is required for rollback. Previous singleton settings must be retained when configuring the map so a source rollback restores jay's previous receiver.
  • pnpm run ci:prepare passed. Convex TypeScript passed. All 199 Convex test files and 1,858 tests passed. The authorization ratchet passed.

MyFactory d1061e2233bd157813ad68034d1d014937951d2e also passed review.

  • packages/agents/src/index.ts:30-31 carries import-type and no-python/python3 instructions into developer_instructions at line 276.
  • apps/supervisor/src/spend-gateway.ts:198-199 computes full input-context plus output-cap cost. Lines 228-235 reserve and mark dispatch before the provider send.
  • packages/storage/src/spend-policy.ts:95-110 refuses a later repair call if total retained exposure or the protected completion reserve would be exceeded. Lines 123-146 allow at most three extra productive calls from available headroom.
  • apps/supervisor/src/hosted-limits.ts:83-106 enforces $1.30 per Work, four Works per person ($5.20 maximum), and the configured monthly budget at admission and each call. The owner host configuration is $8/month. The library's default is $25, so the installed $8 setting must remain explicit.
  • 67 focused tests passed, including an added mocked-provider regression checking a durable full reservation at send time and no send after insufficient headroom. The live owner build was outside this review's test execution.

Expiry handling fails for the currently installed wrappers.

  • ~/.myeve-private-beta/verifier.sh:12 and hosted-config/gen-hosted.mts:21 still embed 2026-11-25T02:23:20.489Z.
  • The staged replacements derive verifier expiry and Sofie runtime/build-settings expiry from jay.mc-enrollment.json. The staged verifier suite passed 10 checks, bundle suite passed 18 checks, and a combined synthetic renewal test passed.
  • Renewing enrollment alone leaves the verifier at the old bundle expiry. Regenerating the bundle is necessary before verifier restart and pin refresh. RENEWAL.md steps 2-9 cover the enrollment, runtime hash, verifier hash and env/deploy sequence for Claude.
  • The requested 2026-11- scan found remaining fixed dates in the active wrappers, historical qualification timestamps, key activation timestamps and test fixtures. A claim that no hard-coded dates remain would be incorrect.
  • The staged RENEWAL.md:28-29 also needs an accounting lifetime check. Stable plan/charter digests do not extend an already issued charter's valid_until. Check the ledger before keeping the old charter across an expiry-only renewal.

Production work during this review consisted of no deployments, environment edits, database commands or Convex pushes.

GitHub rejected the REQUEST_CHANGES event because the authenticated account authored this PR. The review is posted with the COMMENT event and the requested-changes decision above.

This branch was successfully deployed

1 active deployment
Preview — 756fb53d Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants