Skip to content

Deduplicate runner envelope and provenance handling - #1914

Merged
mergify[bot] merged 1 commit into
mainfrom
lean178/575-runners-source-dedupe
Nov 26, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
lean178/575-runners-source-dedupe

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Task

Remove 43 counted source lines from runners.py without changing runner behavior, CLI, configuration, state, or tests. Only #1380 touched this file among the 19 open PRs inspected. Its patch still applies cleanly to this change.

Proof

  • Share one envelope-list normalization rule while retaining the ordinary JSON parser for saved settings and the duplicate-key-rejecting parser for native evidence. Read the Claude and Codex settings through their existing sources with the same defaults.
  • Share the Git directory flag list with the individual fallback probes, preserving order and path resolution, and build the Codex argv once for hashing and execution. Keep the same settings, native evidence fields, serialized order, errors and validation.
  • Remove the now-unused private Git directory wrapper. Its only callers were the two fallback probes in runners.py. Remove redundant exception subclass matching and simplify guard layout without removing predicates.
  • All 211 focused tests passed on both versions. No existing assertion was removed or changed. Statements went from 693/856 to 690/853 and branches from 259/380 to 257/378 as duplicate code was consolidated. The same unchanged statements and mappable branch edges were exercised, and every changed statement ran.
  • Before/after differential checks matched 1,050 settings and validation inputs and 16 native and legacy Codex provenance inputs, including exact output and diagnostics. Primary review should also check trust-boundary equivalence for parsing and argv.
  • Full slotted check, primary review, readiness and Mergify merge.

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Validation

Recorded for 1db329d65966

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

Review

  • primary, claude, 1db329d, approve

Architecture-Review: unchanged; runner arguments, review evidence, and acceptance and failure rules retain their existing contracts.
Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics 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.

loopzero primary review by claude on 1db329d65966185facce0687a236ec3be211d81c, 26.4s: approve (0 critical, 0 important, 2 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

Comment thread src/loopzero/runners.py
return {key: _setting(fields.get(key)) for key in ("model", "effort")}


def _read_envelopes(raw, loads=json.loads):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: New shared helper has no type hints, unlike the code around it

_read_envelopes(raw, loads=json.loads) is the one place both trust-boundary parsers now go through: json.loads for saved settings and validation, and _evidence_json, which rejects duplicate keys, for native Codex evidence. Its signature has no annotations, while neighbouring public functions are annotated. I checked behaviour and it matches the old code at every call site: review_settings still catches TypeError/ValueError, validate_runner_result still catches JSONDecodeError/TypeError, and _codex_evidence still catches ValueError. Normalization can't raise, so moving it inside the try blocks changes nothing. Smallest fix: annotate it, e.g. def _read_envelopes(raw: str, loads: Callable[[str], object] = json.loads) -> list[object]:, so it's clear which parser each caller relies on.

Comment thread src/loopzero/runners.py
if (
type(value["version"]) is not int
or value["version"] != 1
if (type(value["version"]) is not int or value["version"] != 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Hand-collapsed conditions now indent inconsistently

Several conditions were folded by hand from the ruff-format style. In _valid_codex_evidence (around lines 645 and 671), the continuation or ... lines start at the same indent as the if body, while validate_runner_result and _codex_evidence use an 8-space hanging indent. Lint passes because E501/E12x are not selected, so this is cosmetic. But if anyone later runs ruff format on the file, it will expand these blocks again and give back most of the line savings. Smallest fix: use one hanging-indent style for the collapsed conditions, or leave formatter-owned blocks as they were and count only the real deduplications (_read_envelopes, _git_dir removal, the single Codex argv, the merged claude/codex pinned branches).

@eowca
eowca marked this pull request as ready for review November 26, 2026 14:06
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as 3201897 at 14:12 UTC

5 min in the queue, 4 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 14:07 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1924
  • ✅ Merged 14:12 · 3201897 · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit 3201897 into main Nov 26, 2026
18 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/575-runners-source-dedupe branch November 26, 2026 14:12
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