Skip to content

fix: recover missing PR value context and explain failures - #21

Merged
yyeret merged 2 commits into
mainfrom
codex/gemini-context-recovery
Oct 25, 2026
Merged

yyeret merged 2 commits into
mainfrom
codex/gemini-context-recovery

Conversation

@yyeret

@yyeret yyeret commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

PR value assessments can now recover when Gemini truncates the repository's product context. Remaining failures return a specific reason and an analysis ID that connects the API response to safe stage and PR diagnostics.

Context generation starts at 4,096 output tokens and retries once at 8,192 only on MAX_TOKENS, within one 45-second deadline. The prompt requests a concise summary in its own words. Blocked responses, incomplete JSON, and provider errors never become scores. Successful PR assessments survive failures in other PRs. Worker fetches now receive an abort signal when either timeout cancels the request. Every supported failure result includes a stable error code and safe explanation.

Logs record stage, model, attempt, HTTP status, finish reason, token usage, elapsed time, and PR identity where applicable. Credentials, prompts, source text, model output, raw URLs, headers, error bodies, and exception messages are excluded, including from the shared transport's error logs. Existing failed cached results expire within ten minutes; force_refresh: true starts a fresh analysis.

Related: #20, #17. Jev cost-of-delay work in #19 remains separate.

Validation

  • 276 Python tests pass with 94.58% coverage; four frontend tests, Ruff, and all six security stages pass.
  • Regression tests prove truncation recovery, repeated truncation limits, the shared deadline, non-retryable provider failures, local transport timeouts, partial PR success, native Worker console objects, and log redaction. A real HTTPX MockTransport regression verifies dependency request URLs stay out of logs while application INFO diagnostics remain visible; a controlled-clock test rejects a deadline reset between retries. Four Worker transport tests verify abort wiring for request and shared-deadline cancellation while waiting for headers or the response body.
  • A fresh local FastAPI POST /api/analyze using real GitHub and Gemini returned HTTP 200 in 23.39 seconds: 429 merged PRs, 92 active PRs, valid product context, and 22/30 PR assessments. The other eight received Gemini HTTP 429; logs identify their PR numbers and the shared analysis ID. This was not a deployed Workers run.
  • Independent local review completed; its logging finding is fixed and independently rechecked. The Claude peer could not authenticate. Tessl reports no remaining findings, and Python 3.11/3.13 CI, the security audit, and the Cloudflare preview build pass. Native Workers transport cancellation has not been verified at runtime.
  • Earlier live attempts exposed a blocked RECITATION response and a provider HTTP 503; both produced explicit safe diagnostics. Provider availability and quota can still prevent an assessment.

Compound Engineering

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://codex-gemini-context-recovery-github-flow-analytics.yuval-yeret.workers.dev (commit 603005a)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://611c4c60-github-flow-analytics.yuval-yeret.workers.dev 603005a 2026-10-24T17:36:39.633Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://be61991b-github-flow-analytics.yuval-yeret.workers.dev 5b7a530 2026-10-24T17:26:32.560Z Visit the dashboard ↗

@tessl-reviewer tessl-reviewer Bot 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.

Tessl Reviewer

Advisory findings (3)

The context-recovery and diagnostic paths add bounded retries, structured diagnostics, and partial PR-result handling. The Worker transport still leaves timed-out provider work running, and two documented failure-result fields are absent on supported failure paths.

Severity Findings
Major 1
Minor 2

Advisory findings (3)

  • Major · Advisory · Non-blocking · Worker timeouts do not terminate the in-flight Gemini request
    product_value.py:196
  • Minor · Advisory · Non-blocking · The unconfigured product-value result lacks its documented stable error code
    product_value.py:284
  • Minor · Advisory · Non-blocking · Failed individual PR assessments lack the documented safe explanation
    README.md:90

Reviews are incremental. The first review shows every valid finding. A later round checks the latest changes and earlier findings, and adds a fresh finding when it still applies. It never repeats one you refuted or declined. Ask for a full review to inspect the whole change and show earlier findings again.

Mention @tessl-reviewer to run another review.

Comment thread product_value.py Resolved
Comment thread product_value.py Resolved
Comment thread README.md Resolved

@tessl-reviewer tessl-reviewer Bot 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.

Tessl Reviewer

No advisory concerns

No findings to surface.

Earlier findings: 3 addressed

About this review

These findings are AI-generated and not authoritative. Check each one against the code before acting on it. See the guidance on working with this review.

Mention @tessl-reviewer to run another review.

@yyeret
yyeret merged commit 417977a into main Oct 25, 2026
5 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.

1 participant