← Back to Pull requests

fix(agent-mesh): serialize JCS numbers per RFC 8785 #4341

Open
unknown opened this pull request with 380 lines diff across 4 files
View on GitHub
unknown unknown commented on Oct 16, 2026 07:48 UTC
Author

Related Issue

None

Problem & Solution

The approval digest converts integer-valued floats to ints and formats the other floats with repr.

| float | main | RFC 8785 section 3.2.2.3, and this branch |
|---|---|---|
| 1e-06 | 1e-06 | 0.000001 |
| 1e-07 | 1e-07 | 1e-7 |
| 1e21 | 1000000000000000000000 | 1e+21 |
| 1.7976931348623157e308 | a 309-digit integer | 1.7976931348623157e+308 |

This change formats floats the way ECMAScript Number::toString does and leaves integers, strings and key order unchanged.

Impact on Your Work

Float digests match RFC 8785 Appendix B and the a2a-tck vectors, but an approval computed on main over one of these values no longer binds.

Timeline

None

Alternatives Considered

Rounding integers above 253 through a double would let two distinct integers share one digest, so integers stay exact.

Type of Change


  • Breaking change (fix or feature that would cause existing functionality to change)
  • Package(s) Affected


  • agent-mesh
  • Testing

    Unit Testing

    TestJcsNumberSerialization in tests/test_approval_protocol.py pins the 24 Appendix B rows; that file passes 62 of 62, and 16 of its tests fail on main's digest.py.

    Manual Testing

    This branch passes all 53 a2a-tck canonicalization vectors as packaged in agent-evidence-vectors (pip install agent-evidence-vectors==0.18.1), where main fails A5-001, A5-002 and A5-011.

    Checklist


  • I have linked a related issue above, or completed "Problem & Solution", "Impact on Your Work", and "Alternatives Considered"

  • My code follows the project style guidelines (ruff check)

  • I have added tests that prove my fix/feature works

  • All new and existing tests pass (pytest)

  • I have updated documentation as needed

  • I have signed the Microsoft CLA
  • Attribution & Prior Art


  • This contribution does not contain code copied or derived from other projects without attribution

  • Any external projects that inspired this design are credited in code comments or documentation

  • If this PR implements functionality similar to an existing open-source project, I have listed it below
  • Prior art / related projects** (if any):
    RFC 8785 section 3.2.2.3 and Appendix B, and ECMA-262 Number::toString.

    AI Assistance


  • I can explain every meaningful change in this PR: what it does, why, and what tradeoffs were considered

  • I have run tests and verification appropriate for this change

  • No part of this PR was autonomously submitted by an AI agent without my review

  • I have not used AI to generate review comments on others' PRs
  • IP, Patents, and Licensing


  • This contribution does not implement patent-pending or patent-encumbered techniques

  • This contribution does not require an NDA or licensing agreement to understand or use

  • Any AI tools used have terms compatible with the MIT License
  • Diff: 380 lines (+285 / -95) across 4 files Reviewer: MohammadHaroonAbuomar Review duration: 794m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 380 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.356
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #4341"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.9% (MEDIUM) · Higher = larger blast radius
    42.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.9% · Safe to merge
    22.9%