Repository navigation
feat(ci_status): a no-gh path for HEAD shas and run conclusions - #180
Merged
Merged
Conversation
On a mobile/cloud session `gh` is not installed, so the `gh api .../commits/main` call returned an empty sha. Readiness could then not confirm an ingested release-validation report against the live HEADs and reported "release validation source unconfirmed (current HEADs unknown)" even with every other evidence gap cleared. Extract the lookup into `ci_head_sha`, which keeps `gh` first — unchanged dev-box behaviour, and the only source that can read a private repo — and falls back to an anonymous `git ls-remote`, which needs neither authentication nor a session repo attachment. The fallback is bounded because it runs inside the <30s tick: GIT_TERMINAL_PROMPT=0 stops a private repo blocking on a credential prompt, and `timeout` caps a stalled connection. `timeout` is coreutils, so it is resolved to `timeout`/`gtimeout` once at source time; where neither exists (stock macOS) the fallback is skipped rather than run unbounded, since a stalled ls-remote is worse than the empty sha that is already today's answer. Failure still yields an empty sha, never a fabricated one. This works standalone because build_sidecar writes `head_sha` unconditionally (ci_status.py:274), independent of the runs fetch error: the CI row keeps reading "unavailable" until the conclusions half lands, but the release gate can already confirm commit_shas. Verified in a gh-less container: all 25 repos scanned in 3.3s, the five release-gate libraries resolve their real shas, and readiness no longer emits the source-unconfirmed reason. Closes #178 Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SeYsHrJsuH6wXjCCypKPzp
Second half of the no-gh mobile path (#178 covered the HEAD sha). Without `gh` the runs fetch fails outright, so every polled repo recorded status="unavailable" and CI was unknown per-library. `gh` is only transport here: ci_status.py already parses a REST-shaped {"workflow_runs": [...]} payload, and MCP's list_workflow_runs returns exactly that shape, snake_case keys included — so nothing is reshaped on the way in. Mirrors test_run.py's proven cloud_validation.json hand-off rather than inventing a second idiom. - HEART_CLOUD_CI_DIR ($HEART_STATE_DIR/cloud_ci/<Name>.json) holding {ts, runs}; ts optional, file mtime used when absent. - ci_status.cloud_runs() reads and age-bounds it, returning (runs, "") or (None, reason), failing closed on every malformed/undated/stale path. - main gains --cloud-runs, consulted ONLY when the live fetch already failed, so the dev box is byte-for-byte unchanged. A rejected payload appends its reason to the original error rather than vanishing. - New `source` sidecar field ("gh" | "cloud"). Provenance is evidence: a reader must be able to tell a conclusion Heart fetched from one an agent handed it. The tick does no network work for this — it only reads the drop point, as it already reads cloud_validation.json. Population is a separate one-shot leg, which is what keeps the <30s budget intact. Verified in a gh-less container against a drop point built from a real MCP list_workflow_runs response: consumed with source="cloud" and the error cleared. The rollup still declined to report success, because PyAutoFit's main advanced between the fetch and the tick and the existing on_head guard marked the runs off-HEAD — the guard working as intended, and why the age bound alone is not sufficient: a payload can be fresh by clock and stale by commit. Closes #179 Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SeYsHrJsuH6wXjCCypKPzp
The tenant-firewall check (PyAutoMind repos_sync.py) failed both legs: an unlisted organ file may carry NO instance fact, and the new test defaulted its repo argument to a real owner/name. Genericised rather than allowlisted. The allowlist's own comment says never to grow it casually — each entry is a file an adopting fork must rewrite — and this test earns no entry: `gh` and `git` are both stubbed, so the repo string is never resolved and a real one bought nothing. The suite itself was green on both legs (635 passed); only this check failed. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SeYsHrJsuH6wXjCCypKPzp
This was referenced Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gives
ci_statusa working path on a mobile/cloud session, whereghis not installed at all.Closes #178
Closes #179
Why
A cloud
/healthrun cleared all three named evidence gaps — test-run verdict, install verification, release validation — and readiness still reported STALE on six reasons. Every one of them traced to the same cause: noghin the session container, soci_statuscould not run. FiveCI status unavailablerows, plusrelease validation source unconfirmed (current HEADs unknown)blocking the release gate.ghis only transport here. The judgment already lives inheart/checks/ci_status.py, which reads a REST-shaped{"workflow_runs": [...]}payload from stdin plus a--head-shaargument. Nothing needed reimplementing; something needed re-plumbing.Two halves, deliberately split
They have genuinely different costs, and the cheaper one buys more.
3f57cfd— HEAD shas (#178).ci_head_shakeepsghfirst (unchanged dev-box behaviour, and the only source that can read a private repo) and falls back to an anonymousgit ls-remote. That needs no authentication and no session repo attachment, so it works exactly whereghcannot. On its own it clears the reason blocking the release gate.d29fe7d— run conclusions (#179). A per-repo drop point at$HEART_STATE_DIR/cloud_ci/<Name>.json, populated by Brain via MCP, consulted only when the live fetch has already failed. Mirrorstest_run.py's provencloud_validation.jsonhand-off rather than inventing a second idiom — MCP'slist_workflow_runsalready returns the exact shapenormalize_runsexpects, so nothing is reshaped on the way in.Keeping it inside the tick budget
cloud_validation.json. Population is a separate one-shot leg. This is the decision that matters most; per-repo network calls inside the tick loop would blow the<30sbudget outright.ls-remoteis one cheap ref read that slots into the existing parallel fan-out.ls-remotefallback is bounded.GIT_TERMINAL_PROMPT=0stops a private repo blocking on a credential prompt, andtimeoutcaps a stalled connection.timeoutis coreutils, so it resolves totimeout/gtimeoutonce at source time; where neither exists (stock macOS) the fallback is skipped rather than run unbounded — a stalledls-remoteinside the tick is worse than the empty sha that is already today's answer.HEART_CLOUD_CI_MAX_AGE, default 3600s). Past it, it degrades to the sameunavailablea failed fetch produces, never a stale green.Behaviour on the dev box is unchanged
Both legs are strictly fallbacks behind a successful
gh. Whereghworks,erroris empty and neither new path executes.Failure never fabricates: an unresolvable sha stays empty, and a rejected drop point appends its reason to the original fetch error rather than vanishing. New
sourcefield on the sidecar ("gh"|"cloud") records provenance — a reader must be able to tell a conclusion Heart fetched itself from one an agent handed it.Verification
635 tests pass, 13 new —
ci_head_sha's branches with stubbedgh/git, andcloud_runs' freshness and fail-closed paths plusmain's ordering.End-to-end in a gh-less container: 25 repos scanned in 3.3s, all five release-gate libraries resolving real shas, and readiness no longer emitting
release validation source unconfirmed.One result worth recording: the drop-point run was consumed correctly (
source="cloud", error cleared) but the rollup still declined to report success, because PyAutoFit'smainadvanced between fetching the runs and the tick, so the existingon_headguard marked them off-HEAD. That is the guard working as intended, and it is why the age bound alone is not sufficient — a payload can be fresh by clock and stale by commit. The on-HEAD success path is covered by a unit test instead of by rewriting the sha.Known constraint
The Actions API requires each repo attached to the session, and attachment can be refused — it was, for one library, during the session that motivated this. Such a repo degrades to
unavailable, which is correct rather than an error, but it does mean the conclusions half delivers less on mobile than the sha half does.Generated by Claude Code