Skip to content

Realize fix-release-reachability-race: the remote's answer is fetched before it is compared, and contract-v1.44 carries the bytes - #390

Merged
brettheap merged 5 commits into
mainfrom
change/realize-release-reachability-race
Aug 26, 2026
Merged

brettheap merged 5 commits into
mainfrom
change/realize-release-reachability-race

Conversation

@brettheap

@brettheap brettheap commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Realizes the ratified change fix-release-reachability-race. Does NOT archive
it: the archive gate is merged-plus-green PLUS the contract-v1.44 tag, and the
tag is a post-merge act that is not this session's.

The defect

The release verifier asked the remote a live question and answered it out of a
static object store.
_ls_remote returns what refs/heads/main points at ON
THE REMOTE, right now; _is_ancestor then runs git merge-base --is-ancestor
INSIDE the local clone, against an object the clone may never have seen. A clone
is fixed at the moment it was taken; the remote's refs are not. When main
advances after the checkout, the advertised object is simply absent locally,
merge-base exits 128 rather than 0 or 1, and the guard refuses with commit reachability could not be determined — a fail-closed refusal produced by
somebody else's merge rather than by anything about the candidate.

Measured on this repository's PR #372, a doc-only change, run 32934803039,
three attempts at ONE head commit 5c10ce6d: attempt 1 failed with #365 merging
inside its window, attempt 2 failed with #374 merging inside its window, attempt
3 passed with a quiet window. One tree, three verdicts, decided by what else
landed during an eleven-minute suite.

The fix mechanism

_resolve_remote_object(repo, remote, object_id) — a probe, then a narrow
fetch — called where each remote-derived object id ENTERS the local world rather
than at any one comparison:

  • git cat-file -e <oid>^{object} first, so an already-current clone spends
    0.006s and no network at all. (^{object}, not ^{type} — the latter is
    not git syntax.)
  • Only on absence, git fetch --no-tags --no-write-fetch-head <remote> <oid> —
    the single named object, never a ref. Verified on a live stale clone that
    after the verifier's fetch for-each-ref still listed only
    refs/heads/main and FETCH_HEAD still named the setup fetch's commit: the
    mutation is confined to the object store.
  • Called at three sites covering all four operand uses by construction:
    verify_promotion resolves main_oid before _is_ancestor AND before
    _surface_drift's git ls-tree and per-member blob reads; verify_tag
    resolves peeled_commit and main_oid before _is_ancestor and before
    _verify_release_at walks the tag's tree.
  • _is_ancestor is byte-unchanged, 128-branch refusal included. It is the
    last line of defence and the mutation proof depends on it.

