Repository navigation
Finalize U4 reliability and local quality gates - #3
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
@codex security review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7d8dd70c1
ℹ️ 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".
| "subject": str((row.get("run_identity") or {}).get("model_id") or ""), | ||
| "metric": row.get("metric_name"), "value": row.get("value_str"), "unit": row.get("unit"), | ||
| "qualifiers": dict(spec.qualifiers), "ledger_id": spec.ledger_id, | ||
| "ledger_digest": ledger.get("ledger_digest"), | ||
| "evidence_ids": list(row.get("source_evidence_ids") or []), |
There was a problem hiding this comment.
Preserve evidence semantics in generated facts
Include the source row's measurement_kind and run_identity in generated facts. The normal generate_facts output currently omits both, while validate_narrative and the scientific-review checks look for those fields at the fact's top level; consequently, a fact generated from simulated or remapped evidence can be described as a physical measurement without triggering the layer guard, and comparison checks cannot detect incompatible datasets or devices.
Useful? React with 👍 / 👎.
| match = next(( | ||
| x for x in x_rows | ||
| if all(str((dict(x.get("run_identity") or {})).get(k) or "") == str(identity.get(k) or "") | ||
| for k in ("model_id", "seed", "device_id", "precision", "input_size")) | ||
| ), None) |
There was a problem hiding this comment.
Match figure coordinates using the complete run identity
Require the x and y observations to agree on every scientifically relevant run dimension. As written, two rows with the same model, seed, device, precision, and input size but different dataset, split, checkpoint, runtime, batch size, or timing scope are paired into one point; next(...) then silently chooses an arbitrary x row and produces a scientifically invalid correlation.
Useful? React with 👍 / 👎.
| def _load_ledger(root: Path, ledger_id: str) -> dict[str, Any]: | ||
| path = root / ".paperforge" / "ledgers" / ledger_id / "ledger.json" | ||
| if not path.is_file(): | ||
| raise PublicationArtifactError(f"ledger missing: {ledger_id}") | ||
| return json.loads(path.read_bytes().decode("utf-8")) |
There was a problem hiding this comment.
Validate ledger integrity before generating artifacts
Verify the ledger digest, registry entry, and currentness before consuming its rows rather than returning parsed JSON directly. If ledger.json is modified after freezing, table, figure, and fact generation currently accepts the altered values and registers new verified outputs while copying the stale embedded ledger_digest; those outputs can then be used by narrative and result-update APIs without necessarily supplying a separate ledger binding.
Useful? React with 👍 / 👎.
| for cand in _classify_candidates(proposed_block): | ||
| if cand["kind"] == "structural" or cand["text"] in old_texts: | ||
| continue |
There was a problem hiding this comment.
Require bindings for newly duplicated numeric claims
Compare occurrences rather than skipping every candidate whose textual value appeared anywhere in the old block. For example, if the old block contains one 20 ms, a proposal can retain it and add an unrelated Model B recorded 20 ms statement; both candidates are skipped by this set-membership test, so the new scientific claim is validated with no allowlisted fact binding.
Useful? React with 👍 / 👎.
| with memory.connect() as db: | ||
| for key, files in current.items(): | ||
| for rel, actual in files.items(): |
There was a problem hiding this comment.
Reject missing files from approved artifact bindings
Compare the complete expected file set against the current file set before approving or applying a proposal. This loop only visits files that still exist, so deleting a bound artifact member such as facts.json while leaving manifest.json causes the missing expected entry to be ignored and the integrity check to pass, allowing an update whose evidence artifact is incomplete.
Useful? React with 👍 / 👎.
| pages = {r["page"] for r in renders} | ||
| reviewed_any = {r.get("page") for r in human_records if not r.get("stale")} | ||
| if critical or any(r.get("status") == "failed" for r in human_records): | ||
| state = "failed" | ||
| elif needs_human or pages - reviewed_any: | ||
| state = "needs_human" |
There was a problem hiding this comment.
Count only completed human reviews as page coverage
Restrict reviewed_any to current reviews whose status is passed or passed_with_warnings. A caller can currently submit a correctly bound HumanPageReview with the default pending status and no reviewer identity; it counts as coverage, and when there are no critical or needs-human detector findings the bundle is incorrectly emitted with layout_qa_state="passed".
Useful? React with 👍 / 👎.
| # Target PDF still matches? | ||
| target_match = True | ||
| historical = "valid" if digest_valid else "invalid" | ||
| # Human/render currentness sampled from stored hashes (no recomputation of renders here). | ||
| unresolved_critical = list(payload.get("unresolved_critical") or []) | ||
| state = str(payload.get("layout_qa_state") or "") | ||
| from .immutable_artifacts import verify_registered_bundle | ||
|
|
||
| registry = verify_registered_bundle(root, memory, { | ||
| f".paperforge/pdf_qa/{bundle_id}/qa.json": "review", | ||
| f".paperforge/pdf_qa/{bundle_id}/manifest.json": "manifest"}) | ||
| currently_valid = bool(historical == "valid" and registry["registered_complete"]) |
There was a problem hiding this comment.
Recheck the target PDF when verifying QA
Resolve the stored QA spec's target path and hash its current bytes instead of hard-coding target_match and currentness to true. After the PDF changes, verify_pdf_qa still reports currently_valid=True, target_pdf_hash_match=True, and current render/human reviews; in particular, reviewer_matrix._binding_current trusts that result, so a QA binding can remain current for a PDF that was never reviewed.
Useful? React with 👍 / 👎.
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review Please review current head 0af125a. All seven prior findings have local fixes: e5f92a6 binds facts to source semantics, pairs full figure identities, and verifies ledger inputs; 2c59895 enforces artifact member sets and numeric occurrence counts; 761bfa7 keeps pending human gates incomplete and checks actual current PDF bytes. 4506b8b provisions Poppler in all CI platforms; 0c9c9f7 repairs Windows source-byte/newline integrity and portable imported paths. Local evidence: 819 passed, 5 opt-in skips, 0 failures/collection errors; Ruff whole scope and configured mypy pass; sdist/wheel and isolated wheel smoke pass; scoped independent reviews pass. Fresh cross-platform CI and exact-head remote code/security clearance remain pending. No merge or tool freeze is claimed. |
|
@codex security review Please review current head 0af125a, including publication ledger integrity, exact source-byte writes, canonical imported paths, artifact member binding and PDF currentness repairs. The prior no-findings security report applies only to f7d8dd7 and is not being reused as clearance for this head. |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0af125a603
ℹ️ 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".
| ) | ||
| # Group rows. Default forbids silent cross-condition pooling; every | ||
| # allowed dimension must be explicit with intent recorded per row. | ||
| protected = set(CROSSABLE_DIMENSIONS) |
There was a problem hiding this comment.
Keep models separated during aggregation
When an aggregation does not explicitly include model_id in group_by, observations from different models receive the same group key, and this guard does not reject the mixture because CROSSABLE_DIMENSIONS omits model_id. For example, otherwise-identical values 1 and 3 from models A and B produce a single mean of 2, silently corrupting a scientific result instead of requiring an explicit cross-model intent.
Useful? React with 👍 / 👎.
| by_id = {str(r.get("row_id")): r for r in rows} | ||
| selected = [by_id[rid] for rid in spec.row_ids if rid in by_id] if spec.row_ids else list(rows) |
There was a problem hiding this comment.
Filter and pivot table rows by requested metrics
When row_ids is omitted, this selects every ledger row regardless of spec.columns; the later one-to-one mapping creates a table row for each observation and fills only that observation's metric. Thus a latency-only table from a ledger that also contains FPS emits blank FPS-derived rows, while a latency/FPS table emits two sparse rows rather than one row for their shared run identity, producing unusable or misleading publication tables.
Useful? React with 👍 / 👎.
| if key == "model_id" and expected.lower() not in lowered: | ||
| # Model must be named correctly when the fact is model-specific. | ||
| pass | ||
| for _candidate in (f"{key} {expected}", str(expected)): | ||
| pass |
There was a problem hiding this comment.
Reject subject mismatches in grounded narratives
For model-specific facts, the branch that detects the expected model is absent from the sentence is a no-op, as is the following candidate loop. Consequently, a fact for ModelA with value 20 validates the sentence ModelB measured 20 ms. as passed because only the number is checked, allowing a grounded narrative to attribute valid measurements to the wrong subject.
Useful? React with 👍 / 👎.
| if statistical_artifacts: | ||
| return _result("statistical_wording", claim.claim_id, "passed", "typed statistical support present", | ||
| facts_used=tuple(claim.fact_ids)) |
There was a problem hiding this comment.
Bind statistical support before passing claims
For claims containing significance or equivalence wording, any non-empty statistical_artifacts sequence passes this checker without verifying the artifact's metric, subjects, dataset, evidence set, or margin. review_claim invokes this presence-only checker, and the coverage gate does not require the stricter check_statistical_binding, so even an unrelated string can make a statistical-superiority claim receive a fully reviewed verdict.
Useful? React with 👍 / 👎.
| # Text-like formats: record line spans for auditability. | ||
| text, truncated, bytes_read = _read_text_with_budget(data, budget_bytes=per_file) |
There was a problem hiding this comment.
Extract DOCX text before adding it to prompts
For an accepted .docx reference, this non-PDF path decodes the ZIP container bytes directly as UTF-8 instead of extracting document text. The resulting prompt contains archive/XML noise and often truncates before useful prose, so users cannot actually provide DOCX reference context despite that suffix being explicitly accepted by the API and documented workflow.
Useful? React with 👍 / 👎.
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
Verification
Required before tool freeze
Read actual automatic code-review and security-review findings for this exact head commit; resolve blocking findings and repeat checks after each push. No merge is authorized.
Limitations
Single-writer/quiesced repair only; no physical power-loss or concurrent-writer proof. Generated-text validation is not an arbitrary-TeX OS sandbox. No real paper or private shadow artifacts are included; no human review or publication release is fabricated.