Skip to content

feat(cli): add atomic launch receipts - #895

Open
pranaypratyush wants to merge 5 commits into
kunchenguid:mainfrom
pranaypratyush:fm/no-mistakes-atomic-proof-upstream-review
Open

feat(cli): add atomic launch receipts#895
pranaypratyush wants to merge 5 commits into
kunchenguid:mainfrom
pranaypratyush:fm/no-mistakes-atomic-proof-upstream-review

Conversation

@pranaypratyush

Copy link
Copy Markdown

Closes #804.

Adds strict axi run --launch-nonce mode: a daemon-owned, repository/branch-lock-protected nonce binding, a pre-drive machine-readable receipt, exact persisted-intent SHA-256 digest, immutable full head bindings, and created/reused disposition. Same nonce retries converge; different nonces never reattach a same-head run. The post-receive and no-op fallback paths use the same receipt contract.

Keeps ordinary reattachment and NULL-nonce historical rows compatible. Raw intent is excluded from receipts, telemetry, and generic status. Includes storage, daemon/IPC, CLI transport, focused race/context/persistence tests, contract docs, release note, and fork retirement procedure.

Does not adopt PR #871 custody changes.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 29, 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-08-29T08:14:44.193704Z 4f9ae3e PR opened
ℹ️ 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.

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

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

Comment thread internal/cli/axi_drive.go
Comment on lines +136 to +142
if launchNonce != "" {
receipt, err := lookupLaunchReceipt(env.client, env.repo.ID, branch, launchNonce)
if err != nil {
return emitError(cmd, 1, fmt.Sprintf("look up launch receipt: %v", err))
}
if receipt != nil {
if receipt.HeadSHA != headSHA || receipt.SubmittedHeadSHA != headSHA || receipt.IntentDigest != digestLaunchIntent(intent) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Revalidate existing receipts against the current gate head

When a nonce is already bound and another push has since advanced the gate branch, a caller whose local checkout remains at the old head takes this lookup shortcut, emits the old receipt, and drives its run without invoking start_fresh_run or checking the gate. This defeats strict mode's branch/head drift guarantee; route existing bindings through daemon-side gate validation before accepting the receipt.

Useful? React with 👍 / 👎.

Comment on lines +773 to +778
gateHead, err := git.Run(ctx, gateDir, "rev-parse", "refs/heads/"+branch+"^{commit}")
if err != nil {
return "", fmt.Errorf("resolve gate head: %w", err)
}
if gateHead != headSHA {
return "", fmt.Errorf("launch context drift: gate branch %q is at %s, not requested %s", branch, gateHead, headSHA)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Make the gate-head check atomic with receipt creation

If another Git push updates this branch after rev-parse succeeds but before the nonce-bound row is inserted, the daemon issues a created receipt for a head the gate no longer names. The in-process branch mutex does not participate in Git's receive/ref transaction, so concurrent pushes can cross this check; creation needs a Git-level compare-and-swap or another validation synchronized with the ref update.

Useful? React with 👍 / 👎.

Comment thread internal/ipc/protocol.go
MethodShutdown = "shutdown"
MethodPushReceived = "push_received"
MethodStartFreshRun = "start_fresh_run"
MethodGetLaunchReceipt = "get_launch_receipt"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Classify launch-receipt lookup as read-only

get_launch_receipt is a read-only polling method, but it was not added to readOnlyMethod in internal/ipc/server.go, so every successful lookup is logged at INFO. The new wait loop calls it every 150 ms for up to five seconds, producing roughly 34 lifecycle-log entries per delayed launch instead of the required DEBUG-only read logging.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; both previously reported compilation issues are fixed at the current HEAD.

Reviews (5): Last reviewed commit: "revert: retain only changelog correction" | Re-trigger Greptile

Comment thread internal/cli/axi_drive.go
Comment thread internal/ipc/protocol.go Outdated
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Thanks for this — it correctly targets ready-for-pr #804 with opt-in --launch-nonce strict receipts (pre-drive TOON, full heads, intent digest, created/reused) while keeping NULL-nonce / ordinary reattachment compatible. Greptile is 5/5 at tip eb7cd0ea; prior compile P1s look fixed.

Blocking: Guard failed because this PR hand-edits CHANGELOG.md. Please drop that file from the PR (release-please generates it from conventional commits on main). After that, fork CI will need a fresh tip approve.

Non-blocking notes: Codex P2 (get_launch_receiptreadOnlyMethod to avoid INFO poll spam); Codex P1 gate revalidation on receipt replay is optional relative to the documented same-nonce/head/intent idempotent contract.

contract-class: opt-in. VISION R1–R7 look aligned for the opted-in path. Not merging until CHANGELOG is removed and CI is green. Waiting on you.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Thanks for the follow-up. Tip is now 67bf0b22 (two commits after eb7cd0ea). Feature code is unchanged vs the last review; the Unreleased CHANGELOG section is gone, but CHANGELOG.md is still in the PR — it only deletes the blank line after # Changelog. Guard treats any CHANGELOG.md change as a hand-edit and will still fail.

Please restore CHANGELOG.md to match main exactly (git checkout main -- CHANGELOG.md) and push. release-please will write the release note from the conventional commit. After that, fork CI on the new tip will need a fresh approve.

Fork CI on this tip was approved (33248345861 CI, 33248345806 docs, 33248345799 Guard) so Guard can confirm. contract-class: still opt-in --launch-nonce. Not merging until CHANGELOG is bit-identical to main and CI is green. Waiting on you.

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.

axi run does not expose a durable machine-readable launch identity before driving

2 participants