Skip to content

fix(canon): correct SSE bytes_out claim in telemetry-validation-gate#211

Merged
klappy merged 1 commit into
mainfrom
fix/canon-validation-gate-expected-values
May 16, 2026
Merged

fix(canon): correct SSE bytes_out claim in telemetry-validation-gate#211
klappy merged 1 commit into
mainfrom
fix/canon-validation-gate-expected-values

Conversation

@klappy
Copy link
Copy Markdown
Owner

@klappy klappy commented May 16, 2026

Disposition of Cursor Bugbot finding on PR #210 plus a related factual error caught by smoke evidence.

What Bugbot caught on #210

Bugbot flagged the original procedure step 3 as referring to request_body and response_body (full HTTP bodies including JSON-RPC framing) when the wrapper actually measures JSON.stringify(args) and JSON.stringify(result.content). That finding was addressed in the merged version of #210 before merge.

What this PR fixes

The merged version still contains an SSE claim that contradicts the wrapper's design:

For SSE-streamed responses, expected bytes_out = 0 and tokens_out = 0 per the Emission Contract.

The wrapper measures the in-memory content envelope before MCP transport framing. SSE framing is applied later, on the wire. The wrapper sees the JS object, not the SSE-encoded body. Therefore SSE-transported responses produce non-zero bytes_out at the wrapper.

Smoke evidence (main preview, 2026-05-16 00:30Z)

All 14 successful SSE-framed tool calls in the smoke pass emitted non-zero values:

tool bytes_out tokens_out
oddkit 671 235
oddkit_audit 16,282 4,679
oddkit_catalog 28,593 7,780
oddkit_challenge 20,638 5,221
telemetry_policy 28,014 6,681
... (and 9 others, all non-zero)

Zero SSE responses produced zero emitted bytes_out. The wrapper's in-memory measurement is exactly the failure mode the Emission Contract was written to defeat.

The fix

Replace the wrong SSE caveat with a correct one that names the old wire-edge instrumentation as the source of the "0 for SSE" line in telemetry-governance §Numeric Values.


Note

Low Risk
Low risk documentation-only change; clarifies expected telemetry calculations for SSE-streamed tool responses to avoid incorrect validation outcomes.

Overview
Updates canon/constraints/telemetry-validation-gate.md to remove the claim that SSE-streamed tool responses should emit bytes_out = 0 / tokens_out = 0 during validation.

The gate now explicitly states that the wrapper measures the in-memory { content: [...] } envelope before transport framing, and that the “0 for SSE” caveat applies to legacy wire-edge instrumentation, not the current wrapper.

Reviewed by Cursor Bugbot for commit 81d58d8. Bugbot is set up for automated code reviews on this repo. Configure here.

The original step 3 said "For SSE-streamed responses, expected
bytes_out = 0 and tokens_out = 0 per the Emission Contract." This
contradicts the wrapper's own design: per
klappy://canon/constraints/telemetry-governance §Emission Contract
Rule 2, the wrapper measures the in-memory \`content\` envelope
BEFORE MCP transport framing. SSE-transported responses still produce
non-zero bytes_out and tokens_out at the wrapper.

Smoke evidence (main preview, 2026-05-16 00:30Z): all 14 successful
SSE-framed tool calls emitted non-zero bytes_out (range 288 to 28,593)
and tokens_out (range 121 to 7,780). Zero SSE responses produced zero
emitted bytes_out. The wrapper's in-memory measurement defeats the
SSE-zero failure mode that originally motivated the wrapper.

The "0 for SSE" line in the Numeric Values table of
telemetry-governance refers to the old wire-edge instrumentation, not
the wrapper. The replaced text clarifies this.
@github-actions
Copy link
Copy Markdown

Canon Quality — oddkit_audit

No dead klappy:// references or legacy link patterns found in writings/. 42 files scanned.

Spec: klappy://docs/oddkit/specs/oddkit-audit · Workflow: .github/workflows/canon-quality.yml · Run: #155

@github-actions
Copy link
Copy Markdown

Canon Quality — Frontmatter Schema ✅

All 41 file(s) in writings/ conform to klappy://canon/meta/frontmatter-schema.

Validator: scripts/validate-frontmatter.py · Canon: klappy://canon/constraints/frontmatter-validation-before-merge · Run: #155

@klappy klappy merged commit f67632a into main May 16, 2026
3 checks passed
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