← Back to Pull requests

fix: support retrieval of stored Responses payloads #354

Closed
unknown closed this pull request without merging on Sep 26, 2026 19:34 UTC
View on GitHub
unknown unknown commented on Sep 22, 2026 02:54 UTC
Author

Summary

A response created with store: true could be continued through previous_response_id, but retrieving it with GET /v1/responses/{response_id} returned 404. Add an authenticated retrieval route backed by a typed terminal response snapshot, persisted atomically with the response history. Retrieval preserves this turn's output, status, usage, and IDs without calling the upstream model.

Keep snapshots out of continuation checkpoints and strip request-scoped MCP credentials before persistence. Unknown IDs return a JSON 404; legacy and history-only records return 409 because they lack the original response payload. Document the behavior and expose the endpoint in OpenAPI.

When OIDC is disabled and OPENAI_API_KEY is nonempty, retrieval validates the supplied bearer token locally before reading storage. Missing or invalid credentials return 401; OIDC authentication takes precedence when enabled. Deployments without either authentication option retain unauthenticated access.

Test Plan

  • Reproduced the missing-route regression: the retrieval test expected 200 and received 404 before enabling the route.

  • Run server integration suites for retrieval, incomplete responses, HTTP responses, WebSockets, OpenAPI, OIDC authentication, and conversations.

  • Verify missing, invalid, and valid API keys, OIDC precedence, and retrieval with the upstream offline.

  • Run core unit tests and storage integration tests, including credential sanitization and continuation budgets.

  • Run cargo clippy --workspace --all-targets -- -D warnings and all pre-commit hooks.

  • Live-tested Qwen3.8-27B-FP8 through a separate local gateway: two stored turns round-tripped exactly through GET, and an unknown ID returned JSON 404. Automated tests additionally verify retrieval after gateway restart and with the upstream unavailable.
  • Diff: 230 lines (+172 / -58) across 2 files Reviewer: franciscojavierarceo Review duration: 6760m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.65) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.65 · 230 lines diff across 2 files
    0.65
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    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.326
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.065
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #354"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed sensitive_module
    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: 65.2% (HIGH) · Higher = larger blast radius
    65.2%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 28.2% · Safe to merge
    28.2%