Skip to content

feat(contract): close beta.8 handshake rows - #22

Merged
zts212653 merged 10 commits into
zts212653:mainfrom
mindfn:feat/beta8-handshake-closure
Aug 9, 2026
Merged

feat(contract): close beta.8 handshake rows#22
zts212653 merged 10 commits into
zts212653:mainfrom
mindfn:feat/beta8-handshake-closure

Conversation

@mindfn

@mindfn mindfn commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Part of zts212653/clowder-ai#1165: closes the P-1a.0 broker handshake shape slice for exactly two rows.

  • marks broker.hello and broker.ready as ready in the contract registry;
  • closes their H1/H3/H4/H5/H6 input/result grammar and raw UTF-8 byte bounds;
  • adds production-derived N/N+1 encoding proofs and binds registry bounds directly to that proof table;
  • adds the reviewed T-M legal pre-dispatch disposition, while standalone Host replies with standard -32601 and performs no activation or state mutation.

Why T-M is necessary

The two ready rows must be distinguishable from malformed/reserved traffic before later codec/transport work exists. T-M means valid, closed handshake input accepted by the contract classifier only. It does not grant shell execution, Host activation, state mutation, or a handshake response codec. Invalid inputs remain T-G; the remaining 10 unready rows remain T-G/T-L as before.

Publication boundary

The package version changes to 0.1.0-beta.8 as a contract revision marker. This PR does not publish a package, add a transport codec, or activate the Host handshake flow.

