Skip to content

Add fail-closed OP v3 enrollment and message verification routes - #406

Merged
kjgbot merged 6 commits into
mainfrom
feat/op-v3-canonical-verifier
Dec 1, 2026
Merged

kjgbot merged 6 commits into
mainfrom
feat/op-v3-canonical-verifier

Conversation

@agent-relay-code

@agent-relay-code agent-relay-code Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Source scope

Mount the protected OP runtime enrollment resolver and message-ID verifier. Opt-in server composition joins the Control-owned enrollment and dev/test profile-grant records to the active person, membership, application/Engine workspace mapping, consumed agent claim and parent delegation. Both routes return 503 in the default application. Runtime database access to the new operator tables is read-only.

Each verification reads the Engine observer envelope and original DM independently, validates exact UTF-8 digest equality, then obtains the final primary Control snapshot. The broker receives all nine fields from the PR 107 wire, including the immutable acceptedTextSha256, with validity clipped to all authority deadlines. The source template documents enrollment, binding the Engine-issued epoch, replacement, revocation and the bounded as-of semantics.

Review dispositions

  • CONTROL-OP-1: unwrap and validate the Engine success envelope, with explicit refusal and malformed-response fixtures.
  • CONTROL-OP-2: accept bounded opaque Engine workspace IDs, including numeric IDs, and retain exact pin checks.
  • CONTROL-OP-I1: add the canonical SQL provider, migration, select-only runtime permissions and operator template.
  • CONTROL-OP-I2: compose scoped service callers, SQL provider and concrete evidence client in server startup behind explicit opt-in.

Verification

Local checks cover typecheck, build, serial migration tests, mounted HTTP routes, broker proof shape and composition against an ephemeral Control schema and an Engine-format fake. Retain merge-train:hold for owner review. End-to-end qualification with the independently built Engine remains a separate check.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@agent-relay-code agent-relay-code Bot added the merge-train:hold Do not merge until the owner gives the go label Dec 1, 2026
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9d994d06-dbcb-4a95-9569-5ed9c5940663

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

Copy link
Copy Markdown
Member

Independent source review of e7c483d08f1e52455de09aa6d214ead47d031be9 / tree b19ef45d3b18b02a6f2b1a8d2cbcc360fcbb9781: changes requested; full findings delivered via owner coordination.

  • P2: engineEvidenceClient.observeMessage returns the raw response, while actual Engine returns {ok:true,data:projection}. The top-level observation schema rejects every valid real response. Unwrap/validate the actual envelope and test a positive verifier path with a real-format fixture.
  • P2: the rw_ workspace regex was based on my incorrect contract assumption. Engine default workspace IDs are numeric. Accept the actual opaque Engine workspace ID (visible ASCII 1–255) while preserving the mandatory explicit pin and all exact canonical comparisons. Test default numeric IDs and mismatch refusal. Cryptographic fields/transcripts are unchanged.
  • Engineering integration remains incomplete: canonical enrollment/grant snapshots are provider ports only; src/server.ts never supplies opAuthority, so shipped composition always returns503. This gap needs a concrete Control-owned provider and opt-in trusted configuration/composition before human credential/operator bootstrap can be useful. Retain default503 and no live authority; do not derive provider authorization from request metadata.

Dedicated caller checking, nine-field accepted-text binding and bounded decision checks were source-inspected; this is not full provider/interoperability signoff and no tests were rerun. Continue the existing owner/PR with source fixes and concrete provider/composition, or identify the exact source-ownership constraint. No protected provisioning or paid task is requested.

Copy link
Copy Markdown
Member

Independent source review of exact 53a2c62 / tree 06ef381852964ae572a556a218787a7601102556: prior Engine-envelope and opaque-workspace findings are closed; the canonical SQL provider and opt-in server composition are now concrete source implementations, default disabled.

P2 CONTROL-OP-3 — bound Engine evidence bodies before JSON buffering (src/op-intake.ts:146–155). The production evidence client calls res.json() with no stream byte budget. The independent original-message response contains runtime-controlled text and potentially full metadata/attachments. A sender observation can be valid while the credential request is later refused, so the complete message is buffered before authorization. The five-second abort bounds duration, not allocation. A faulty upstream can also return an oversized 200.

Read each observer/message response through an explicit byte budget before decoding, cancel/drop immediately on overflow, and surface only the existing fixed unavailable/503 response. Do not rely on Content-Length or check only after buffering. Add streamed oversized observer and original-message negatives, including missing/misleading Content-Length, proving cancellation, fixed refusal and no positive proof.

This is a source review, not a test rerun or live qualification. Actual PostgreSQL role/concurrency evidence, final Core/Engine/Gate/Control HTTP composition, exact CI and migration0106 slot coordination remain separate. No live approval records, credentials, grants, migrations or activation were applied.

@agent-relay-code

Copy link
Copy Markdown
Contributor Author

Control open-PR triage for the existing branch writer at 53a2c62e8fc5: please diagnose the failing head check (Typecheck and test, Cloud import verifier harness (PostgreSQL)). Please return the successor SHA and check result on this PR. The bounded Engine response finding remains tracked in #issuecomment-7309271456.

@kjgbot

kjgbot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Published source repair at 0c77da4306dbb879a54b0680a45cadf3120d0127 / tree c46e28fb27423a7f2027ff59f40d1bd83ee489e7, preserving the incumbent branch history through an ordinary fast-forward push. Current main 6ea77ad1 was merged cleanly; no original migration was modified.

  • Addresses CONTROL-OP-3 from comment7309271456: Engine evidence responses now use bounded streamed reads before JSON decoding (64 KiB observer / 256 KiB original-message envelope), cancel on overflow, and release refusal/outage bodies. Content-Length is only an early rejection hint; actual bytes enforce the limit. Existing fixed unavailable/503, explicit refusal, authenticated caller, workspace and nine-field proof checks remain intact.
  • Meaningful stream regressions cover absent/misleading/non-numeric lengths, UTF-8 split across single-byte chunks, exact limits and limit+1, immediate cancellation, malformed/error streams, mounted sanitized503 and no grant authorization. The oversized valid-envelope regression discriminates the old unbounded reader.
  • Refreshes the Cloud import verifier manifest from a fresh disposable synthetic local PostgreSQL15.17 cluster, rather than any qualification target. Exactly57 objects from additive migration0106 were added. All2,652 prior definitions and105 prior migration hashes remain unchanged, with no removals or optional-inventory changes. Documentation records149 tables /2,709 mandatory objects.

Final integrated local validation, all through the shared heavy queue:

  • Native PostgreSQL15 Cloud import/schema/copy harness: 109 passed,0 failed,0 skipped.
  • Focused OP intake/provider, response-body audit and manifest-reader checks: 49 passed,0 failed,0 skipped.
  • Typecheck, build and diff checks: PASS.

The native PostgreSQL harness qualifies the synthetic schema/import/copy path. OP-specific trigger/CAS/revocation and runtime-readonly behaviors are exercised by the existing PGlite composition tests; this is not new native-PG OP concurrency evidence. No local full npm suite was rerun; fresh normal CI and final independent cumulative review remain required on this published head. Keep the merge hold until those gates and current feedback are clear.

This is source work under the existing direct source-merge instruction. It performs no live authority seeding, grant issuance, credentials, SSO renewal, provider operation, migration deployment, release or runtime activation. The separate original remote task-delivery/SSO guard is unchanged.

@kjgbot kjgbot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Independent full source review: qualified SOURCE PASS at exact 0c77da4306dbb879a54b0680a45cadf3120d0127, tree c46e28fb27423a7f2027ff59f40d1bd83ee489e7. Reviewed the full12-file feature delta against main 6ea77ad1, including the canonical provider, mounted HTTP routes, server composition, additive0106 migration, role grants, tests, bootstrap documentation and final generated manifest. This reviewer ran no tests/builds or database/runtime actions.

The earlier interoperability and availability findings are closed in source:

  • Engine reads require and unwrap {ok:true,data}; Control resolver/verifier responses remain their raw strict DTOs. Engine workspace IDs are explicitly pinned bounded opaque strings, including numeric IDs, distinct from Control workspace UUIDs.
  • Observer responses have a64KiB byte budget and original-message responses256KiB. The fixed-size streaming buffer refuses before retaining overflow, ignores missing/lying Content-Length as authority, cancels oversize/unneeded bodies, and emits fixed unavailable errors. Tests cover both endpoints, one-byte UTF-8 chunks, exact limits/overflow, absent/false lengths, cancellation, route503 and zero canonical authorization calls after overflow.
  • Verification accepts only messageId input, independently obtains authenticated Engine observation and original DM text, verifies accepted/current/read hashes and immutable sender/workspace/broker recipient, then re-reads current canonical authority before issuing the short proof.

The provider's single fresh primary SQL statement binds the Control person, organization membership, application workspace and current Engine workspace mapping, immutable actor/consumed unreleased claim, approved runtime/key/ref/epoch/revision, logical runtime, explicit dev/test profile policy and active direct person-issued delegation. Its deadlines and observation/order checks clip the returned lease; ambiguity, expiration or revocation yields no positive decision. Logical runtime mapping is not physical-host attestation. Sampled authority remains an as-of lease of at most60seconds, not cross-service serialization.

0106 adds only new tables/indexes/guards. Policy is operator-written and runtime SELECT-only, with inherited write privilege checks. Identity/scope/key/validity are immutable; epoch binding is one-time and timestamped; revoked rows cannot be restored; replacement requires the retired predecessor/family and a fresh key. No record or credential is seeded, and explicit server opt-in remains disabled by default. Human bootstrap has concrete parameterized templates; no live bootstrap is performed here.

I independently compared the final manifest: all2,652 prior definitions and105 migration hashes are unchanged; exactly57 new OP objects were added (2tables,27columns,13constraints,10indexes,3triggers,2functions). The0106 file hash matches the recorded b7e7711a…; only manifest and count/scope documentation changed after the integrated source merge. Final worktree/head/tree were clean and match the published pin.

Execution evidence is distinct from this source review: the owner/coordinator reports integrated49/49 focused checks, typecheck/build, and a native PostgreSQL15 schema/import harness109/109 with no skips. The native harness validates migration/catalog/import behavior; OP-specific trigger/CAS/revocation/read-only behavior was exercised by the PGlite provider test, not claimed as a native PostgreSQL concurrency suite.

Before source merge, require the normal exact-published-head Typecheck/test, PostgreSQL suites and Cloud import verifier jobs; all three were queued at review. Later whole-chain qualification should compose the real owned Control provider with actual Gate/Engine and final Core, and separately cover native PostgreSQL OP lifecycle/concurrency/roles. Those are runtime/integration evidence limits, not invented live-activation gates for this disabled source PR. No actual credentials, OP grant, production policy, migration application, deployment or activation is claimed. No new source blocker found.

@kjgbot kjgbot removed the merge-train:hold Do not merge until the owner gives the go label Dec 1, 2026
@kjgbot
kjgbot merged commit cffda64 into main Dec 1, 2026
5 checks passed
@kjgbot
kjgbot deleted the feat/op-v3-canonical-verifier branch December 1, 2026 19:38
@kjgbot

kjgbot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Merged under the existing direct source-merge instruction: cffda64b99bc1540487f5868022051fcc7c6ab81, parents 6ea77ad1 + exact reviewed head 0c77da4306dbb879a54b0680a45cadf3120d0127. Landed tree c46e28fb27423a7f2027ff59f40d1bd83ee489e7 equals the reviewed source and actual CI checkout a1d029cb tree. Ordinary pinned merge; no admin or check bypass.

Final normal run 46722722690 passed all three jobs. Typecheck passed; the npm test step completed normally with2662 passed/0 failed/164 skipped, and the separate synthetic-ledger step passed38/38. PostgreSQL suites passed76 tests across10 suites; the Cloud import verifier harness passed109/109 with no skips. No failed or cancelled step was masked. CodeRabbit/Proof were intentional skips. Independent exact-head source review is 6138159597; no unresolved threads or new feedback remained.

This lands disabled source, the bounded evidence reader and an additive0106 schema/verified manifest. It seeds no live authority records, issues no grant or credential, and performs no configuration, SSO, provider, release, deployment or runtime activation. Native OP-specific concurrency and final whole-chain qualification remain separate. The original undelivered corrective source task is superseded by this landed fix and must not be retried when its old SSO path later recovers.

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