Skip to content

Expose exact Catalyst model-request evidence - #23

Merged
pmanko merged 2 commits into
mainfrom
codex/catalyst-exact-request-evidence
Aug 26, 2026
Merged

Expose exact Catalyst model-request evidence#23
pmanko merged 2 commits into
mainfrom
codex/catalyst-exact-request-evidence

Conversation

@pmanko

@pmanko pmanko commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Outcome

  • Return versioned evidence for the exact configured-role request passed to the model: Hub system message, caller messages, profile, role, model, response format, and configured model settings.
  • Bind those inputs with an RFC 8785 canonical SHA-256 digest.
  • Record the exact rendered prompt and token count when the router can provide them, along with the router-advertised context window, the role's existing output allowance, required tokens, and whether the request fits.
  • Record stable reasons when rendering, counting, or capacity is unavailable; do not estimate and do not block an unmeasurable request.
  • Block only a known physical overflow, before the model call, with the same request evidence.
  • Preserve request evidence on backend, empty-content, and malformed-response failures.
  • Preserve the existing token_accounting response shape and leave the raw generic generation endpoint unchanged.

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

  • Focused configured-role tests: 21 passed.
  • Full Hub suite: 706 passed.
  • Black, isort, repository-compatible flake8, and diff checks: clean.
  • Independent final review: no remaining findings.

Copilot AI 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.

🟡 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 new request_evidence response 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.

Comment thread server/generic_role.py Outdated

Copilot AI 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.

🟢 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

@pmanko
pmanko merged commit 939720e into main Aug 26, 2026
5 checks passed
@pmanko
pmanko deleted the codex/catalyst-exact-request-evidence branch August 26, 2026 06:44
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