Skip to content

Keep credential generations owned until acquisition stops - #225

Merged
HemSoft merged 8 commits into
mainfrom
feature/issue-176-credential-owner
Oct 21, 2026
Merged

HemSoft merged 8 commits into
mainfrom
feature/issue-176-credential-owner

Conversation

@HemSoft

@HemSoft HemSoft commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Keep GitHub credential generations owned through acquisition shutdown, including the interval after an HTTP body finishes. The owner qualifies reader/publisher roles as one pair, supplies stable scoped handles, and closes admission while a replacement drains. Unknown mint outcomes stay in the durable journal; there is no automatic renewal or old-pair fallback.

A private acquisition lease pins the pair and requires a trusted stop capability at admission. Cancellation revokes work, but the lease survives until borrowed HTTP calls/bodies return and the stop capability succeeds. Failed or unreturned stop evidence retains the pair and service lock. The production factory must provide broker join and exact unit-stop evidence; the lease does not manufacture it.

Related to #174 and #176. The owner uses the durable installation journal merged in #220. These broader issues remain open. No credential import, activation, live inference, App change or paid usage is supplied.

Acceptance Criteria

  • Explicit pair qualification, JWT-buffer disposal, stable role handles and no automatic credential acquisition on construction, readiness or requests.
  • Reader and publisher scopes remain enforced. Uncertain publisher acquisition blocks new reader signing/minting; restart cannot inherit readiness.
  • One acquisition lease outlives individual HTTP bodies, survives cancellation, and blocks credential refresh/disposal until its trusted stop path completes. Borrowed requests stay on the pinned reader during refresh drain.
  • Close cancels qualification/acquisition/HTTP work and retains ownership on timeout. Expiry, backward clocks and lost eligibility revoke further acquisition work.

Validation

  • Head 817d34594c2f4676fe6b8f971704fa49474e3052, based on merged main 7ddf301.
  • go -C reviewer vet ./...: pass.
  • go -C reviewer test -race -count=1 ./...: pass, main package 121.208 seconds.
  • Generation and stop/cancellation regressions are included in the fresh full race run. Real local TLS and synthetic installation tokens exercise pinning/refresh; actual inert processes and original pidfds independently reject a still-live stop.
  • Cases include completed HTTP with live acquisition, failed-stop lock retention, concurrent/unreturned stop checks, canceled HTTP that has not returned, exactly-once borrow retirement, expiry during eligibility checking and explicit stopped recovery. Existing actual RSA signing, role-restricted publication, unknown-mint/reopen and separate-process lock tests pass.
  • Stop-deadline regression failed before the fix when the trusted callback ignored cancellation. The caller now returns at its deadline while that callback retains the single-flight proof, token pair and service lock. Late success cannot release an expired operation; an explicit retry waits for the old callback to return.
  • Final readiness and HTTP-admission cancellation regressions failed before locked context rechecks. The HTTP regression records zero underlying dispatches after the fix and confirms caller-body closure.
  • A real cancellation race reproduced a failed stop that had already released its generation. The caller now commits the proof only after locked acceptance; 3,000 cancellation races pass.
  • An actual lock-descriptor close error reproduced a false claim of retained ownership. Disposal now makes the owner terminal while reporting the initial error; a fresh constructor is unqualified, and Close retries are idempotent.
  • The final handover now revalidates both new receipts against a single clock sample under the owner lock, then checks cancellation before replacing the pair. Four regressions first reproduced reader expiry during publisher qualification, publisher expiry during the final eligibility check, a backward clock, and cancellation from the final clock read. All pass under the race detector. Failed handover preserves old token ownership, closes admission and performs no replay.
  • A separate journal handle previously introduced an unknown publisher outcome after the preflight and before reader acquisition. The new red/green TLS regression reproduces that race. Refresh now holds the publisher role process lock across preflight, signing and reader qualification. The later publisher acquisition takes its own lock and rechecks its durable state. The competitor reaches no HTTP while fenced; the owner mints each role once.
  • Backend/offline source only. No live review rendering or production containment qualification is claimed. Actions remain retired; validation runs locally.

Risks and deferred work

The stop capability is explicitly trusted. The test capability proves termination of an inert process, not whole-cgroup or broker shutdown. The production acquisition factory must revoke/join the broker and verify the exact owned unit, cgroup and runtime before releasing this lease. Durable unit/archive recovery must run before eligibility can allow a restarted owner to refresh. The lease itself is in-memory ownership, not a replacement journal or restart proof.

After #220 merged, this PR was retargeted to main and only its owner-owned commits were replayed onto 7ddf301. The squashed journal parent was not replayed. This correction changes three of the same five owner-owned files; the two dependent branches have disjoint file ownership. The final review provenance is recorded below.

Complete factory/controller startup and recovery, physical isolation qualification, provider/account and public-target subscription evidence, native controls/benchmark, trusted-release promotion, rendered GitHub evidence and explicit owner live authorization remain in #172 through #177.

Merge uses the merge-mission bounded-review rule after three reviewed heads and repeated finding-fix rounds. The latest required review evaluated 9ab48ca8f55890359cf7a0daed17586c2ac027e6 and raised one P2, with no P1. Its publisher-fence finding is corrected and covered by a failing-before regression in the published head. Every known finding has a fixing reply and is resolved under that rule. This corrected head is not claimed clean-reviewed. No further unchanged-head retry or review request was made. Formal approval and repository protections remain unchanged.

Copilot AI lite review requested due to automatic review settings October 21, 2026 12:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T18:02:12.414231Z 9ab48ca Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Three unresolved findings remain, including one critical stop-handling issue.

1 open issue
What changed in this PR

This PR keeps GitHub credential generations owned through acquisition shutdown, including HTTP-body draining and trusted stop verification.

Changes:

  • Adds paired credential ownership and stable scoped role handles.
  • Adds acquisition leases with borrowing, cancellation, refresh draining, and lock retention.
  • Adds lifecycle, race, expiry, process-lock tests, and documentation.

Review findings:

  • Critical: Synchronous stop callbacks can bypass timeout handling and block retries.
  • Moderate: Final eligibility does not recheck context cancellation.
  • Moderate: HTTP admission can proceed after request cancellation.
File Summary
reviewer/​github_credential_owner_unix.go Paired credential ownership and lifecycle management
reviewer/​github_credential_owner_unix_test.go Owner lifecycle, qualification, refresh, and isolation tests
reviewer/​github_credential_generation_unix.go Acquisition leases and trusted stop handling
reviewer/​github_credential_generation_linux_test.go Generation draining, stop races, expiry, and process tests
reviewer/​CREDENTIAL-OWNER.md Ownership, lease, and shutdown documentation

Review effort: Lite

@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 48f4c2def2

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

@HemSoft
HemSoft changed the base branch from feature/issue-176-installation-journal to main October 21, 2026 13:08
@HemSoft
HemSoft force-pushed the feature/issue-176-credential-owner branch from 48f4c2d to 2faef5a Compare October 21, 2026 13:12
@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 2faef5af7f

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

@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 1ff78a88d0

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

@HemSoft

HemSoft commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 9ab48ca8f5

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

@HemSoft
HemSoft merged commit 4258d0e into main Oct 21, 2026
@HemSoft
HemSoft deleted the feature/issue-176-credential-owner branch October 21, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants