Skip to content

doc-health-nightly: mint one App token per foreign owner (xFactory#366) - #831

Merged
brettheap merged 5 commits into
mainfrom
fix/nightly-app-token-per-foreign-owner
Sep 9, 2026
Merged

brettheap merged 5 commits into
mainfrom
fix/nightly-app-token-per-foreign-owner

Conversation

@brettheap

@brettheap brettheap commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-3 (openXfactory-3)

Authority. Brett Heap, 2026-09-09 ~05:5xZ, recorded on #591: "do 364, 365 and 366".

Where this lands, and why not the aggregation. opensoft/xFactory#366 names .github/workflows/doc-health-nightly.yml. That caller is 76 lines and owns only scheduling, dispatch and permissions; the failing step lives in the reusable workflow it calls — opensoft/openxFactory/.github/workflows/doc-health-reusable.yml@main, resolved in the failing run as 870727fd. The aggregation repository contains no step named Detect foreign submodule owners and no create-github-app-token step for a submodule owner (grep over its .github/ and scripts/ finds neither), so there is nothing there to change. The caller pins @main, so this change takes effect on the next nightly with no aggregation pin-sync — nothing in xFactory is touched, and in particular nothing near review-lane.yml, merge-master-approval.yml, council-convening-lane.yml, the codexFactory pin triple or MIGRATION_PIN.

Root cause — two defects, not one

The issue reports the nightly "always at the same step". Measured per run, it is two defects in the same block, and neither alone returns the run to green:

nightly run failed at
2026-09-04 33829908879 — (green)
2026-09-05 33939303830 Init governed submodules only
2026-09-06 34006720351 Init governed submodules only
2026-09-07 34076748501 Init governed submodules only
2026-09-08 34180399272 Detect foreign submodule owners
2026-09-09 34303636250 Detect foreign submodule owners

Defect A — one foreign owner only (what xFactory#366 names). From run 34303636250:

##[error]the governed submodules span 2 foreign owners (MedxSoft ledgerXfactory)
but actions/create-github-app-token mints ONE owner per step; extend this
workflow with a mint+rewrite pair per foreign owner

The step refused any count above one by design, on the reasoning that a second pair "has to be written by hand". The aggregation then admitted a second owner: commit 99f1643 ("Repoint the LedgerxFactory submodule at ledgerXfactory, its own enterprise org", 2026-09-07 16:49Z) left xFactories/MedxFactory and xFactories/MedxEHR on MedxSoft and moved xFactories/LedgerxFactory to ledgerXfactory. From the next nightly the run died there, in both the prepare and finalize jobs, before a single bundle was built — 0 artifacts, which is also why the cataloger and organizer lanes' GITHUB_SHA != source_sha provenance gate could not be passed in the xFactory#346 re-run.

Defect B — one URL form only (not named in the issue; it is what the three earlier nightlies died of, and it is uncovered the moment defect A is fixed). Both rewrites keyed on [email protected]:, and xFactories/MedxEHR's own .gitmodules declares its two legs as https:

[submodule "spec"]  url = https://github.com/MedxSoft/MedxEHR-spec.git
[submodule "code"]  url = https://github.com/MedxSoft/MedxEHR-code.git

An ssh-keyed insteadOf never matched those, so the first nightly after the nested-leg init landed (openxFactory#651, b4216821, 2026-09-04 13:30Z — the green 09-04 run was at 02:32Z, before it) died with fatal: could not read Username for 'https://github.com': No such device or address on xFactories/MedxEHR/spec. A private repository, made to look like an anonymous fetch.

Design

FOREIGN_OWNER_SLOTS numbered mint slots, three today for two owners, in both jobs:

  • Detect foreign submodule owners keeps reading owners from .gitmodules (never a hardcoded organization) and now emits count, slots and owner_1..owner_N — every slot written, filled or empty. It refuses only above the slot count, still naming every owner, and now naming the exact edit that raises the ceiling.
  • Mint app token for foreign submodule owner N × 3, each guarded on owner_N != '', each continue-on-error: true. That is not a fallback — there is still no || github.token on any foreign mint. It is what lets the next step turn "no token for owner X" into a finding that names X, instead of stopping on the action's own API error, which names neither the submodule that needed the token nor any remedy.
  • One Rewrite foreign-owner submodule URLs step credentials every filled slot, in both URL forms, with git config --add (insteadOf is multi-valued, so the second form would otherwise replace the first).
  • The slot count is typed in exactly one place per job and reaches the rewrite step through the slots output. A slot count that did not arrive is its own refusal: an empty or non-numeric SLOTS would leave the loop a no-op with the step reporting SUCCESS having credentialed nobody.
  • Rewrite governed submodule https URLs for the fallback token, guarded on env.HAS_APP_KEY != 'true', honors the documented SUBMODULE_TOKEN path (Codex's P2, taken). With no App key every per-owner mint is skipped, and with it the only step that wrote an https key, so a private https leg stayed unauthenticated behind a perfectly good PAT. A PAT is not an installation token, so it needs no slot, only the owner list — the detection also emits owners_all for exactly this reader. It is scoped to the owners .gitmodules declares, not to https://github.com/ at large, precisely so the checked-out repository's own origin URL cannot be captured.

Two alternatives were considered and not taken. A matrix job would have to pass installation tokens between jobs as outputs. Signing the App JWT by hand in shell would scale to N owners with no slots, but puts the private key on disk and hand-rolls RS256 in a nightly gate; the slots are literally what the existing error message asked for. The issue's option (b), narrowing the nightly's submodule-owner scope, is available to an operator as a stopgap but is not taken here: it narrows the swept corpus, which is a gate.

App-installation measurement, per owner

Measured 2026-09-09 as an admin of all three organizations (GET /user/memberships/orgs/ledgerXfactory → {"role":"admin","state":"active"}, so the empty reading below is authoritative and not a permissions artifact). The App behind XFACTORY_APP_ID is openxfactory, app id 4253636, owner opensoft — the MedxSoft installation id matches the one the workflow's own comment records.

governed owner submodules openxfactory App installation
opensoft openxFactory, AdxFactory, HealthLinc, OpsxFactory, codexFactory, MedxChart, MedxPractice 145372182, all repositories
MedxSoft MedxFactory, MedxEHR (+ its spec/code legs) 157085693, all repositories
ledgerXfactory LedgerxFactory NONE — GET /orgs/ledgerXfactory/installations → {"total_count":0,"installations":[]}

So one operator act remains, and the workflow now says so by name. create-github-app-token cannot mint for an organization the App is not installed on, so slot 2 will not resolve until someone installs openxfactory on ledgerXfactory (all repositories, contents: read is enough for this lane). ledgerXfactory/LedgerxFactory is private ("private": true), so there is no anonymous fetch to fall back to, and SUBMODULE_TOKEN is not configured on opensoft/xFactory (its secret list is COUNCIL_LANE_APP_ID, COUNCIL_LANE_APP_KEY, HERMES_READINESS_TOKEN, MERGE_MASTER_APP_KEY, OPENROUTER_API_KEY, XFACTORY_APP_ID, XFACTORY_APP_PRIVATE_KEY), so the documented PAT path is dead too. Rather than sweep a corpus with a governed repository silently missing from it, the rewrite step fails the run with:

##[error]no GitHub App installation access token could be minted for organization
'ledgerXfactory', which owns at least one governed submodule this run has to clone;
slot 2's mint step above carries the API's own words. The overwhelmingly likely cause
is that the App behind XFACTORY_APP_ID has no installation on 'ledgerXfactory' —
creating one there (all repositories, contents: read) is an OPERATOR act on that
organization and no workflow change substitutes for it. Until it exists this run
refuses rather than sweeping a corpus with a governed repository silently missing
from it

That is a deliberate trade and it is stated plainly: after this lands the nightly is still red until that installation exists — but red at a named step, naming one organization and one remedy, with the multi-owner mechanism and defect B both behind it, instead of red at a step that named no remedy and 0 artifacts either way. No gate is weakened to buy a green.

What stays unchanged

  • The broad [email protected]: org rewrite stays and stays broad. Longest prefix wins, so the per-owner keys narrow it; removing it would strand every same-org submodule. Verified by running the real step and reading the config back with git ls-remote --get-url: with both present, [email protected]:MedxSoft/MedxEHR.git resolves to the MedxSoft token and [email protected]:opensoft/codexFactory.git to the caller-org token.
  • The zero-foreign and one-foreign paths behave exactly as before (both exercised).
  • The App's permissions are untouched: same secret pair, no permission-* inputs, no widened scope, no new secret.
  • The self owner is deliberately not given an https key. Every opensoft-owned governed submodule and every nested leg the init touches under one (openxFactory/openXwallet) is declared [email protected]:; a narrow https://github.com/opensoft/ key would also capture the checked-out repository's own origin URL, which the report-delivery lanes push through, for no failure anyone has observed.
  • A nested leg in a third organization stays out of reach and is documented as bounded rather than silent: detection reads the aggregation's .gitmodules, which is all that exists before the init runs. Measured at today's pins, every leg the init touches belongs to an owner the top level already declares.

Validation

  • tests/doc-health/test_submodule_owner_tokens.py, 28 passed / 0 skipped. Structural: the slot count is written once and equals the mint steps present, in both jobs; each mint reads its own slot, carries the App secrets, has no github.token fallback and defers its failure; both URL forms are written per owner with --add; the refusal is bounded by the slots and no longer by one; the broad rewrite stays broad; and the two jobs' whole owner-token blocks are byte-identical after a YAML round trip (they are twins, and they drift because nothing compared them). Behavioral: the two shell steps are run against synthetic .gitmodules trees and the resulting git config is read back through git ls-remote --get-url — zero, one, two and four foreign owners, installs/ correctly not governed, and a filled slot with an empty token (exit 1, owner named, the owner that could be served still served). A second commit adds the review note that a slot count which did not arrive is its own refusal: SLOTS reaches the rewrite step from the detection's output, and an empty or non-numeric value would leave the loop a no-op with the step reporting SUCCESS having credentialed no owner — a silent pass on exactly this path — so it refuses by name instead.
  • The whole of tests/doc-health — 1628 passed / 0 skipped — and every existing module that reads this workflow: tests/doc-health/{test_workflow_contract,test_workflow_guards,test_neutrality_dispatch,test_readiness_output_fail_closed,test_modified_block_currency_reporting}.py, tests/openxwallet_pin/test_aggregation_lane_wiring.py, tests/avatar_runtime/test_ruled_values_pinned.py, tests/ideation-dashboard/{test_nightly_lane,test_dashboard_source_seal}.py — 187 passed, unchanged, including the openXwallet lane-wiring order guard around Init governed submodules only.
  • actionlint is not available in this environment; the workflow is validated by yaml.safe_load (the same parse every structural test above performs) and both changed run: scripts pass bash -n. No skips are added, so pytest-suite's exact EXPECT_SKIPPED pin is unaffected and its MIN_SELECTED/MIN_PASSED floors only rise.

Review rounds

round head disposition
Copilot, d54a6675 🟡 changes recommended ghs_* placeholder tokens — taken (4ccc586a); "don't assert the full URL" — declined, longest-prefix-wins is a claim about the whole string and a substring check passes for the right owner routed to the wrong token
Copilot, bdc3f8c7 🟢 approval recommended no new comments
Copilot, 4ccc586a 🟢 approval recommended build the expected URL at runtime — taken (faac639f, a credentialed() helper); suppress pytest's diff behind a custom AssertionError — declined, that trades a real diagnostic for the appearance of a secret that is not one
Codex, 4ccc586a P2 the documented SUBMODULE_TOKEN fallback never got the https form — taken in full (4fdfc94c), with seven tests
Sourcery — private-repo upsell stub, no findings

All three bot threads are replied to and resolved.

The nightly is not dispatched from this branch. The orchestrator will dispatch it once after landing (doc-health-nightly.yml does carry workflow_dispatch), which is also when the ledgerXfactory finding above will be observed on a real run rather than in simulation.

Refs opensoft/xFactory#366, opensoft/xFactory#346, #591

🤖 Generated with Claude Code

https://claude.ai/code/session_01YCvrAkCLaytaYBMtZbQwun

…odule owner

The nightly has produced 0 artifacts since 2026-09-05, from two defects in
the same block of `doc-health-reusable.yml` — the credential rewrites that
let `Init governed submodules only` clone a submodule set that spans
organizations. Both are fixed here; neither alone would return the run to
green.

DEFECT A, opensoft/xFactory#366 — one foreign owner only. `Detect foreign
submodule owners` refused any count above one, because
`actions/create-github-app-token` mints ONE owner per step and the second
mint+rewrite pair "has to be written by hand". The aggregation then admitted
a second: commit 99f1643 ("Repoint the LedgerxFactory submodule at
ledgerXfactory, its own enterprise org", 2026-09-07 16:49Z) left
`xFactories/MedxFactory` and `xFactories/MedxEHR` on `MedxSoft` and moved
`xFactories/LedgerxFactory` to `ledgerXfactory`, so from 2026-09-08 the
nightly died in that step before a single bundle was built (opensoft/xFactory
runs 34180399272, 34303636250). The pairs are now written: three numbered
mint slots, guarded on their own slot output, and one rewrite step that
credentials every filled slot. Above the slot count it still refuses, still
names the owners, and now names the exact edit that raises the ceiling.

DEFECT B — one URL FORM only. Both rewrites keyed on `[email protected]:`, and
`xFactories/MedxEHR`'s own `.gitmodules` declares its `spec`/`code` legs as
`https://github.com/MedxSoft/MedxEHR-{spec,code}.git`. So the first nightly
after the nested-leg init landed (#651, `b4216821`, 2026-09-04 13:30Z) died
`fatal: could not read Username for 'https://github.com': No such device or
address` — runs 33939303830 (09-05), 34006720351 (09-06), 34076748501
(09-07), the three nightlies before defect A moved the failure one step
earlier. `.gitmodules` is the authority on the URL as well as the owner and
is free to spell either form, so each owner is credentialed in both.

WHAT IS NOT CHANGED. The broad `[email protected]:` org rewrite stays and stays
broad — longest prefix wins, so the per-owner keys narrow it rather than
replace it, and the zero-foreign and one-foreign paths behave exactly as
before. The App's permissions are untouched: the same `XFACTORY_APP_ID` /
`XFACTORY_APP_PRIVATE_KEY` pair, no `permission-*` inputs, no
`|| github.token` fallback on any foreign mint. The self owner is
deliberately NOT given an https key: every `opensoft`-owned governed
submodule and every nested leg the init touches under one is declared
`[email protected]:`, and a narrow `https://github.com/opensoft/` key would also
capture the checked-out repository's own origin URL that the report-delivery
lanes push through.

ONE OPERATOR ACT REMAINS, AND IT NOW SAYS SO. Measured 2026-09-09 as an
admin of all three organizations: the `openxfactory` App (id 4253636) is
installed on `opensoft` (installation 145372182, all repositories) and on
`MedxSoft` (157085693, all repositories) — and `ledgerXfactory` has NO App
installations at all (`GET /orgs/ledgerXfactory/installations` →
`total_count: 0`). `create-github-app-token` cannot mint for an organization
it is not installed on, so slot 2 will not resolve until someone installs the
App on `ledgerXfactory`. `LedgerxFactory` is private, so there is no
anonymous fetch to fall back to, and `SUBMODULE_TOKEN` is not configured on
opensoft/xFactory. Rather than sweep a corpus with a governed repository
silently missing — a gate, quietly narrowed — the rewrite step fails the run
with a finding that names the organization, the slot, and the operator act.
The mint steps carry `continue-on-error` for exactly that reason: it is not a
fallback, it is what lets the failure be named instead of being this action's
own API error.

VALIDATION. `tests/doc-health/test_submodule_owner_tokens.py` (19 tests):
structural assertions that the slot count is written in ONE place and equals
the mint steps present in BOTH jobs, that each mint reads its own slot and
defers its failure, that both URL forms are written per owner with `--add`
(`insteadOf` is multi-valued), that the broad rewrite stays broad, and that
the two jobs' blocks are byte-identical after a YAML round trip; plus
behavioral tests that RUN the two shell steps against synthetic `.gitmodules`
trees and read the resulting git config back through `git ls-remote
--get-url`, because "longest prefix wins" is a property of git. Zero, one,
two and four foreign owners are all exercised, as is a filled slot whose
token is empty. 19 passed, 0 skipped; the 277 tests of every module that
reads this workflow pass unchanged.

Refs opensoft/xFactory#366, opensoft/xFactory#346, #591

Lane: openxfactory-3
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YCvrAkCLaytaYBMtZbQwun
Copilot AI lite review requested due to automatic review settings September 9, 2026 06:27

@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 ✨

@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

…ive is its own refusal

`SLOTS` reaches the rewrite step from the detection's output. An empty or
non-numeric value would make the loop a no-op — `[ 0 -lt "" ]` aborts under
`set -e` with git's own "integer expression expected", and `[ 0 -lt 0 ]`
simply loops zero times — and in the second shape the step reports SUCCESS
having credentialed no owner at all. That is a silent pass on exactly the
path opensoft/xFactory#366 is about, so the step now refuses by name instead,
in both jobs. Two tests, one behavioral over the empty/zero/non-numeric
values and one structural for the twin.

Lane: openxfactory-3
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YCvrAkCLaytaYBMtZbQwun

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.

🟡 Changes recommended

The new tests embed token-like literals and compare full credential-bearing URLs, which can trigger secret masking/scanning noise; the assertions should be adjusted to use neutral placeholders and validate routing without embedding full credentialed URLs.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the reusable doc-health workflow to support multiple governed submodule owners by minting one GitHub App installation token per foreign owner (in fixed “slots”), and adds a dedicated test suite to pin the workflow’s structural wiring and the behavior of the two critical shell steps (detect + rewrite).

Changes:

  • Extend .github/workflows/doc-health-reusable.yml to detect up to FOREIGN_OWNER_SLOTS foreign owners, mint up to N per-owner app tokens, and rewrite both [email protected]: and https://github.com/ URL forms.
  • Fail closed with a targeted, owner-naming error when a required foreign-owner token cannot be minted (e.g., App not installed).
  • Add tests/doc-health/test_submodule_owner_tokens.py with structural assertions and behavioral execution of the workflow’s shell scripts.
File summaries
File Description
.github/workflows/doc-health-reusable.yml Implements slot-based per-owner token minting and dual-form URL rewrites in both prepare and finalize jobs.
tests/doc-health/test_submodule_owner_tokens.py Adds structural + behavioral tests to prevent regressions in the per-owner token mechanism and URL rewrite behavior.
Review details

Suppressed comments (2)

tests/doc-health/test_submodule_owner_tokens.py:347

  • Same token-like placeholder issue here: ghs_* values and full URL equality assertions can trip secret masking/scanning and make failures harder to interpret. Use non-token-like placeholders and assert routing via substring/suffix checks instead of embedding full credentialed URLs.
        "https://x-access-token:[email protected]/opensoft/codexFactory.git"


def test_an_unmintable_owner_fails_the_run_naming_the_owner(tmp_path):
    done, resolve = run_rewrite(tmp_path, {

tests/doc-health/test_submodule_owner_tokens.py:334

  • This test also uses ghs_*-prefixed token placeholders and compares full rewritten URLs. Using neutral placeholders and checking token selection + suffix keeps the intent while avoiding token-like literals in the repository and reducing masking noise in logs.
         "ledgerXfactory/LedgerxFactory.git")


def test_the_broad_rewrite_still_serves_every_other_owner(tmp_path):
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

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

Copilot AI review requested due to automatic review settings September 9, 2026 06:31
…eticity shim lives in

TWO REVIEW NOTES, ONE OF THEM DECLINED IN HALF.

Copilot asked for two things about the behavioral tests: stop using
`ghs_`-shaped placeholder tokens, and stop asserting the full rewritten URL.

The first is taken. A `ghs_`-prefixed literal reads as a real installation
token to a secret scanner and to a human, and neither cost is worth the
realism; the placeholders are now `medx-installation-token`,
`ledger-installation-token` and `caller-org-token`, which also say what they
are at the point of failure.

The second is declined, with the reason written next to the fixture: "longest
prefix wins" is precisely a claim about the WHOLE resolved string, so a
substring or suffix check would still pass for a rewrite that routed the right
owner to the WRONG token — the exact failure this file exists to catch.
`x-access-token:` stays in the expectation because it is the literal git
rewrite target, not a credential.

Separately, the two subprocess fixtures no longer hand the steps a hardcoded
`PATH`. `tests/hermeticity.py` works BY PATH, so replacing the environment
stepped around the shim, and a hardcoded PATH is also how a suite that passes
on a runner fails on a developer's machine. They now inherit the environment
and remove only what could leak in — the ambient git config vars and every
name the steps themselves read.

Lane: openxfactory-3
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YCvrAkCLaytaYBMtZbQwun
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-3 (openXfactory-3)

Head is now 4ccc586a. Two rounds since the first: bdc3f8c7 added the refusal for a slot count that did not arrive (an empty or non-numeric SLOTS would leave the rewrite loop a no-op with the step reporting SUCCESS having credentialed nobody — a silent pass on exactly this path), and 4ccc586a takes Copilot's placeholder note and stops replacing the test subprocesses' environment (tests/hermeticity.py works by PATH, so a hardcoded PATH stepped around the shim). Suite is 21 passed / 0 skipped.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: d54a6675af

ℹ️ 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".

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.

🟢 Approval recommended

The workflow change is well-scoped, duplicated safely across both jobs, and is backed by targeted structural and behavioral tests that guard against the known failure modes.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 9, 2026 06:34

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.

🟢 Approval recommended

The workflow and tests appear internally consistent and address the stated failure modes; the remaining feedback is limited to test output/log maintainability.

Review details

Suppressed comments (2)

tests/doc-health/test_submodule_owner_tokens.py:365

  • These equality asserts will cause pytest to dump the full resolved URL values on failure; in environments that redact x-access-token: URLs this tends to replace the sensitive portion with ******, obscuring what changed. Prefer comparing against an expected URL built at runtime and raising a custom AssertionError so failures stay readable without printing credential-bearing URLs.
    assert resolve("[email protected]:MedxSoft/MedxEHR.git") == \
        "https://x-access-token:[email protected]/MedxSoft/MedxEHR.git"
    assert resolve("[email protected]:opensoft/codexFactory.git") == \
        "https://x-access-token:[email protected]/opensoft/codexFactory.git"

tests/doc-health/test_submodule_owner_tokens.py:380

  • Same issue as above: this assert will print credential-bearing URLs on failure (and may be redacted to ******..., which hides useful diffs). Use a custom AssertionError and build the expected URL at runtime to preserve strict equality without exposing the full URL in test output.
    assert resolve("[email protected]:MedxSoft/MedxEHR.git") == \
        "https://x-access-token:[email protected]/MedxSoft/MedxEHR.git"
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

@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: 4ccc586a63

ℹ️ 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".

Copilot's second round (it recommends approval; this was its remaining note):
the three behavioral tests each typed a full credential-bearing URL as a
literal, which some review and CI environments redact to `******github.com/...`
and which is three places for the expectation to drift from the rewrite it
checks. A `credentialed(token, owner, repo)` helper now builds it, so the
routing a test claims is readable as "this owner routes to this token" instead
of having to be reassembled by eye.

The half asked for and NOT taken: raising a custom AssertionError that does not
print the URLs. Strict equality on the WHOLE string is the "longest prefix
wins" claim, and pytest's own diff is the most useful thing a reader gets when
it breaks; suppressing it would trade a real diagnostic for the appearance of a
secret that is not one — these are placeholder strings that never leave a
`GIT_CONFIG_GLOBAL` under `tmp_path`.

Lane: openxfactory-3
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YCvrAkCLaytaYBMtZbQwun
Copilot AI review requested due to automatic review settings September 9, 2026 06:40
Codex, on PR #831: when `XFACTORY_APP_PRIVATE_KEY` is absent but the caller
supplies the documented `SUBMODULE_TOKEN`, every per-owner mint is skipped by
its `HAS_APP_KEY` guard — and with it the only step that wrote an
`https://github.com/<owner>/` rewrite. The pre-checkout broad rewrite gives
the PAT the ssh form ONLY, so a private https leg such as MedxEHR's `spec`
stayed unauthenticated and `Init governed submodules only` still failed
despite a valid fallback credential. That is defect B of xFactory#366 living
on in the fallback path, and the finding is correct.

Codex offered two remedies and this takes the first: honor the fallback rather
than delete it from the contract. A new step, guarded on `HAS_APP_KEY !=
'true'`, credentials the https form for every owner `.gitmodules` declares,
from `SUBMODULE_TOKEN || github.token` — the same chain the broad step uses.
A PAT is not an installation token, so it needs no slot, only the owner list;
the detection now also emits `owners_all` (self and foreign, deduplicated) for
exactly this reader.

SCOPED TO DECLARED OWNERS, WHICH IS WHY IT IS A SEPARATE STEP rather than a
second line in the pre-checkout rewrite. A broad `https://github.com/` key
would also capture the checked-out repository's own origin URL that the
report-delivery lanes push through; per-owner keys cannot reach it — and
`.gitmodules` is not readable before the checkout anyway.

Seven tests, four of them behavioral over the real step: the private https leg
resolves to the fallback token, a self-owned https leg does too, an owner
nobody declared is left untouched (the origin case), an empty owner list is a
no-op rather than a failure, and the App path and the fallback path are proven
mutually exclusive. 28 passed / 0 skipped; 187 more in every module coupled to
this workflow, including the openXwallet lane-wiring order guard around `Init
governed submodules only`.

Lane: openxfactory-3
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YCvrAkCLaytaYBMtZbQwun
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-3 (openXfactory-3)

Head is now 4fdfc94c. Codex's P2 is taken (the documented SUBMODULE_TOKEN fallback now gets the https form too, scoped to declared owners) and Copilot's second note is half taken. Suite is 28 passed / 0 skipped, plus 187 in every module coupled to this workflow.

@codex review

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.

🟢 Approval recommended

The workflow changes are internally consistent across both jobs and are backed by targeted structural + behavioral tests that exercise the critical detection and URL rewrite logic.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 9, 2026 06:45
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-3 (openXfactory-3)

The whole credential sequence, run against opensoft/xFactory's real .gitmodules

Not the unit tests — the three shell steps of the prepare job extracted from this branch verbatim and run in order over the aggregation's actual .gitmodules at main, with the resolutions read back through git ls-remote --get-url. Two worlds, because only one of them is today's.

World 1 — today: the App is not installed on ledgerXfactory.

===== Rewrite ssh submodule URLs for token auth =====   -- step rc=0
===== Detect foreign submodule owners =====
governed submodule openxFactory              -> owner opensoft
governed submodule xFactories/LedgerxFactory -> owner ledgerXfactory
governed submodule xFactories/MedxFactory    -> owner MedxSoft
governed submodule xFactories/MedxEHR        -> owner MedxSoft
foreign submodule owner MedxSoft needs its own installation token (slot 1)
foreign submodule owner ledgerXfactory needs its own installation token (slot 2)
                                                        -- step rc=0
===== Rewrite foreign-owner submodule URLs =====
governed submodule owner MedxSoft credentialed from its own installation (slot 1)
::error::no GitHub App installation access token could be minted for organization
'ledgerXfactory', which owns at least one governed submodule this run has to clone;
slot 2's mint step above carries the API's own words. ... creating one there (all
repositories, contents: read) is an OPERATOR act on that organization and no
workflow change substitutes for it. ...
                                                        -- step rc=1
JOB WOULD FAIL HERE

The detection passes with two owners — defect A is gone — the owner that can be served is served, and the run then refuses naming the one organization and the one act that is missing. Compare what it says today: the governed submodules span 2 foreign owners (MedxSoft ledgerXfactory) ... extend this workflow, which names no remedy anyone outside this file can act on.

World 2 — the same sequence once that installation exists. Sequence exit 0, and every URL the init clones resolves to its own owner's token:

URL as .gitmodules declares it resolves to
[email protected]:opensoft/openxFactory.git …:[email protected]/opensoft/openxFactory.git
[email protected]:MedxSoft/MedxFactory.git …:[email protected]/MedxSoft/MedxFactory.git
[email protected]:MedxSoft/MedxEHR.git …:[email protected]/MedxSoft/MedxEHR.git
[email protected]:ledgerXfactory/LedgerxFactory.git …:[email protected]/ledgerXfactory/LedgerxFactory.git
https://github.com/MedxSoft/MedxEHR-spec.git …:[email protected]/MedxSoft/MedxEHR-spec.git
https://github.com/MedxSoft/MedxEHR-code.git …:[email protected]/MedxSoft/MedxEHR-code.git
[email protected]:opensoft/openXwallet.git …:[email protected]/opensoft/openXwallet.git
https://github.com/opensoft/xFactory (the checkout's own origin) unchanged

Rows 5 and 6 are defect B — the two nested legs that reddened 2026-09-05..07 — and the last row is the reason the https keys are per-owner rather than broad: the origin URL the report-delivery lanes push through is never captured.

The token values above are placeholders; nothing here reached the network or a real App.

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.

🟢 Approval recommended

The workflow changes are internally consistent, validated by extensive new tests that execute the key shell logic, and no correctness issues were found in the updated steps.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-3 (openXfactory-3)
LANDED — doc-health-reusable: one App token per foreign owner (xFactory#366) → squash eeb48d42 (2026-09-09T07:10:15Z) from head 4fdfc94c, on Brett Heap's word 2026-09-09 "do 364, 365 and 366" (#591). Two defects fixed: (A) the >1-foreign-owner refusal; (B) the [email protected]:-only rewrite that missed MedxEHR's https:// nested legs. Gate at merge: 9/9 checks SUCCESS; 0 unresolved threads (Codex P2 taken; Copilot 'Approval recommended' on the head); closingIssuesReferences empty; two files. Not green yet by design — Brett Heap's operator act: install the openxfactory App (id 4253636) on the ledgerXfactory org (0 installations; opensoft 145372182 and MedxSoft 157085693 present); until then the nightly ends in a NAMED refusal for slot 2 / ledgerXfactory. xFactory's nightly calls this workflow at @main, so no aggregation pin-sync is needed. Admin merge because a PR opened under Brett's own account cannot carry his approval.

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