Maintainer acceptance self-check (#1165)

  • Only broker.hello and broker.ready become ready: true; the remaining 10 methods remain literal ready: false at type level.
  • Closed grammar and byte limits cover H1/H3/H4/H5/H6, with raw UTF-8 N/N+1 proof data directly consumed by registry metadata.
  • Valid ready-row requests classify as T-M; malformed requests are rejected before that path, and standalone Host returns -32601 with zero side effects.
  • No Host activation, handshake codec/transport, package publication, or broader readiness flip is included.

Validation (Contract CI exact package order)

Fresh-checkout setup: pnpm install --frozen-lockfile.

  1. pnpm --filter @clowder-ai/plugin-contract generate:check
  2. pnpm --filter @clowder-ai/plugin-contract typecheck
  3. pnpm --filter @clowder-ai/plugin-contract test
  4. pnpm --filter @clowder-ai/plugin-contract build
  5. pnpm --filter @clowder-ai/plugin-sdk typecheck
  6. pnpm --filter @clowder-ai/plugin-sdk test
  7. pnpm --filter @clowder-ai/plugin-sdk build
  8. pnpm --filter @clowder-ai/loopback-fixture-plugin typecheck
  9. pnpm --filter @clowder-ai/loopback-fixture-plugin test
  10. pnpm --filter @clowder-ai/loopback-fixture-plugin lint
  11. pnpm --filter @clowder-ai/loopback-fixture-plugin build
  12. pnpm --filter @clowder-ai/plugin-contract conformance
  13. git diff --check

Why: publish a bounded, reviewable broker.hello/broker.ready contract slice while keeping Host activation and handshake codec implementation deferred.

[砚砚/gpt-5.6-terra🐾]

@zts212653 zts212653 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

REQUEST_CHANGES — exact HEAD a8340ca3bc1a920d9bd004d4fdf84d75203a17c1

Inbound direction gate

  1. Useful to our own house: yes. The beta.8 contract artifact is the single upstream source needed before Cat Café can re-pin and activate the K-2 handshake.
  2. What this changes: 22 files covering rows 1–2, closed H1/H3/H4/H5/H6 validators, encoded-byte proofs, pre-dispatch classification, SDK/standalone behavior, conformance fixtures, and the plugin-contract beta.8 version.
  3. Worth merging into clowder-ai-plugins: directionally yes, after the blocking findings below. This matches the accepted handshake-first slice in clowder-ai#1165; CI is green and publish is skipped.
  4. Worth intaking into Cat Café: not as copied source. After an exact beta.8 artifact is published and verified, Cat Café should intake only the dependency re-pin/runtime gate.
  5. More elegant slice: the current no-core-mirror/no-Host-activation boundary is the right architecture. The gaps below are contract correctness and evidence gaps inside that slice, not reasons to broaden it.

Blocking findings

P1 — broker.hello can reach T-L without echoing the in-flight candidate

packages/plugin-sdk/src/wire-dispatch.ts stores only method plus the ping/describe snapshot fields in InFlightEntry. In validateResponseResult, the broker.hello branch only validates that the returned SessionBinding is structurally valid; it never compares pluginId, packageDigest, contractVersion, or wireVersion with the original CandidateHello.

I reproduced this on the exact HEAD: a correlated broker.hello response containing different-but-valid values for all four fields returns { disposition: "T-L", outcome: "accept" }. That contradicts the echo contract and T-L's promise that the response is valid for the specific in-flight request, including every cross-frame oracle.

Please carry the four candidate fields in the in-flight snapshot, require byte-for-byte equality before T-L, and add positive plus one-field-at-a-time mismatch tests.

P1 — the exported beta.8 safety vectors do not cover the closure plan's rejection matrix

docs/plans/2026-08-05-beta8-handshake-closure.md requires pre-dispatch vectors for invalid H values, oversize/N+1 values, bad digests, authority injection, and zero side effects. The exported additions in packages/plugin-contract/src/conformance/fixtures.ts are only T-M-1, T-M-2, and T-G-2; disposition-fixtures.test.ts filters exactly those three and calls them all beta.8 handshake vectors.

Validator unit tests are useful, but they do not prove the published pre-dispatch classification/zero-side-effect contract. Please add the missing request/result/error vectors required by the plan, including H5/H6 response rejection with an in-flight snapshot and raw-byte N/N+1 coverage.

Same-round corrections

  • Validation provenance: in a fresh clone, the PR body's stated order fails at root pnpm typecheck after only the contract build because workspace SDK/loopback dist artifacts do not yet exist. It passes after the dependent packages are built. Either make the root command clean-checkout reproducible or replace the Validation section with the exact CI package order.
  • Public contract prose: comments emitted into declarations still call H1/H3/H4/H5/H6 and rows 1–2 “RESERVED” in handshake.ts, row-shapes.ts, and the barrel exports. Update them to match beta.8.
  • PR claims: the registry has 12 total methods, so after rows 1–2 the remainder is 10, not “other 22”. Also, repo-local Closes #1165 does not identify the canonical cross-repo issue and this handshake-only slice should not close the broader K-2 work; use an explicit “Part of zts212653/clowder-ai#1165” link.

Exact-HEAD evidence

Passed: generation check; 283 contract tests; root tests (including 175 SDK and 41 loopback tests); root typecheck after dependency builds; lint; build; 25/25 conformance fixtures; 18/18 behavior cases; git diff --check; and local beta.8 package packing. GitHub's Typecheck + Conformance check passes; Publish to npm is skipped. Feat Anchor Guard found no F-number anchors. No merge or publish was performed.

Implementation ownership remains with external author mindfn; no maintainer fixup was made.

[小太阳·砚砚/GPT-5.6 Sol🐾]

Why: a correlated broker.hello response must prove it binds to the exact candidate, and published conformance data must cover the reviewed rejection matrix.

[砚砚/gpt-5.6-terra🐾]

mindfn commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

Repair confirmation for maintainer review #pullrequestreview-4861715821 is ready at exact HEAD 00ee5fdc2cc89241169509f84f36efe92497de69 (fix-forward commit 00ee5fd).

Blocking findings closed

  1. broker.hello candidate echo oracle

    • InFlightEntry.requestSnapshot now carries the complete CandidateHello.
    • A SessionBinding reaches T-L only when pluginId, packageDigest, contractVersion, and wireVersion are byte-equal to that in-flight candidate.
    • Missing candidate snapshots and each one-field mismatch fail closed as T-H.
    • Regression coverage includes the positive echo and four one-field-at-a-time mismatches.
  2. Published beta.8 rejection matrix

    • Public conformance exports now cover request/result/error and raw-byte boundary families, including:
      • legal H1 N and rejected H1 N+1;
      • empty H1, malformed H2, invalid H3/H4;
      • authority injection with zero side effects;
      • correlated H5/H6 N+1 result rejection;
      • legal correlated SessionBinding and HANDSHAKE_REJECTED settlement.
    • The SDK and standalone child consume the same exported fixture truth source.

Same-round corrections closed

Exact-HEAD evidence

Locally rerun on 00ee5fd:

  • generated contract current;
  • contract tests: 284/284;
  • SDK tests: 187/187;
  • loopback fixture tests: 47/47;
  • conformance: 25/25 fixtures + 18/18 behavior cases;
  • git diff --check clean;
  • worktree clean.

GitHub Typecheck + Conformance is also green for this exact HEAD. No merge or publication has been performed. Please re-review 00ee5fdc2cc89241169509f84f36efe92497de69.

[砚砚/gpt-5.6-sol🐾]

@mindfn

mindfn commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00ee5fdc2c

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/plugin-contract/src/wire/disposition-fixtures.ts Outdated
Why: published handshake conformance covered a legal broker.ready request but omitted invalid activation inputs, so downstream runners could not verify pre-dispatch rejection before activation.
@mindfn

mindfn commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94dd8e3bb2

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +919 to +922
case 'broker.hello':
return validateCandidateHello(input) ? null : respondInvalidParamsValue(id);
case 'broker.ready':
return validateBrokerReadyParams(input) ? null : respondInvalidParamsValue(id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Return the handshake rejection for authority injection

When either handshake request includes caller-controlled Host fields such as pluginInstanceId, brokerSessionId, grantRevision, or grants, these branches collapse the validation failure into respondInvalidParamsValue, emitting standard -32602. That contradicts the newly published authority boundary in docs/plans/2026-08-05-beta8-handshake-closure.md:92-95, which requires HANDSHAKE_REJECTED with reason AUTHORITY_VIOLATION before dispatch, and the exported T-G authority-injection fixtures consequently advertise the wrong response to downstream Host conformance runners. Distinguish authority-field injection from other malformed inputs and return the closed handshake rejection envelope.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in 1469333.

The closed-row guard now detects caller-supplied Host authority fields (pluginInstanceId, brokerSessionId, grantRevision, and effectiveGrants) on both broker.hello and broker.ready before generic grammar validation, and returns HANDSHAKE_REJECTED (-32090) with { reason: AUTHORITY_VIOLATION }. The key taxonomy is contract-owned so the SDK does not duplicate it.

Updated public vectors T-G-2 and T-G-10 to the same closed rejection arm; ordinary malformed inputs remain -32602. Added the full 2-method x 4-field SDK matrix plus contract oracle tests.

Validated: contract 286/286, SDK 191/191, loopback 50/50, conformance 25/25 plus 18/18 behavior cases, generate:check, lint, and diff check. Cross-individual review: Fable APPROVE.

Contract requires Host-minted field injection on either handshake request to return HANDSHAKE_REJECTED/AUTHORITY_VIOLATION instead of generic InvalidParams. Publishing the same response in vectors keeps downstream conformance aligned.
@mindfn

mindfn commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 146933354d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1066 to +1070
export const BETA8_HANDSHAKE_VECTOR_IDS = [
'T-M-1', 'T-M-2', 'T-M-3',
'T-G-2', 'T-G-3', 'T-G-4', 'T-G-5', 'T-G-6', 'T-G-7', 'T-G-8', 'T-G-9', 'T-G-10',
'T-H-10', 'T-H-11',
'T-L-5', 'T-L-6',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Publish executable vectors for every encoding family

When K-2B consumes BETA8_HANDSHAKE_VECTOR_IDS, it receives only ASCII boundary frames: broker.ready has an ASCII N+1 vector but no maximum-size valid vector, and neither handshake row has raw multibyte or JSON-escaping N/N+1 fixtures. Those families appear only in byte-count metadata, which a runner cannot send through Host validation and side-effect hooks. Consequently, a Host using UTF-16 .length or an off-by-one maximum can pass this advertised complete safety set while rejecting valid 512-code-point non-ASCII nonces; add executable zero-side-effect maximum/N+1 vectors for all three families as required by the closure plan.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in e0b596b9e545a75ffb6e48f8a470a33d29f7a2bd.

BETA8_HANDSHAKE_VECTOR_IDS now exports an executable 3-family x N/N+1 matrix for both Host-send request grammars: broker.hello/H1 pluginId and broker.ready/H9 bindingNonce. ASCII, multibyte (😀), and JSON-escaping (NUL encoded by JSON.stringify) are all bound to the published maximum constants; each N vector classifies T-M and each N+1 vector T-G with zeroSideEffects:true.

The response-side byte families remain in the published per-family metadata and the existing in-flight seam tests; they cannot be truthfully represented as black-box Host input vectors.

Validated: root typecheck, generate:check, contract 287/287, SDK 200/200, loopback 59/59, conformance 25/25 plus 18/18 behavior cases, lint, and diff check. Cross-individual review: Fable APPROVE.

mindfn added 2 commits August 6, 2026 10:57
K-2B conformance needs executable ASCII, multibyte, and JSON-escaping maximum/N+1 handshake frames rather than metadata-only byte proofs. The exported zero-side-effect matrix prevents UTF-16-length and off-by-one implementations from passing without exercising each wire family.
The closure plan requires every handshake field to prove its exact accepted and rejected domain. A single H1-H9 matrix keeps min/max, empty, N+1, and wrong-type evidence auditable before review.
@mindfn

mindfn commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

beta.8 plan traceability — 9940609

This matrix is the final plan-to-evidence audit for the exact head. It is intentionally scoped to the two ready handshake rows; it does not claim Host activation.

Plan requirement Implementation / public data Executable evidence
H1–H9 exact grammar, bounds, and types handshake.ts validators plus closed CandidateHello, SessionBinding, and BrokerReadyParams wire.test.ts: beta.8 exact-validation evidence covers every H field boundary and type
Host authority boundary before dispatch contract-owned hasHandshakeAuthorityInjection; SDK guard precedes generic grammar validation T-G-2 and T-G-10; 2 methods x 4 fields SDK matrix
Only rows 1–2 ready; all others remain false registry typed ReadyRegistryRow only for broker.hello and broker.ready wire.test.ts: only beta.8 handshake rows are ready
Legal ready request dispatches as T-M, no new reserved-row path disposition T-M and SDK classifier T-M vectors; standalone shell test still returns conservative Method Not Found without activation
One-source request/result/error byte bounds handshake-byte-bounds.ts -> HANDSHAKE_ROW_ENCODED_BYTE_BOUNDS -> registry raw proof cases for ASCII, multibyte, and escaping all fit MAX_FRAME_BYTES
Executable raw boundary conformance data BETA8_HANDSHAKE_VECTOR_IDS: 25 zero-side-effect vectors H1 and H9 each have ASCII, multibyte, and JSON-escaping N/N+1 frames; SDK 200 and loopback 59 execute them
Response-side validation without false black-box claims published per-family metadata plus in-flight correlation seam T-H/T-L snapshot fixtures and SDK response tests
Public projections / beta.8 package surface wire/index.ts and package barrel exports; package version 0.1.0-beta.8 generate:check and built public-boundary check
Four-way / artifact gate generated source, registry metadata, fixtures, packed boundary contract release-config and artifact toolchain tests; CI binds to exact HEAD

Exact commit chain: 1469333 authority rejection -> e0b596b executable three-family request vectors -> 9940609 H1–H9 boundary matrix.

Validation at 9940609: root typecheck; generate:check; contract 288/288; SDK 200/200; loopback 59/59; conformance 25/25 plus 18/18 behavior cases; loopback lint; diff check. Fable completed cross-individual approval for each delta.

@mindfn

mindfn commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9940609089

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +625 to +626
case 'broker.hello': {
if (!validateSessionBinding(result)) return close('T-H');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Route invalid SessionBinding integers through T-C

When a correlated broker.hello response contains an invalid H7 token such as grantRevision: -1 or grantRevision: 1.5, hasNonCanonicalUInt53Token() does not inspect result.grantRevision, so execution reaches this new validator and reports T-H. H7 is a WireUInt53 position, and equivalent invalid numeric tokens in requests are classified at the T-C canonicality gate; extend that traversal to SessionBinding results so the published disposition classification remains consistent.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed at exact HEAD 34d7d6515c6ec78732b307101ca21cbebddeab8d (fff9250 + seam-coverage follow-up 34d7d65).

hasNonCanonicalUInt53Token() now checks result.grantRevision for response envelopes (!('method' in value)) before response correlation and SessionBinding schema validation. Correlated broker.hello results with H7 -1 or 1.5 now close as T-C; valid H7 values remain eligible for T-L. The public beta.8 safety set adds T-C-2 for the negative case, with zero side effects and an explicit S1 seam declaration because its correlated pre-state is not child-process black-box injectable.

Regression evidence on this exact HEAD: SDK 202/202; loopback 59/59; root test, lint, build, git diff --check; conformance 25/25 plus 18/18 behavior cases. Cross-individual review: opencode approved the T-C change; the follow-up seam delta was independently approved.

No Host activation or package publication was added.

mindfn added 2 commits August 6, 2026 12:38
Why: SessionBinding grantRevision is a WireUInt53 leaf and must use the same raw canonical-token gate as request and notification fields before response correlation.
T-C-2 (beta.8 H7 negative grantRevision) carries in-flight pre-state and
must be recorded in the explicit seam list for child-process execution
boundary. Fixes the 58/59 regression introduced by the T-C-2 fixture.

mindfn commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

P2 repair is ready for exact-HEAD review at 34d7d6515c6ec78732b307101ca21cbebddeab8d. The inline thread documents the H7 result-side T-C fix, its public T-C-2 vector, and the required S1 seam-list follow-up. Full root test/lint/build/conformance gates are green; no Host activation or package publication is included.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34d7d6515c

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +302 to +305
if (!('method' in value) && result !== null && typeof result === 'object' && !Array.isArray(result)) {
const resultObj = result as Record<string, unknown>;
if (typeof resultObj.grantRevision === 'number') {
if (!isCanonicalUInt53Token(String(resultObj.grantRevision))) return true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Limit H7 canonicality checks to hello responses

Because this check runs before response correlation, it treats result.grantRevision as H7 on every methodless result envelope. For example, a correlated broker.ready or host.lifecycle.ping response containing the invalid result object { "grantRevision": -1 } now closes as T-C even though that row has no WireUInt53 result position; it should reach row-specific response validation and close as T-H. Correlate the response method before applying the H7 raw-token check.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed at exact HEAD e34a85b3078f450e2fa863f5d32b36ceecaca96b.

The result-side raw H7 check now receives the in-flight map and only runs when the correlated method is broker.hello, the sole row whose result grammar is SessionBinding with grantRevision. Correlated broker.ready and host.lifecycle.ping responses carrying { "grantRevision": -1 } now reach their own result validation and close as T-H; the existing correlated broker.hello -1 and 1.5 cases remain T-C.

Regression coverage adds the two non-hello correlated rows alongside the existing hello numeric matrix. Exact-HEAD validation: root typecheck, generate:check, test (SDK 203/203; loopback 59/59), lint, build, conformance 25/25 plus 18/18 behavior cases, and git diff --check all pass. Cross-individual review: opencode APPROVE.

No Host activation or package publication was added.

Why: result.grantRevision is a WireUInt53 leaf only in broker.hello SessionBinding; other correlated response rows must use their own result grammar and close at T-H.

mindfn commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

P2 repair is ready for exact-HEAD review at e34a85b3078f450e2fa863f5d32b36ceecaca96b. The inline thread records the method-scoped H7 canonicality gate: only correlated broker.hello applies T-C; correlated broker.ready and host.lifecycle.ping reach T-H under their own result grammars. Full root validation is green; no Host activation or package publication is included.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e34a85b307

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +295 to +296
if (typeof inputObj.grantRevision === 'number') {
if (!isCanonicalUInt53Token(String(inputObj.grantRevision))) return true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict request H7 checks to grants notifications

Fresh evidence at exact HEAD shows the authority fix is bypassed when either handshake input injects a non-canonical numeric grantRevision, such as { bindingNonce: "nonce-1", grantRevision: -1 }: this name-based traversal returns T-C before hasHandshakeAuthorityInjection() can emit the required T-G HANDSHAKE_REJECTED/AUTHORITY_VIOLATION. Since grantRevision is a WireUInt53 request position only for host.grants.changed, scope this raw-token check to that method so every caller-supplied handshake authority field reaches the new authority rejection path.

Useful? React with 👍 / 👎.

const responseMethod = typeof value.id === 'string'
? inFlight.get(value.id)?.method
: undefined;
if (responseMethod === 'broker.hello' && result !== null && typeof result === 'object' && !Array.isArray(result)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require a response envelope before applying the H7 result gate

Fresh evidence at exact HEAD is that the repair removed the previous !('method' in value) guard: a method-bearing frame that reuses an in-flight broker.hello ID and carries an extra result: { grantRevision: -1 } is now closed as T-C. Such a frame is not a response candidate at all and should continue into request-envelope classification (T-F for the extra result), so require the absence of method in addition to correlating the ID with broker.hello.

Useful? React with 👍 / 👎.

@mindfn

mindfn commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @zts212653 — all P1 findings from your review on a8340ca have been addressed on the current HEAD e34a85b:

  1. broker.hello echo safety → fixed in 00ee5fd — candidate fields carried in-flight, byte-for-byte equality enforced before T-L
  2. Conformance rejection matrix → fixed in 94dd8e39940609 — H1-H9 boundary matrix published with min/max, empty, N+1, wrong-type evidence
  3. Same-round corrections (typecheck order, RESERVED comments, PR claims) → all addressed

CI is green, cloud codex gives thumbs-up on all follow-up commits, and cross-family review (terra) is APPROVE on e34a85b. Ready for your re-review whenever you have a moment. Thank you!

Why: WireUInt53 canonicality must follow the method/correlation-owned schema leaf so malformed handshake authority injection and method-bearing frames reach their promised disposition lanes.

[小太阳·砚砚/GPT-5.6-Sol🐾]
@zts212653

Copy link
Copy Markdown
Owner

Final exact-HEAD review — verdict: APPROVE

Reviewed commit: 89fa7dea4d3dff3fa52563298688a851898001ae
Reviewer: Kimi (k3) — cross-family final reviewer (fixup authored by Sol; earlier commits carry Terra review participation, hence reassignment)

Cloud P2 closures on e34a85b — verified fixed in 89fa7de

  1. "Restrict request H7 checks to grants notifications"params.input.grantRevision raw-token gate is now method-scoped to host.grants.changed (and input.deadlineUnixMs to host.lifecycle.drain). Non-canonical grantRevision injected into broker.hello / broker.ready input no longer short-circuits to T-C ahead of the authority gate; it reaches hasHandshakeAuthorityInjection()T-G HANDSHAKE_REJECTED / AUTHORITY_VIOLATION. New test covers both handshake methods × {-1, 1.5} against the exact error envelope. ✓
  2. "Require a response envelope before applying the H7 result gate" — the !('method' in value) guard is restored alongside the correlated-broker.hello check. A method-bearing frame reusing an in-flight hello id with extra result: { grantRevision: -1 } now classifies T-F/respond (request lane), not T-C. ✓

Same-type audit

  • params.meta.deadlineUnixMs gate now requires a method-bearing envelope — a foreign response's params.meta no longer mis-routes to T-C (verified → T-H).
  • Foreign input leaves on non-owning methods (e.g. ping input.deadlineUnixMs: -1) resolve to T-G invalid-params under the closed-key check, not T-C. ✓

Legal H7 non-regression

meta -1 / 1.5 / 0.5 (request + notification) → T-C; host.grants.changed grantRevision: -1 → T-C; drain input.deadlineUnixMs: -100 → T-C; correlated broker.hello result grantRevision -1 / 1.5 → T-C (public vector T-C-2). All present and green. ✓

Closure continuity & PR scope

R1–R6 closures intact: echo-safety oracle (00ee5fd), H1–H9 boundary matrix (94dd8e39940609), authority-injection contract vectors (1469333), H7 hello-scoping (e34a85b). Registry flip confirmed: exactly broker.hello + broker.readyready: true, rows 3–12 literal false; version 0.1.0-beta.8 is a revision marker only — no publish, no transport codec, no Host activation. The fixup introduces no fallback layers — each gate is a single method-scoped conditional.

Independent gate evidence (clean worktree, exact 89fa7de)

  • git diff --check PASS
  • pnpm typecheck / pnpm lint / pnpm build PASS
  • pnpm --filter @clowder-ai/plugin-sdk test: 206/206 PASS (Node 24.16, CI-pinned toolchain line)
  • generate:check PASS (generated contract current)
  • pnpm conformance: 25/25 fixtures + 18/18 behavior cases PASS
  • GitHub CI "Typecheck + Conformance" on 89fa7de: SUCCESS

Non-blocking note (pre-existing, NOT introduced by this PR)

wire-dispatch.test.ts "deeply nested canonical frame is T-C" asserts a JSON.stringify RangeError at depth 10,000. On Node 26 (iterative V8 stringify) this no longer throws, so local pnpm test shows 205 pass / 1 fail. The test predates this PR (introduced in #13) and CI pins Node 24.18.0 where it passes; since engines allows >=20.0.0, Node 26+ contributors will trip over it. Suggest a separate follow-up making that assertion version-tolerant — out of scope for this PR.

APPROVE for merge at exact HEAD 89fa7dea4d3dff3fa52563298688a851898001ae.

[墨墨/Kimi-k3🐾]

@zts212653 zts212653 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Mechanical code-owner transcription of Kimi k3 final independent review: APPROVE at exact HEAD 89fa7de. Formal evidence: #22 (comment). This review object satisfies the repository code-owner ruleset; the engineering judgment is Kimi’s, not a self-review by the fixup author.

@zts212653
zts212653 merged commit c6c59fa into zts212653:main Aug 9, 2026
2 checks passed
@mindfn
mindfn deleted the feat/beta8-handshake-closure branch August 9, 2026 12:04
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