Skip to content

fix(approvals): reject stale controls after lifecycle replacement - #123075

Closed
RomneyDa wants to merge 22 commits into
mainfrom
split/approval-ui-aug13
Closed

RomneyDa wants to merge 22 commits into
mainfrom
split/approval-ui-aug13

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Related: #114492 (intentional focused split; the source PR is otherwise untouched)

What Problem This Solves

Fixes an issue where an older approval control could decide a newer approval after an ID was reused. The same race could also remove a replacement approval from the Control UI or attach the older decision's error to it.

Why This Change Was Made

The Gateway now mints a unique lifecycle instance for every approval and validates it at the final resolution owner. That instance is carried through protocol events, durable presentation state, typed actions, first-party apps, the SDK, MCP/ACP/TUI/CLI clients, and Discord, Slack, Telegram, and iMessage controls. Portable reaction/card bindings now carry the same lifecycle instance through Signal, WhatsApp, Matrix, Google Chat, and Teams to the final Gateway resolver. The Control UI separately reconciles an awaited decision only with the exact approval generation it captured.

The protocol addition is backward compatible: controls that carry an instance fail closed when the ID now names another lifecycle, while shipped tokenless clients retain their existing ID-based route. Existing ID-only resolution-reference digests are unchanged.

User Impact

Approval controls now authorize only the prompt that created them. Reused-ID replacements remain visible and actionable, stale channel buttons/reactions cannot decide a newer request, and matching current controls continue to resolve normally across first-party surfaces.

Evidence

Visual proof shows the reused-ID replacement arriving, remaining actionable after the older decision fails, and resolving normally. Capture code and media are not committed.

Replacement arrives while the older same-ID decision is pending:

Replacement approval arrives

Replacement remains actionable after the older decision fails:

Replacement approval remains actionable

Replacement resolves normally:

Replacement approval resolved

@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 13, 2026
@RomneyDa
RomneyDa marked this pull request as ready for review August 13, 2026 08:33
@RomneyDa
RomneyDa force-pushed the split/approval-ui-aug13 branch from 68f6e1a to dbec031 Compare August 13, 2026 08:58
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 2, 2026, 9:28 PM ET / September 3, 2026, 01:28 UTC.

ClawSweeper review

What this changes

The PR carries a per-approval lifecycle instance from the Gateway through channel and UI controls so an old control for a reused approval ID cannot resolve its replacement.

Merge readiness

⛔ Blocked before merge - 7 items remain

Authority-chain proof required: the Gateway-side lifecycle validation is coherent, but this conflicting branch still lacks real Telegram evidence that a stale authorized callback cannot resolve a replacement approval.

Priority: P1
Reviewed head: 8300e46d4a5db58c4f847d60d94bde644bad6fe9

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The source design is coherent, but the authority-sensitive Telegram path remains insufficiently demonstrated and the reviewed head conflicts with main.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 8 items Lifecycle value is created by the approval owner: Each approval record receives a random lifecycle instance identifier.
Final Gateway decision validates the lifecycle: The shared resolver rejects a request whose supplied lifecycle instance does not match the live snapshot before it invokes resolution.
Telegram carries the bound value: Telegram encodes the instance in approval callback data when available, including its bounded durable resolution reference fallback.
Findings None None.
Security None None.

How this fits together

The Gateway creates approval requests and channels or UI clients present them as controls. When a control is submitted, the Gateway decides whether it still refers to the live approval before applying a decision.

flowchart LR
  A[Approval request] --> B[Gateway approval manager]
  B --> C[Lifecycle-bound record]
  C --> D[Channel and UI controls]
  D --> E[Resolution request]
  E --> F[Gateway lifecycle check]
  F --> G[Resolve or reject]
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch as conflicting, so the reviewed lifecycle checks must be preserved through a rebase and rerun at the resulting head.
  • Resolve merge risk (P1) - The changed Telegram authorization callback path has no real Telegram Test Server trace covering stale rejection, replacement preservation, and matching replacement success.
  • Resolve merge risk (P1) - The change adds substantial production/support code across decision producers and consumers; retaining that growth is justified only if the final authority boundary is demonstrated end to end.
  • Resolve merge risk (P1) - Optional lifecycle fields and lifecycle-sensitive durable locators require exact-head upgrade and legacy-client compatibility validation after rebase.
  • Complete next step (P2) - Rebase onto current main, rerun exact-head checks, and add a redacted Telegram Test Server trace proving that an authorized stale same-ID callback is rejected before Gateway resolution, the replacement remains actionable, and its matching callback succeeds.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Judged production versus test delta production/support +569/-104; tests +610/-20 The positive production growth spans lifecycle propagation and validation; its security-boundary justification needs exact-head end-to-end proof.

Stored data model

