Skip to content

review: Codex audit E2 authorization commits - #2

Closed
TheBayoumi wants to merge 5 commits into
codex/evolution-task27from
fix/e2-campaign-authorization
Closed

TheBayoumi wants to merge 5 commits into
codex/evolution-task27from
fix/e2-campaign-authorization

Conversation

@TheBayoumi

@TheBayoumi TheBayoumi commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Review-only Draft PR used for Codex review of the stacked E2 authorization contribution.

Do not merge. Review complete.

Base: codex/evolution-task27 at b75928d57fbeb7c978ccd33b84812921ca65408a
Final contribution head: e1ec52ec48c3c6889c7faac0b8393bf1ec06f4bb
Real upstream contribution: mirror29#167

Codex review history:

  • initial review found E2 approval reuse broader than the one-retry/two-minute contract;
  • re-review found the durable ledger schema rejected evolver.run_event_campaign and an initial-consumption concurrency race;
  • all findings were fixed and regression-tested;
  • final Codex review on e1ec52ec48: "Didn't find any major issues. Nice work!"

Final fork CI on the exact head: PASS

  • orchestration: 54 files / 551 tests
  • E2 authorization: 8/8
  • approval-store: 12/12
  • Evolver client: 8/8
  • migration 0045 apply/round-trip: pass
  • Paper/Evolver regressions: pass
  • Python ruff/mypy: pass
  • web/dashboard: pass
  • consistency: pass
  • agent eval: pass
  • self-host smoke: pass

Closed without merge.

Copy link
Copy Markdown
Owner Author

@codex review

Review exactly the two commits in this PR:

  1. 89d586c161297a49c65ff59512a5e31079e9562c — E2 campaign explicit authorization + durable operation identity
  2. e1d10d9623885f4d458c67ddb138187dc40e8c8b — idempotent E2 campaign start retry recovery

Review focus:

  • authorization / trust-boundary correctness
  • owner, request, LLM snapshot, grant-purpose and operation-ID binding
  • operation-ID continuity into Idempotency-Key
  • lost /start response recovery
  • concurrent duplicate-start race handling
  • whether CAMPAIGN_STATE_CONFLICT reconciliation can mask invalid state
  • terminal/non-draft campaign behavior
  • duplicate campaign / duplicate economic operation risk
  • E1 compatibility
  • five-generation bounded automation unchanged
  • no promotion / Runner / order execution expansion
  • whether tests genuinely cover the intended failure/recovery paths

Report only actionable P0/P1/P2 correctness, security, race, durability, or regression findings. Ignore unrelated existing PR mirror29#164 blockers unless either of these two commits worsens them.

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown

Review base: f18216e

🤖 DeepSeek V4 Pro PR Review

⚠️ review 未完成:DEEPSEEK_API_KEY 未配置(repo Settings → Secrets → Actions)

@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: e1d10d9623

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

toolName,
approvalInput,
reuseAfterConsume: toolName === "evolver.run_evolution",
reuseAfterConsume: durableEvolutionApproval,

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 Limit campaign approval reuse to one two-minute retry

For evolver.run_event_campaign, this generalization sets reuseAfterConsume to true, so the existing 24-hour consumed-operation cache and ledger return the approved operation ID on every matching call rather than permitting one compensation retry within two minutes. After a lost or failed /start response, the same owner/session/input can therefore invoke the tool repeatedly for a day without another decision; every invocation mints a fresh Ed25519 grant and replays the campaign-creation path. Backend idempotency prevents a second campaign for that operation ID, but it does not enforce the required authorization/retry bound, so E2 needs a separate two-minute, single-retry recovery policy.

AGENTS.md reference: AGENTS.md:L142-L145

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

@codex review

Please re-review the complete three-commit contribution against base b75928d57fbeb7c978ccd33b84812921ca65408a.

New head: e2196c5dedd01ffce43ac125018a5b1c1bdc1ed3

The prior Codex P1 was addressed by making E2 recovery a bounded one-shot policy:

  • initial approved execution;
  • at most one matching compensation retry;
  • retry expires after two minutes;
  • durable retry entitlement is atomically consumed via owner/session/tool/input-scoped DELETE ... RETURNING;
  • concurrent/restarted retry claims cannot both succeed;
  • E1's existing 24-hour behavior is intentionally unchanged.

Please verify specifically:

  • whether the prior P1 is fully closed;
  • no second retry is possible in-memory, after restart, or under concurrency;
  • two-minute expiry is enforced;
  • no authorization identity widening;
  • no E1 regression;
  • lost-/start recovery remains correct;
  • no new P0/P1/P2 correctness, security, race, durability, or regression findings.

Report only actionable P0/P1/P2 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: e2196c5ded

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


const DURABLE_EVOLUTION_APPROVAL_TOOLS = new Set([
"evolver.run_evolution",
"evolver.run_event_campaign",

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 Add an E2-compatible approval-ledger migration

With DATABASE_URL configured and the repository migrated through 0042_evolution_approval_operations.py, this newly durable E2 path attempts to insert tool_name='evolver.run_event_campaign', but the table still has CHECK (tool_name='evolver.run_evolution') at line 55 and no later migration alters it. The insert therefore fails, consumeApproved returns no operation ID, and every approved E2 launch is sent back through approval instead of executing; update the schema as part of this contribution.

AGENTS.md reference: AGENTS.md:L142-L145

Useful? React with 👍 / 👎.

Comment on lines 272 to 276
const persisted = await this.persistence?.rememberEvolutionOperation({
...scope,
operationId: record.requestId,
retentionMs,
});

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 Claim the approved record before awaiting persistence

When two matching calls arrive concurrently immediately after approval, both can read the same approved record before either reaches this await, so both persist/cache the entitlement and both return the operation ID as initial executions. The durable row or overwritten in-memory one-shot entry then remains available for a third invocation, yielding an initial call plus two retries; this is fresh evidence in the new head that the prior one-retry issue remains under initial-consumption concurrency. Remove or transition the approved record atomically before the asynchronous persistence step, restoring it only on failure.

AGENTS.md reference: AGENTS.md:L142-L145

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

@codex review

Please perform a final review of the complete contribution against base b75928d57fbeb7c978ccd33b84812921ca65408a.

Final head: e1ec52ec48c3c6889c7faac0b8393bf1ec06f4bb

All prior Codex P1 findings have been addressed:

  • E2 initial execution + exactly one matching retry within two minutes;
  • durable retry token atomically claimed under restart/concurrency;
  • same-identity initial consumption serialized so concurrent calls cannot both become initial executions;
  • migration 0045 expands the operation-ledger tool_name constraint to include evolver.run_event_campaign;
  • lost-/start response recovery remains idempotent;
  • E1 behavior intentionally unchanged.

Full fork CI is green on this exact head: 54 files / 551 orchestration tests, migration apply/round-trip path, Paper/Evolver regressions, web/dashboard, consistency, agent eval, and self-host smoke.

Please verify the previous P1s are closed and report only actionable P0/P1/P2 correctness, security, race, durability, migration, or regression findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: e1ec52ec48

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

@TheBayoumi TheBayoumi closed this Aug 31, 2026
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.

1 participant