Three outcomes, told apart and named. A candidate genuinely not on published
main keeps its existing refusal finding, unchanged — no finding code is added,
removed, renamed or re-severitied. Transient skew resolves in the fetch and
produces no finding at all. An object that cannot be made available stays a
fail-closed dependency refusal (never a finding, never a pass, never a "not
reachable" verdict invented from an absence), but its reason now names the
retrieval: remote object fetch failed: <remote> <oid> (git exit <n>). It
claims NO cause beyond the failed fetch and its exit status — a fetch can fail
for a refused credential, an unreachable host, a timeout or a remote that
declines the object, and naming one of them unobserved would be the same failure
of diagnosis the message replaces. Subprocess output is deliberately not
embedded: _run_git already raises terse messages with no stderr, and a git
transport error can carry the remote URL. (Narrowed in response to Copilot's
review; the message first read <remote> would not serve <oid> and that review
was right to object.)

Q1 — decided on measurement: NO ref-fetch fallback

tasks.md § 2.1 as authored asked for object-then-ref. The orchestrating
session's ruling made the fallback conditional on a measurement showing the
narrow fetch insufficient. It is sufficient. Against
[email protected]:opensoft/openxFactory.git:

clone object asked for result
--depth 1 of main a commit 25 behind the tip, under no tracked ref rc 0, 4.80s
non-shallow, 1 behind the current tip rc 0, 8.13s
non-shallow, 3 behind the current tip rc 0, 6.55s–8.49s
non-shallow, 8 behind the current tip rc 0, 6.55s

The remote serves a bare object id no tracked ref points at — the whole doubt in
Q1 — and the cost is the SSH handshake and ref negotiation rather than the
object count, so a ref fetch would have bought nothing on cost either while
bringing unrequested history and mutating remote-tracking refs. A remote that
declines to serve an object it advertises is therefore the fail-closed case,
reached with a reason naming the fetch.

Q2 / OD-4 — the offline fixture: measured, and the measurement corrected it

The mechanism as authored does not work. chmod 000 on the bare origin's
whole objects/ directory makes git refuse the path as a repository at all:
git ls-remote itself exits 128 with does not appear to be a git repository,
so a fixture built that way proves the pre-existing "remote main is unavailable"
path — the exact wrong-reason pass § 3.3 warned about.

Revoking read on the single object FILE gives the wanted condition exactly:
ls-remote exits 0 and still advertises the advanced oid, while git fetch <remote> <oid> exits 128 with upload-pack: not our ref. So the real fixture
is KEPT
and the authorized monkeypatch fallback is not used. The proof asserts
the fixture's own soundness inline, so it cannot silently degrade into the
remote-unavailable path later.

The proofs

Six new tests over the module's established _bare_origin pattern, which DRIVE
the condition rather than describing it — a second clone advances the bare
origin's main, so the verifying repository genuinely lacks the advertised
object, asserted before each verdict is asserted.

Written FIRST and failing as predicted: all three skew proofs at
release.py:200 with ReleaseDependencyError: commit reachability could not be determined, the exact CI failure line.

Mutation-pinned twice, because an in-process mutation can be platform-inert:

  1. In-process, kept as a test —
    test_mutation_removing_the_resolution_step_alone_reproduces_the_refusal,
    parametrized [skew] and [surface-drift].
  2. Source-level, run once by hand — all three call sites commented out,
    whereupon all four new proofs failed (the three skew proofs at
    release.py:200, and the unavailable-object proof on assert 'fetch' in message with the message reading commit reachability could not be determined). Source restored and digest-checked.

The release-surface proof asserts exact equality on the whole finding list —
ONE HGR-RELEASE-SURFACE-DRIFT on contracts/manifest.yaml — which is the
assertion that catches the None-comparison hazard: an unresolved main_oid
makes _blob_object_id return None for EVERY surface path, so the false
verdict is drift on all of them and an in assertion would have passed on it.

The contract bundle: contract-v1.44

scripts/hermes_runtime_validation/release.py is a NON-EDITORIAL member of
contract-v1.43's own digest inventory, so editing it without a cut leaves the
declared inventory describing bytes the repository no longer holds — the state
release-surface-integrity names a defect and whose prescribed remedy is a
release cut, never a hand-edit. contract-v1.10 was cut for this same file for
this same cause.

Number allocated here, not reserved in the proposal. Collision check both ways:
git ls-tree origin/main contracts/releases/ ends at contract-v1.43;
git ls-remote --tags origin 'refs/tags/contract-v1.4*' ends at
contract-v1.43; the only open pull request, #176, touches one gate-intent file
and no release surface.

Byte reproduction. build --tag contract-v1.44 run twice, once to the
committed path and once to a scratch path: cmp reports them identical and both
hash to
sha256:4373259689f53699929ac462fde10466902887b7e8c20d0f68e538c9655d4100.
entries=192, the same membership count as contract-v1.43 — nothing joined or
left the bundle. The verifier's recorded digest moves from
sha256:d149a34b9964ba… to sha256:2160dc3b745261…, which is exactly
sha256sum of the tree's release.py. No inventory was hand-edited at any
point.

Class: ADDITIVE (minor). No schema bytes move, contract_schema_version is
unchanged, no instance valid at contract-v1.43 is narrowed, and a consumer
pinned there stays conformant until it upgrades.

Verification evidence

Pipefail on, exit codes unmasked, real numbers.

check result
pytest tests/hermes_runtime_contracts -q -m "not postgres" (CI's selection) 505 passed, 338 deselected in 253.05s (0:04:13), exit 0
pytest tests/hermes_runtime_contracts/test_release_inventory.py -q -m "not postgres" 44 passed (0:01:18) — 38 that existed plus 6 added
pytest tests/hermes_runtime_contracts/test_validator_cli.py -q -m "not postgres" 21 passed (0:02:17), no _run_cli timeout at load average 26
pytest tests/hermes_runtime_contracts/test_acceptance_parity.py -q -m "not postgres" 9 passed — every appended evidence-register node id collects
openspec validate fix-release-reachability-race --strict valid, exit 0
openspec validate --all --strict 78 passed, 0 failed (78 items), exit 0
validate-contract-release.py build --tag contract-v1.44 release build: pass, entries=192; run twice, cmp identical, one digest — rebuilt after the review fix moved the verifier's bytes again
validate-contract-release.py verify-commit --commit HEAD release verify-commit: pass, inventory=contracts/releases/contract-v1.44.digests.yaml, exit 0
pytest tests/ -q -m "not postgres" (CI's second selection) 6494 passed, 15 skipped, 338 deselected, 15 subtests passed in 1081.52s (0:18:01), exit 0, zero failures
wallet-yaml-syntax-gate.py . and validate-openxwallet.py . exit 0; 0 error(s), 0 warning(s) over 17 positives, 36 negative confirmations, 13/13 requirements, 2 wallet artifacts
doc-health.py --single-repo . --family release-inventory-drift exit 0, No findings under release-inventory-drift — the declared inventory describes the tree the repository actually holds
continuous integration, this pull request pytest-suite pass, wallet-validation pass, all checks settled on 6d3fe292 and again on 7723386a
pytest tests/hermes_runtime_contracts -q -m "not postgres" after the review fix 505 passed, 338 deselected in 242.66s (0:04:02), exit 0
pytest tests/doc-health -q -m "not postgres" after the review fix 896 passed (33.28s), exit 0 — the selection that reads the corpus prose these commits change
validate-contract-release.py verify-commit --commit HEAD after the review fix release verify-commit: pass, exit 0

The arithmetic on the first row is itself the evidence. The authoring baseline
in this packet was 1 failed, 498 passed — 499 collected — and it is now 505
passed with the six new proofs added and the one failure gone. The test the
defect fired through, test_validate_candidate_passes_on_the_realized_repository,
passes.

Two known local artifacts did NOT fire on the full run, and that is recorded as
not-fired rather than as not-chased:
test_derivation_reproduces_the_real_bootstrap_clusters RAN and passed from this
worktree — it is the source of the run's single warning, a tarfile
DeprecationWarning, which is how one can tell it executed rather than skipped —
and no _run_cli 30-second timeout occurred at any point.

verify-promotion --commit HEAD --remote origin --tag contract-v1.44 exits
1 with findings, not 2 with a dependency refusal, which is the point: a
definite answer instead of "could not be determined". The findings are exactly
the pre-merge state — HGR-RELEASE-CANDIDATE-UNREACHABLE because the candidate
is not yet on main, and HGR-RELEASE-SURFACE-DRIFT on the three surface
members this cut changes.

Live end-to-end proof, against the canonical remote

The fixtures are deterministic; this one is not, and it is the one that closes
the loop. A non-shallow clone fetched to a commit 8 behind the tip — a
faithful stale full clone, which is what CI has (fetch-depth: 0,
pytest-suite.yml:206) — then validate_realization against the live remote,
same tree, same remote, only release.py swapped:

  • published validator: REFUSED after 12.08s -> commit reachability could not be determined
  • this branch's validator: completed in 24.87s with 0 finding(s)

Review feedback, dispositioned

Copilot raised three comments and all three are answered in the thread.

  • The fetch-failure message asserted a cause it had not observed — accepted
    and fixed, see above. It was the same fault the delta names, one surface over.
  • The shallow-clone hazard, twice — real, and measured independently before
    the review. Initially deferred with the closing rule written down; Brett then
    ruled on 2026-08-26 that it be folded in, so it is fixed here in
    d548d04d. See "Resolved by ruling" below.

Resolved by ruling — the shallow-clone verdict, folded in

This section was a flag. Brett ruled on 2026-08-26 (multi-choice, recommended
option) that the rule be folded into this pull request rather than deferred, so
it is implemented here, in d548d04d.

The hazard. Resolving the operand makes the OBJECT present; it does not make
the ANCESTRY present. A shallow clone's graft boundary declares its oldest
commits parentless, so git merge-base --is-ancestor returns a definite 1
for a commit that is reachable on the real history — and the resolution step, by
getting past the 128, delivers the run to that false answer. MEASURED against the
canonical remote in a --depth 1 clone: the published validator refuses with
commit reachability could not be determined, and the fix alone reported a FALSE
HGR-RELEASE-TAG-UNREACHABLE. Raised independently by Copilot's review, which is
two arrivals at the same finding.

The rule is the asymmetry. A POSITIVE ancestry answer is trustworthy in any
store, because a path git found is a path that exists and truncation can only
hide paths, never invent them. A NEGATIVE answer is precisely what truncation
manufactures. So only the negative is re-examined:

    if not _is_ancestor(repo_root, commit_oid, main_oid):
        _refuse_unreachable_in_a_shallow_clone(repo_root, commit_oid, main_oid)
        findings.append(_finding("HGR-RELEASE-CANDIDATE-UNREACHABLE", ...))
def _refuse_unreachable_in_a_shallow_clone(repo, ancestor, descendant) -> None:
    result = _run_git(repo, "rev-parse", "--is-shallow-repository", allow_failure=True)
    if result.returncode != 0 or str(result.stdout).strip() != "true":
        return
    raise ReleaseDependencyError(
        "ancestry cannot be judged in a shallow clone: "
        f"{ancestor} against {descendant}"
    )

Same guard before HGR-RELEASE-TAG-UNREACHABLE in verify_tag. NOT inside
_is_ancestor, which stays byte-unchanged against origin/main because
tasks.md § 2.4 requires it and a mutation proof depends on its 128 branch. The
budget cost is one local rev-parse on a branch the ordinary case never enters:
no network, nothing added to either 30-second cap on the common path.

One cost, accepted rather than engineered around. A shallow clone holding a
genuinely unreachable candidate takes the refusal too, so a shallow verification
can no longer emit either UNREACHABLE code. The verifier cannot tell an earned
negative from an artefact of its own store, and a verification that cannot
establish which of the two it holds has earned neither verdict. Exit 2 where exit
1 stood — both block, and only one is honest about why. Deepen the clone, or
verify from a full one.

Canon moved with the code. Requirement 2 of the spec delta gains a fourth
scenario, A truncated history returns a negative it cannot earn, plus its
governing prose — requirement 2 owns the taxonomy of unanswered outcomes, and a
truncated history is a fourth way the question goes unanswered.

Three proofs, over a REAL --depth 1 clone (which needs a file:// URL,
since git ignores --depth on a plain local path):

  • test_verify_tag_refuses_a_negative_verdict_a_shallow_clone_cannot_earn — the
    tag sits at published main's own parent, so it is genuinely reachable;
    asserts the shallow refusal, asserts UNREACHABLE is absent from the message,
    and asserts a FULL clone of the same origin returns == [].
  • test_verify_promotion_refuses_a_negative_verdict_in_a_shallow_clone — the
    candidate call site, with a full-history oracle asserting the negative is
    genuinely earned.
  • test_a_shallow_clone_still_answers_when_merge_base_can_say_yes — pins the
    asymmetry, and is why the guard is not a blanket refusal.

Both refusal proofs are mutation-pinned at source level: neutralize the two
call sites and both fail DID NOT RAISE, while the asymmetry proof still passes.
All three are bound in contracts/hermes-runtime/evidence-register.yaml under
SCO-002-S04 (the refusals) and SCO-002-S02 (the asymmetry). tasks.md § 6.4
is ticked with the ruling recorded in place, and design.md § 5 keeps the
original deferral entry alongside the ruling, because the measurement is the
reason the rule exists.

Re-verified after the fold-in (release.py bytes moved again, so the
inventory was rebuilt over them):

check result
pytest tests/hermes_runtime_contracts -q -m "not postgres" 508 passed, 338 deselected in 285.07s (0:04:45), exit 0 — 505 plus the three shallow proofs
pytest tests/hermes_runtime_contracts/test_validator_cli.py -q -m "not postgres" 21 passed (0:02:11), exit 0
openspec validate fix-release-reachability-race --strict / --all --strict valid / 78 passed, 0 failed
doc-health.py --single-repo . --family release-inventory-drift No findings
wallet gates exit 0; 0 error(s), 0 warning(s)
build --tag contract-v1.44 twice + cmp identical, entries=192, one digest; release.py digest now sha256:660e55ca…
verify-commit --commit HEAD release verify-commit: pass, exit 0
pytest tests/ -q -m "not postgres" 6497 passed, 15 skipped, 338 deselected, 15 subtests passed in 1178.25s (0:19:38), exit 0 — 6494 plus the three shallow proofs
continuous integration on d548d04d pytest-suite pass (13m10s), wallet-validation pass, all checks settled

Two notes on this pull request's own continuous integration

It runs the NEW validator, so it should be immune to the race it fixes. If
its pytest suite reds with commit reachability could not be determined, the fix
is incomplete and wants investigation rather than a re-run.

But be precise about WHY it is immune, because the pre-tag window is a weaker
test than it looks.
With the manifest now at contract-v1.44 and no such tag
published yet, verify_tag returns HGR-RELEASE-TAG-MISSING and short-circuits
before it reaches the ancestor check at all. So this run does not exercise the
resolved operand on the live remote — the live-remote exercise resumes once the
contract-v1.44 tag is pushed, and the evidence that it works there is the
stale-full-clone measurement above rather than this run.

Not done here, on purpose

  • No merge, no tag, no archive. The annotated contract-v1.44 tag on the
    merge commit (tasks.md § 4.6), the post-tag verify-promotion/verify-tag
    (§ 4.5), the aggregation submodule pointer sync (§ 4.7) and the archive act
    (§ 5.6) all belong to the post-merge cut.
  • tasks.md § 5.4 is left unticked with its reason, not quietly ticked:
    three full-suite runs each with a merge landing inside its window cannot be
    arranged on demand. The deterministic fixtures and the live proof above are
    offered as the substitute, and the many-runs-identical claim is recorded as
    unproven.
  • tasks.md § 6.4 is no longer among these — it was folded in by ruling, and
    is ticked. § 6.1, § 6.2 and § 6.3 stand open as authored.
  • tasks.md § 6.1's sweep is still not performed. Whether
    consumer_handoff.py mixes a live remote read with a local resolve remains
    unmeasured, and this change claims nothing about it.

Realizes fix-release-reachability-race.

brettheap and others added 2 commits August 26, 2026 15:03
The release verifier asked the remote a live question and answered it out of
a static object store: `_ls_remote` named what `refs/heads/main` points at on
the remote right now, and `_is_ancestor` then ran `git merge-base
--is-ancestor` inside a clone that may never have seen that object. When main
advanced after the checkout the object was simply absent, merge-base exited
128 rather than 0 or 1, and the guard refused with "commit reachability could
not be determined" — a fail-closed refusal produced by somebody else's merge.
Measured on PR #372: one tree, three attempts, two failures each with a merge
inside its window, one pass with a quiet one.

The obligation moves to the operand. `_resolve_remote_object` probes with
`git cat-file -e <oid>^{object}` — 0.006s and no network on an already-current
clone — and only on absence fetches the single named object with `--no-tags
--no-write-fetch-head`, so the mutation is confined to the object store and
the clone's refs are left alone. It is called where each remote-derived id
enters the local world, which covers all four readers by construction: the
candidate ancestor check, the release-surface comparison and its per-member
blob reads, the published-tag ancestor check, and the tag's tree walk.
`_is_ancestor` is byte-unchanged; its 128 branch is the last line of defence.

Three outcomes are now told apart. A candidate genuinely off published main
keeps its existing refusal finding. Transient skew resolves in the fetch and
produces no finding. An object that cannot be retrieved stays a fail-closed
dependency refusal, never a finding and never a verdict invented from an
absence, but its reason names the retrieval instead of announcing the
verifier's own uncertainty.

Q1 decided on measurement rather than on caution: no ref-fetch fallback. The
canonical remote served a bare object id under no tracked ref in 4.80s from a
depth-1 clone and in 6.55-8.49s from stale full clones, and the cost is the
handshake rather than the object count, so a ref fetch would have bought
nothing while bringing history nobody asked for.

Q2's fixture mechanism was measured and the measurement corrected it. Chmod
000 on the whole bare `objects/` directory makes git refuse the path as a
repository, so ls-remote itself exits 128 and the fixture would have proved
the pre-existing remote-unavailable path. Revoking read on the single object
file keeps advertisement working while upload-pack answers "not our ref",
which is the condition wanted, so the real fixture is kept and the authorized
monkeypatch fallback is unused.

Six proofs drive the condition instead of describing it: a second clone
advances the bare origin's main so the verifying repository genuinely lacks
the advertised object. Two skew proofs, one release-surface proof asserting
exact equality on the whole finding list so a false drift on every surface
path cannot slip through, one unavailable-object proof, and a two-case
mutation proof. Pinned twice — in-process and by commenting out the call
sites, where all four failed at release.py:200.

The verifier is a non-editorial member of its own inventory, so the bytes
moving owes a cut. contract-v1.44, additive: no schema bytes, no schema
version advance, no instance valid at contract-v1.43 narrowed, 192 entries as
before, built twice to one digest and never hand-edited. The tag belongs to
the post-merge cut.

Realizes fix-release-reachability-race. Does not archive it.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 26, 2026 19:05

@sourcery-ai sourcery-ai 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.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

Copilot AI 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.

Pull request overview

This PR realizes the fix-release-reachability-race change by ensuring any remote-derived Git object IDs (remote main tip and advertised tag targets) are fetched into the local object store before running local ancestry/tree/blob operations, eliminating nondeterministic “object missing” refusals caused by mid-run remote advancement.

Changes:

  • Add _resolve_remote_object() to probe (git cat-file -e) and, if needed, narrowly fetch (git fetch --no-tags --no-write-fetch-head <remote> <oid>) remote-derived objects before they are consumed locally.
  • Call the resolver at the operand-entry points in verify_promotion() and verify_tag() so all downstream reads (ancestor check, surface drift, tag tree walk) are covered.
  • Add regression tests that drive mid-run skew and unservable-object scenarios; bind new proofs into the Hermes runtime evidence register; cut contract-v1.44 to carry the updated validator bytes.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/hermes_runtime_validation/release.py Introduces _resolve_remote_object() and resolves remote-derived operands before local ancestry/tree/blob reads.
tests/hermes_runtime_contracts/test_release_inventory.py Adds fixtures + tests that deterministically reproduce skew/unservable-object cases and pin the fix via mutation checks.
contracts/hermes-runtime/evidence-register.yaml Registers the new tests under existing SCO-002 scenarios so parity/collection gates include them.
contracts/manifest.yaml Bumps contract_bundle_version to contract-v1.44.
contracts/CHANGELOG.md Documents the additive contract-v1.44 release and why the cut is required.
contracts/releases/contract-v1.44.digests.yaml Adds the new digest inventory for contract-v1.44 to carry updated validator bytes.
openspec/changes/fix-release-reachability-race/tasks.md Marks realization tasks as completed and records measured decisions/outcomes.
openspec/changes/fix-release-reachability-race/design.md Appends realization-time measurement results and the shallow-clone note.
README.md Updates the active-change index entry to reflect realization as contract-v1.44 and summarize the mechanism/proofs.
Suppressed comments (1)

scripts/hermes_runtime_validation/release.py:251

  • If the post-fetch cat-file confirmation fails, the current message doesn’t include any details from the failing git invocation. Adding rc/stderr will make it much easier to diagnose cases where the fetch succeeded but the object still can’t be resolved locally.
    if confirm.returncode != 0:
        raise ReleaseDependencyError(
            f"remote object fetch did not provide {object_id} from {remote}"
        )

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +241 to +244
if fetch.returncode != 0:
raise ReleaseDependencyError(
f"remote object fetch failed: {remote} would not serve {object_id}"
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted and fixed. You are right that the message asserted a cause it had not observed, which is the exact fault the delta this change realizes names ("a reason that guesses is worse than a reason that names"). The reason now reads remote object fetch failed: <remote> <oid> (git exit <n>) — it names the fetch, the remote, the object and git's exit status, and claims nothing about why.

One deliberate departure from your suggestion: the captured stderr is NOT embedded. Two reasons. _run_git in this module already raises deliberately terse messages with no subprocess output (Git command failed, remote main is unavailable), so embedding it here would break the family's convention in one place only. And a git transport error can carry the remote URL, which is not something a governance dependency error should be free to reprint. The exit status plus the named retrieval gives the reader the discrimination canon actually requires — check the network or the credential, rather than check the candidate.

Recorded in contracts/CHANGELOG.md and at tasks.md § 3.3, both citing this review.

Records the realization verification in tasks.md rather than leaving it only in
the pull request: the second continuous-integration selection (tests/ at 6494
passed, 15 skipped, zero failures, with both known local artifacts recorded as
not-fired rather than not-chased), the two wallet gates, and the verify-commit /
verify-promotion outputs. verify-promotion exits 1 with findings rather than 2
with a dependency refusal, which is itself the fix working: a definite answer
where the published code could only say the question was unanswerable.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 26, 2026 19:24

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

tests/hermes_runtime_contracts/test_release_inventory.py:982

  • The fixture restores unreadable object files to a hard-coded mode (0o644). Even though this is under tmp_path, forcing permissions can still be brittle (umask differences, pack files often being 0444, and potential future additions like .idx handling). Safer is to capture and restore the original mode(s) for each path you chmod.
    finally:
        for path in revoked:
            path.chmod(0o644)
    message = str(excinfo.value)

Comment on lines +784 to 787
_resolve_remote_object(repo_root, remote, main_oid)

if not _is_ancestor(repo_root, commit_oid, main_oid):
findings.append(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct, measured independently before this review, and deliberately NOT fixed here — with the rule you propose written down for a ruling rather than left implicit.

MEASURED 2026-08-26 against the canonical remote, in a --depth 1 clone of main: the published validator refuses with commit reachability could not be determined (128, object absent), and this branch fetches the object, reaches merge-base, and gets rc 1 out of a grafted history — a false HGR-RELEASE-TAG-UNREACHABLE on a tag that is perfectly reachable. So the hazard is real and it is stated plainly in the pull request body under "Flagged", not buried.

Why it is not closed in this pull request:

  • Both workflows that run this suite check out at fetch-depth: 0 (pytest-suite.yml:206, doc-health-reusable.yml:813), so no measured run is shallow. The faithful reproduction of the defect this change fixes needed a NON-shallow stale clone, and there the new code completes with zero findings.
  • The hazard pre-exists this change in kind: a shallow clone that held the object but not the connecting history already got a false rc 1. What this change does is widen how often the comparison is REACHED in a truncated store.
  • This realization was commissioned against a task list with four decisions already ruled and a standing instruction not to add mechanism beyond what a measurement forces. Adding a refusal path for a population nobody has measured failing would be a fifth decision taken unbidden, and it would change the verdict for shallow users who legitimately get a correct negative today.

The rule, recorded at tasks.md § 6.4 so it can be accepted or declined on this evidence rather than re-derived: a POSITIVE ancestor verdict is trustworthy in any store, because a path git found is a path that exists; a NEGATIVE verdict in a shallow store is not. So refuse — as a dependency refusal naming the truncated history — only when _is_ancestor returns false AND git rev-parse --is-shallow-repository says true, at the two call sites rather than inside _is_ancestor, whose 128 branch § 2.4 protects and a mutation proof depends on. One local git call, no network, no widening.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Resolved by ruling, and fixed in d548d04d. Brett ruled on 2026-08-26 (multi-choice, recommended option) that this be folded into #390 rather than deferred to its own packet, so the rule from tasks.md § 6.4 is now implemented exactly as it was specced there — your reading of the hazard was right, and it arrived twice independently: measured here against the canonical remote in a --depth 1 clone, and by your review.

_refuse_unreachable_in_a_shallow_clone(repo, ancestor, descendant) runs git rev-parse --is-shallow-repository and, when it answers true, raises ReleaseDependencyError("ancestry cannot be judged in a shallow clone: <ancestor> against <descendant>"). It is called ONLY on the FALSE branch of the two _is_ancestor call sites — before HGR-RELEASE-CANDIDATE-UNREACHABLE in verify_promotion and before HGR-RELEASE-TAG-UNREACHABLE in verify_tag — and NOT inside _is_ancestor, which stays byte-unchanged against origin/main because a mutation proof depends on its 128 branch.

The asymmetry is deliberate and is what keeps this cheap: a POSITIVE verdict is honoured in any store, because a path git found is a path that exists and truncation can only hide paths, never invent them. Only the negative is re-examined, so the cost is one local rev-parse on a branch the ordinary case never enters — no network, and nothing added to the 30-second budget on the common path.

One consequence is accepted on the record rather than engineered around: a shallow clone holding a GENUINELY unreachable candidate now takes the refusal as well, so a shallow verification can no longer emit either UNREACHABLE code. The verifier cannot distinguish an earned negative from an artefact of its own store, and a fail-closed refusal naming the truncation is honest about both.

Proofs, over a real --depth 1 clone (which needs a file:// URL, since git ignores --depth on a plain local path):

  • test_verify_tag_refuses_a_negative_verdict_a_shallow_clone_cannot_earn — the tag IS at published main's own parent, so it is genuinely reachable; asserts the shallow refusal, asserts UNREACHABLE is absent from the message, and asserts a FULL clone of the same origin returns == [].
  • test_verify_promotion_refuses_a_negative_verdict_in_a_shallow_clone — the candidate path, with a full-history oracle asserting the negative is genuinely earned.
  • test_a_shallow_clone_still_answers_when_merge_base_can_say_yes — pins the asymmetry.

Both refusal proofs are mutation-pinned at source level: neutralize the two call sites and both fail DID NOT RAISE, while the asymmetry proof still passes. Canon moved too — requirement 2 of the spec delta gains a fourth scenario, A truncated history returns a negative it cannot earn, and the three tests are bound in contracts/hermes-runtime/evidence-register.yaml under SCO-002-S04 and SCO-002-S02.

tests/hermes_runtime_contracts -m "not postgres": 508 passed, exit 0. openspec validate --all --strict: 78 passed, 0 failed. contract-v1.44 inventory rebuilt over the moved bytes, built twice to one digest, verify-commit pass.

Comment on lines +874 to 876
_resolve_remote_object(repo_root, remote, main_oid)
if not _is_ancestor(repo_root, peeled_commit, main_oid):
findings.append(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct, measured independently before this review, and deliberately NOT fixed here — with the rule you propose written down for a ruling rather than left implicit.

MEASURED 2026-08-26 against the canonical remote, in a --depth 1 clone of main: the published validator refuses with commit reachability could not be determined (128, object absent), and this branch fetches the object, reaches merge-base, and gets rc 1 out of a grafted history — a false HGR-RELEASE-TAG-UNREACHABLE on a tag that is perfectly reachable. So the hazard is real and it is stated plainly in the pull request body under "Flagged", not buried.

Why it is not closed in this pull request:

  • Both workflows that run this suite check out at fetch-depth: 0 (pytest-suite.yml:206, doc-health-reusable.yml:813), so no measured run is shallow. The faithful reproduction of the defect this change fixes needed a NON-shallow stale clone, and there the new code completes with zero findings.
  • The hazard pre-exists this change in kind: a shallow clone that held the object but not the connecting history already got a false rc 1. What this change does is widen how often the comparison is REACHED in a truncated store.
  • This realization was commissioned against a task list with four decisions already ruled and a standing instruction not to add mechanism beyond what a measurement forces. Adding a refusal path for a population nobody has measured failing would be a fifth decision taken unbidden, and it would change the verdict for shallow users who legitimately get a correct negative today.

The rule, recorded at tasks.md § 6.4 so it can be accepted or declined on this evidence rather than re-derived: a POSITIVE ancestor verdict is trustworthy in any store, because a path git found is a path that exists; a NEGATIVE verdict in a shallow store is not. So refuse — as a dependency refusal naming the truncated history — only when _is_ancestor returns false AND git rev-parse --is-shallow-repository says true, at the two call sites rather than inside _is_ancestor, whose 128 branch § 2.4 protects and a mutation proof depends on. One local git call, no network, no widening.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Resolved by ruling, and fixed in d548d04d. Brett ruled on 2026-08-26 (multi-choice, recommended option) that this be folded into #390 rather than deferred to its own packet, so the rule from tasks.md § 6.4 is now implemented exactly as it was specced there — your reading of the hazard was right, and it arrived twice independently: measured here against the canonical remote in a --depth 1 clone, and by your review.

_refuse_unreachable_in_a_shallow_clone(repo, ancestor, descendant) runs git rev-parse --is-shallow-repository and, when it answers true, raises ReleaseDependencyError("ancestry cannot be judged in a shallow clone: <ancestor> against <descendant>"). It is called ONLY on the FALSE branch of the two _is_ancestor call sites — before HGR-RELEASE-CANDIDATE-UNREACHABLE in verify_promotion and before HGR-RELEASE-TAG-UNREACHABLE in verify_tag — and NOT inside _is_ancestor, which stays byte-unchanged against origin/main because a mutation proof depends on its 128 branch.

The asymmetry is deliberate and is what keeps this cheap: a POSITIVE verdict is honoured in any store, because a path git found is a path that exists and truncation can only hide paths, never invent them. Only the negative is re-examined, so the cost is one local rev-parse on a branch the ordinary case never enters — no network, and nothing added to the 30-second budget on the common path.

One consequence is accepted on the record rather than engineered around: a shallow clone holding a GENUINELY unreachable candidate now takes the refusal as well, so a shallow verification can no longer emit either UNREACHABLE code. The verifier cannot distinguish an earned negative from an artefact of its own store, and a fail-closed refusal naming the truncation is honest about both.

Proofs, over a real --depth 1 clone (which needs a file:// URL, since git ignores --depth on a plain local path):

  • test_verify_tag_refuses_a_negative_verdict_a_shallow_clone_cannot_earn — the tag IS at published main's own parent, so it is genuinely reachable; asserts the shallow refusal, asserts UNREACHABLE is absent from the message, and asserts a FULL clone of the same origin returns == [].
  • test_verify_promotion_refuses_a_negative_verdict_in_a_shallow_clone — the candidate path, with a full-history oracle asserting the negative is genuinely earned.
  • test_a_shallow_clone_still_answers_when_merge_base_can_say_yes — pins the asymmetry.

Both refusal proofs are mutation-pinned at source level: neutralize the two call sites and both fail DID NOT RAISE, while the asymmetry proof still passes. Canon moved too — requirement 2 of the spec delta gains a fourth scenario, A truncated history returns a negative it cannot earn, and the three tests are bound in contracts/hermes-runtime/evidence-register.yaml under SCO-002-S04 and SCO-002-S02.

tests/hermes_runtime_contracts -m "not postgres": 508 passed, exit 0. openspec validate --all --strict: 78 passed, 0 failed. contract-v1.44 inventory rebuilt over the moved bytes, built twice to one digest, verify-commit pass.

Copilot's review of #390 caught the new message asserting a cause nobody
observed: "remote would not serve <oid>" is one of four things a failed fetch
can mean, the others being a refused credential, an unreachable host and a
timeout. Naming the wrong one sends the reader to the wrong place, which is the
exact fault the delta this change realizes calls out — a reason that guesses is
worse than a reason that names.

The reason now reads `remote object fetch failed: <remote> <oid> (git exit
<n>)`. It names the retrieval, the remote, the object and git's exit status, and
claims nothing beyond them. Subprocess output stays out on purpose: `_run_git`
already raises deliberately terse messages with no stderr, and a git transport
error can carry the remote URL, which a governance dependency error has no
business reprinting.

The proofs are unaffected — they assert the message names the fetch and the oid
and does NOT announce that reachability could not be determined, all of which
still holds. The verifier's bytes moved again, so the contract-v1.44 inventory is
rebuilt over them: entries=192 unchanged, built twice to one digest, never
hand-edited.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 26, 2026 19:43

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Suppressed comments (3)

Previously missed (2) — in code that hasn't changed since the last review.

tests/hermes_runtime_contracts/test_release_inventory.py:954

  • The fixture makes object files unreadable via chmod(0o000) but doesn’t preserve the original permissions, forcing callers to guess how to restore them. This can leave the bare origin in an unexpected state and make the test flaky across platforms/umasks. Capture the original mode before revoking read and return it so the caller can restore exactly.

This issue also appears on line 972 of the same file.

    assert revoked, "the fixture found no object file to make unreadable"
    for path in revoked:
        path.chmod(0o000)
    return revoked

contracts/CHANGELOG.md:20

  • Typo: “re-severitied” isn’t a standard spelling and reads like a misspelling of “re-severitized”.
upgrades. No finding code is added, removed, renamed or re-severitied, and

tests/hermes_runtime_contracts/test_release_inventory.py:973

  • The cleanup restores unreadable object files to a hard-coded 0o644, which may not match the repository’s original object/pack file permissions (often read-only). Restore the exact modes captured when revoking read so the fixture is reversible.
    revoked = _revoke_read_on_the_remote_object(origin, advanced)
    try:

Ruled by Brett on 2026-08-26: fold this in rather than defer it. Fetching the
operand made the object present and left the ancestry absent. A shallow clone's
graft boundary declares its oldest commits parentless, so merge-base returns a
definite 1 for a commit that is reachable on the real history — and the
resolution step, by getting past the 128, delivered the run to that false
answer. Measured against the canonical remote in a depth-1 clone, and raised
independently by Copilot's review of #390, which is two arrivals at the same
finding.

The rule is the asymmetry. A positive ancestry answer is trustworthy in any
store, because a path git found is a path that exists and truncation can only
hide paths, never invent them. A negative answer is precisely what truncation
manufactures. So only the negative is re-examined:
_refuse_unreachable_in_a_shallow_clone runs one local rev-parse on the false
branch of each ancestor check and, in a truncated store, refuses with "ancestry
cannot be judged in a shallow clone" instead of emitting the unreachable
finding. Nothing on the ordinary path, no network, and _is_ancestor is still
byte-unchanged against origin/main — the guard sits at the two call sites, where
§ 2.4 requires it.

One cost is accepted rather than engineered around. A shallow clone holding a
genuinely unreachable candidate takes the refusal too, so a shallow
verification can no longer emit either UNREACHABLE code. The verifier cannot
tell an earned negative from an artefact of its own store, and a verification
that cannot establish which of the two it holds has earned neither verdict.
Exit 2 where exit 1 stood; both block, and only one is honest about why.

Canon moves with the code: requirement 2 gains a fourth scenario, because a
truncated history is a fourth way the question goes unanswered and requirement 2
owns that taxonomy. Three proofs over a real depth-1 clone pin the two refusals
and the asymmetry, the two refusals are mutation-pinned at source level, and all
three are bound in the evidence register. The verifier's bytes moved again, so
the contract-v1.44 inventory is rebuilt over them: 192 entries, built twice to
one digest, never hand-edited.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 26, 2026 20:58

Copilot AI 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.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Suppressed comments (3)

Previously missed (1) — in code that hasn't changed since the last review.

tests/hermes_runtime_contracts/test_release_inventory.py:945

  • The fixture changes object/pack permissions to 0o000 but restores them to a hard-coded 0o644. Git object/pack files are typically read-only, and hard-coding a new mode can leave the temporary bare repo in a non-default state (and makes debugging permission-related failures harder). Capture and restore each path’s original mode instead.

This issue also appears on line 988 of the same file.

def _revoke_read_on_the_remote_object(origin: Path, object_id: str) -> list[Path]:
    """Leave the bare origin's refs readable while its objects cannot be served.

    MEASURED 2026-08-26 (the measurement `tasks.md` § 3.3 asked for): `chmod
    000` on the whole `objects/` directory -- the mechanism that task proposed

scripts/hermes_runtime_validation/release.py:259

  • This follow-up dependency error also includes the raw remote argument in its message. For the same reason as above (--remote can be a URL/path), this risks leaking sensitive remote details into errors. Consider removing the remote from the message or sanitizing it consistently with the other fetch-failure message.
        raise ReleaseDependencyError(
            f"remote object fetch did not provide {object_id} from {remote}"
        )

tests/hermes_runtime_contracts/test_release_inventory.py:990

  • After changing _revoke_read_on_the_remote_object to return original modes, the restore loop should apply those stored modes rather than a hard-coded permission.
    finally:
        for path in revoked:
            path.chmod(0o644)

Comment on lines +249 to +252
raise ReleaseDependencyError(
f"remote object fetch failed: {remote} {object_id} "
f"(git exit {fetch.returncode})"
)
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.

2 participants