Persistent data-model change detected: unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Rebase and prove the Telegram authority path (recommended)
    Resolve the conflict, rerun exact-head validation, and add a redacted Telegram Test Server stale/current callback trace through the Gateway resolver.
  2. Pause if real callback proof is infeasible
    Do not merge an authority-sensitive cross-surface change without proof at the changed Telegram control boundary.

Technical review

Best possible solution:

Rebase cleanly, retain the Gateway as the final lifecycle authority, and provide a redacted Telegram Test Server trace showing stale rejection before resolution, an actionable replacement, and successful matching resolution.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: create an approval, replace it under the same ID, then submit the old lifecycle-bound control; the Gateway should reject it before resolution. This review did not execute that scenario.

Is this the best way to solve the issue?

Yes: propagating the instance and checking it at the Gateway final decision owner prevents stale controls from resolving a replacement while preserving the intentional tokenless legacy route.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2d9796d66c43.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: Optional lifecycle values and durable resolution references must preserve tokenless legacy-client behavior after the rebase.
  • add merge-risk: 🚨 security-boundary: The new lifecycle value is used to authorize approval controls at the Gateway's final decision boundary.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. This changes Telegram approval callback resolution, so the user-visible callback flow needs Telegram Test Server proof.

Label justifications:

  • P1: A stale approval control could otherwise affect an active approval workflow by acting on a replacement record.
  • merge-risk: 🚨 security-boundary: The new lifecycle value is used to authorize approval controls at the Gateway's final decision boundary.
  • merge-risk: 🚨 compatibility: Optional lifecycle values and durable resolution references must preserve tokenless legacy-client behavior after the rebase.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. This changes Telegram approval callback resolution, so the user-visible callback flow needs Telegram Test Server proof.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase onto current main and rerun relevant exact-head checks.
  • Provide a redacted Telegram Test Server trace proving stale rejection, retained replacement actionability, and successful matching resolution.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (21 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-21T09:26:48.021Z sha 0bddb18 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T03:19:15.854Z sha cadce5d9cffad604ae988e3a0fe95d16aaa6b457 :: needs real behavior proof before merge. :: [P1] Bind iMessage native controls to the approval instance
  • reviewed 2026-08-26T04:15:08.315Z sha 0ac8ba6 :: needs real behavior proof before merge. :: [P1] Carry the lifecycle token through iMessage controls
  • reviewed 2026-08-26T07:06:40.666Z sha db85299 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-28T22:35:41.506Z sha ba89a65 :: found issues before merge. :: [P1] Carry lifecycle identity into generic reaction controls
  • reviewed 2026-08-28T22:49:59.489Z sha cc133f7 :: found issues before merge. :: [P1] Bind generic reaction controls to the lifecycle instance
  • reviewed 2026-08-28T23:30:12.104Z sha 05614f0 :: found issues before merge. :: [P1] Bind WhatsApp reaction targets to the lifecycle instance
  • reviewed 2026-08-29T00:01:17.231Z sha 24e115e :: needs real behavior proof before merge. :: none

@RomneyDa
RomneyDa force-pushed the split/approval-ui-aug13 branch 2 times, most recently from f7fd886 to 05a6425 Compare August 13, 2026 13:14
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 14, 2026
@RomneyDa
RomneyDa force-pushed the split/approval-ui-aug13 branch from 05a6425 to 8d929b8 Compare August 16, 2026 08:48
@clawsweeper clawsweeper Bot removed the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Aug 16, 2026
@RomneyDa
RomneyDa force-pushed the split/approval-ui-aug13 branch from 8d929b8 to d096e80 Compare August 16, 2026 09:00
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Aug 19, 2026
@RomneyDa
RomneyDa force-pushed the split/approval-ui-aug13 branch from d096e80 to 00ee922 Compare August 21, 2026 02:04
@RomneyDa

Copy link
Copy Markdown
Member Author

Rebased onto current main and resolved the approval-flow conflicts at exact head 00ee922aa0b8d89a76affda6cc6c3077128a2fbd.

Preserved both current-main approval UI/E2E coverage and this PR's same-ID generation guard. git diff --check passes, and the required diff-scoped Codex autoreview reports no accepted/actionable findings. Local and Testbox test launch are currently unavailable on this host because the checkout has no installed tsx/pnpm; exact-head CI is the remaining executable proof.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 21, 2026
@RomneyDa
RomneyDa force-pushed the split/approval-ui-aug13 branch from 00ee922 to 087d52f Compare August 21, 2026 03:49
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@RomneyDa

Copy link
Copy Markdown
Member Author

Closing as superseded on current main. Operator approvals now persist a unique opaque resolution reference and resolve through the durable first-answer-wins store/CAS path across channel and UI consumers. That canonical locator already rejects stale controls after lifecycle replacement without carrying the old optional instance field through 100+ clients. Canonical owner stack includes #103579, #104837, and #117095.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: android App: android app: ios App: ios app: macos App: macos app: web-ui App: web-ui channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web cli CLI command changes gateway Gateway runtime maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant