Skip to content

[AI-0327] fix(endpoint): retain exact provider publication bytes - #523

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-0327/fix-provider-byte-binding
Oct 17, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-0327/fix-provider-byte-binding

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Retain validated canonical provider-routing publication bytes through acknowledgement and binding. Bind and current-proof checks now compare those bytes against the actual registry projection in addition to digest, publication identity/domain/version, epoch and registry revision.

Tests isolate bind-time byte equality from digest equality, prove caller-owned acknowledgement bytes cannot replace retained state, and reject different same-revision registry projections. The docs pin moves from 0e64af0 to accepted CTX-0161 abb820b; the submodule mount remains uninitialized.

This is an offline helper seam. Strict dispatch remains Unbound, normal dispatch stays tolerant, and no authenticated Core ingress is added. Cross-reset proof isolation is explicitly limited and tracked in #522 / AI-0330, which blocks live strict provider-list success in #521 / AI-0329. Identically reconstructed state can still accept an old otherwise matching proof.

Validation: repository just check, 132 endpoint tests, CI/CodeQL dry-runs and secret scan passed. Independent security review APPROVE PX-1465. CodeRabbit CLI completed with zero findings on the earlier diff; the final test additions and lifecycle wording were independently re-reviewed.

Closes #519

Priority: P1 | Area: model-provider | Labels: fix,P1,area:model-provider | Milestone: v0.1.0 | RFC: AIQ-38 / CTX-0161 | Task: AI-0327

Summary by CodeRabbit

  • Bug Fixes
    • Provider-routing acknowledgements and bindings now require an exact match with the published projection. Matching registry revisions alone are no longer sufficient, and altered or mismatched projection data is rejected.
    • Reconstructed publication state can accept the same publication again; replay protection remains limited to the lifetime of an individual state instance.
  • Documentation
    • Clarified validation requirements and the limits of offline checks, including that they do not verify Core-origin authentication or strict-dispatch success.
    • Updated the referenced provider-routing contract’s status.

Compare retained canonical bytes at bind and current-proof checks.
Preserve helper-owned acknowledgement data and tolerant dispatch.
Document single-state lifecycle limits; AI-0330 blocks strict wiring.
Sync docs pin to accepted CTX-0161 abb820b.

Closes #519
@Xuepoo Xuepoo added this to the v0.1.0 milestone Oct 17, 2026
@Xuepoo Xuepoo added fix Bug fix P1 Priority: high area:model-provider Area: model registry and inference labels Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bda085b0-6556-496b-b478-6b203fc10a7e
📥 Commits

Reviewing files that changed from the base of the PR and between 6757b1e and 7f9f589.

📒 Files selected for processing: 4
  • crates/bitty-ai-endpoint/API.md
  • crates/bitty-ai-endpoint/src/metadata_publication.rs
  • crates/bitty-ai-endpoint/src/provider_binding.rs
  • docs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The endpoint retains canonical provider-routing projection bytes across publication states. Binding and current-proof validation compare those bytes and the digest with a fresh registry projection. The API documentation describes the offline seam’s limits, and the docs reference is updated.

Changes: Provider publication binding

Layer / File(s) Summary
Retain canonical projection bytes
crates/bitty-ai-endpoint/src/provider_binding.rs
Publication acknowledgements retain validated canonical bytes. Bindings copy the bytes and digest from the acknowledgement. Acknowledgements parsed from acknowledgement frames initialize the bytes as empty.
Enforce exact projection equality
crates/bitty-ai-endpoint/src/metadata_publication.rs, crates/bitty-ai-endpoint/src/provider_binding.rs, crates/bitty-ai-endpoint/API.md, docs
Acknowledgement handling uses publication identity; binding checks identity, digest, and canonical bytes. A mismatch clears the acknowledgement. Current-binding validation also checks canonical bytes. Tests cover differing and identical projections, modified bytes, and reconstructed publication state. The API documentation describes the validation gates and offline-seam limits. The docs subproject reference is updated.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 7f9f5

The reviewed offline binding change is mergeable after normal checks; no actionable risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 57.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 2 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: retaining exact provider publication bytes through acknowledgement and binding.
Linked Issues check Passed Direct issue #519 requires bounded canonical-byte retention, byte and digest checks at binding and current-proof validation, lifecycle and registry guards, regressions, API documentation, and the CTX-…
Out of Scope Changes check Passed The changed source code, regression tests, API documentation, lifecycle comment, and docs gitlink all support #519. The changes do not add Core authentication, transport, Lua integration, provider I/O…
Full details: Linked Issues check

Explanation

Direct issue #519 requires bounded canonical-byte retention, byte and digest checks at binding and current-proof validation, lifecycle and registry guards, regressions, API documentation, and the CTX-0161 docs pin. The diff stores validated projection bytes in the retained acknowledgement and binding. Binding and current checks compare retained bytes and digest with a fresh registry projection. Acknowledgement uses the retained pending record, so caller-supplied acknowledgement bytes do not replace it. Tests cover same-revision projection mismatch, identical projections from distinct registry values, caller-byte isolation, changed binding bytes, and missing retained bytes. The changes preserve the offline seam, tolerant dispatch, Unbound strict dispatch, and the existing bounded publication path. The API documentation and docs gitlink also match #519.

Full details: Out of Scope Changes check

Explanation

The changed source code, regression tests, API documentation, lifecycle comment, and docs gitlink all support #519. The changes do not add Core authentication, transport, Lua integration, provider I/O, or strict-dispatch success. The documented cross-reset limitation is an explicit boundary for the offline seam and does not introduce unrelated behavior.

Full details: Docstring Coverage

Explanation

Docstring coverage is 57.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 2 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

@Xuepoo Xuepoo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent security review verdict (guard closeout, recorded from CarryCtx notes).

  • Verdict: APPROVE (final targeted security rereview, CarryCtx note PX-1465; closeout note PX-1467).
  • Scope: offline exact provider-publication-byte binding under CTX-0161; no authenticated Core ingress, no strict-dispatch success, no transport/Core/Lua changes.
  • Reviewed head: 7f9f589 (PR #523 branch ctx-0327/fix-provider-byte-binding).
  • Prior cycle: PX-1456 NEEDS-FIX (blocking P2 regression coverage) -> fixes applied (PX-1461/PX-1463) -> targeted rereview PX-1464 -> APPROVE PX-1465.
  • CI on this head: all check-runs pass, mergeable CLEAN; repository just check green locally.
  • Explicit residual limits recorded by the reviewer: identically reconstructed state can still accept an old otherwise matching proof; cross-reset proof isolation tracked in #522/AI-0330, blocking live strict provider-list success in #521/AI-0329.

Recorded by the guard tick because no verdict comment was posted on the PR itself.

@Xuepoo
Xuepoo merged commit a2bb62a into main Oct 17, 2026
11 checks passed
@Xuepoo
Xuepoo deleted the ctx-0327/fix-provider-byte-binding branch October 17, 2026 14:28
@Xuepoo

Xuepoo commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Reviewed the final CodeRabbit summary after the external merge. The review reports no actionable comments. All required CI checks and independent security review PX-1465 passed.

The advisory docstring-coverage percentage is declined as a blanket threshold change for this fix: the repository gates do not impose that threshold, and this patch documents retained-byte behavior, the offline authorization boundary and the state-reconstruction limitation in API.md and source comments. Mechanical comments on private accessors/test helpers would not add substantive contract information. This does not claim the advisory passed.

The substantive cross-reset proof-isolation limitation is tracked separately in #522 / AI-0330 and blocks live strict provider-list success in #521 / AI-0329. PR #523 does not establish authenticated Core ingress or strict success.

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

Labels

area:model-provider Area: model registry and inference fix Bug fix P1 Priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AI-0327] fix(endpoint): enforce exact provider publication bytes

1 participant