Skip to content

Fix repository-wide autoreview findings - #19

Merged
jjjhenriksen merged 1 commit into
mainfrom
codex/autoreview-fixes
Jul 15, 2026
Merged

jjjhenriksen merged 1 commit into
mainfrom
codex/autoreview-fixes

Conversation

@jjjhenriksen

Copy link
Copy Markdown
Owner

Summary

  • harden explanation rate-limit identity handling for Cloudflare deployments
  • prevent unmapped paper selections from producing incorrectly grounded explanations
  • validate and stream uploaded Lean ZIPs with actual output bounds and central-directory reconciliation
  • make proof registry generation, Lean verification deadlines, and live evaluation arguments fail closed
  • override the production ws dependency to a patched release
  • add regression coverage for every accepted finding

Root causes and impact

The repository-wide autoreview found trust-boundary, mapping, archive, subprocess, and CLI validation gaps. These changes prevent client-spoofed rate-limit identities, wrong paper-to-Lean grounding, malformed or oversized archive processing, orphaned verification subprocess trees, silently skipped proof packages, and accidental paid evaluation runs.

One infrastructure follow-up remains explicit: the in-process limiter is not globally shared across Cloudflare isolates. A provider-backed rate-limit binding or shared durable store should replace it before relying on it as the only production quota.

Review disposition

  • Initial complete snapshot: 9 findings; 7 fixed here, 1 retained as an infrastructure follow-up, and 1 rejected after verifying vinext 0.0.50 intentionally uses /_vinext/image.
  • First remediation pass: 2 findings accepted and fixed (process-tree timeout and ZIP container validation).
  • Second remediation pass: 2 containment gaps accepted and fixed (Windows tree termination and streamed-entry reconciliation).
  • The supplied skill limits autonomous review-triggered work to two cycles, so the final corrections were verified manually and with targeted regressions rather than starting a third review loop.

Validation

  • npm test: 31 files, 120 tests
  • npx playwright test --workers=1: 33 passed, 5 skipped
  • npm run typecheck
  • npm run lint
  • npm run proof:validate
  • npm run eval:validate
  • npm run build
  • npm run build:sites
  • npm audit --omit=dev: 0 vulnerabilities
  • git diff --check

@jjjhenriksen
jjjhenriksen marked this pull request as ready for review July 15, 2026 23:09
@jjjhenriksen
jjjhenriksen merged commit 759d08a into main Jul 15, 2026
1 check passed
@jjjhenriksen
jjjhenriksen deleted the codex/autoreview-fixes branch July 15, 2026 23:09

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc57d089c5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/uploads/lean-files.ts
Comment on lines +159 to +160
if (file.name !== validatedEntryNames[streamedEntries]) {
failure = new Error("The ZIP archive could not be safely extracted.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Compare ZIP entries by local offset

When a valid ZIP's central directory is not in the same order as the local file headers, validatedEntryNames is in central-directory order while Unzip emits entries as it streams the local headers. This check then rejects the upload as unsafe even though each central record points at a valid local entry; reconcile the validated entries by localOffset (or by offset) instead of assuming both orders are identical.

Useful? React with 👍 / 👎.

Comment on lines +221 to +222
setSelectionError("That passage could not be matched to the indexed paper text. Try a smaller selection.")
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Dismiss the stale selection on unmatched text

When a user already has a selection menu open and then highlights a passage that resolvePageBlockIds cannot match, this early return only sets the status text; the parent selection is never cleared because onSelection is not called. The old menu stays active and its buttons submit the previous passage, so the explanation can be for text the user no longer selected; notify the parent to dismiss/clear the selection before returning.

Useful? React with 👍 / 👎.

const mapping =
loaded.manifest.mappings.find((item) => item.paper.sourceId === sourceId) ??
loaded.manifest.mappings.find((item) => item.paper.pages.includes(page.number));
const mapping = loaded.manifest.mappings.find((item) => item.paper.sourceId === sourceId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Search all selected blocks for a mapping

For paper selections that start in an unmapped block but include a mapped block—e.g. selecting a heading together with the theorem paragraph—blocks[0] becomes the heading, so this lookup drops the mapping and sends no Lean counterpart even though one of the selected block IDs is mapped. Resolve the mapping from any selected block, or from the block containing the matched text, rather than only the first block.

Useful? React with 👍 / 👎.

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