Expose exact Catalyst model-request evidence - #23
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new best-effort measurement path uses a hardcoded 30s timeout, which can materially delay requests when measurement is unavailable, conflicting with the stated goal of not blocking unmeasurable requests.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR enhances the Hub configured-role generation endpoint to return durable, versioned “request evidence” for the exact model request (inputs + router-provided measurements), including an RFC 8785 canonical SHA-256 digest, and to block only known physical context-window overflows while preserving evidence on failures.
Changes:
- Add router-backed prompt rendering + token measurement (
_prompt_measurement) and include the results in a newrequest_evidenceresponse field. - Canonicalize and digest the exact configured-role request payload (
_request_evidence), and preserve evidence on overflow and backend/malformed response failures. - Expand configured-role test coverage and document the new evidence behavior in the README.
File summaries
| File | Description |
|---|---|
server/generic_role.py |
Adds request evidence construction, prompt measurement, overflow blocking, and failure wrapping to preserve evidence. |
tests/test_generic_role.py |
Updates existing tests and adds coverage for request evidence, measurement behavior, and failure/overflow scenarios. |
README.md |
Documents configured-role request evidence, digesting, and overflow behavior. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟢 Approval recommended
Changes are cohesive, well-covered by focused tests (including failure modes), and preserve the legacy token_accounting response shape while adding the new evidence fields.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
Outcome
This adds no guidance interface, item cap, safety margin, ranking rule, or arbitrary threshold. Catalyst consumption and storage are the next separate dependency step. No live service, data, deployment, seed, or reset was changed.
Verification