Skip to content

fix(permissions): ignore stale permission updates#621

Merged
shantur merged 2 commits into
NeuralNomadsAI:devfrom
pascalandr:fix/permission-modal-repeat
Jul 26, 2026
Merged

fix(permissions): ignore stale permission updates#621
shantur merged 2 commits into
NeuralNomadsAI:devfrom
pascalandr:fix/permission-modal-repeat

Conversation

@pascalandr

@pascalandr pascalandr commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve the original V2 source when permission.updated changes an already-pending request, so approval continues through the V2 reply API instead of the legacy endpoint.
  • Keep standalone permission.updated events as valid legacy requests for older supported OpenCode binaries.
  • Continue suppressing delayed post-reply updates through the existing replied-request tombstone, preventing an approved request from reappearing.

Reproduced failure

The regression test fails on dev before the fix: permission.v2.asked followed by permission.updated changes the request source to legacy, so approval calls the legacy endpoint and never reaches the V2 reply API.

Compatibility coverage

  • V2 request plus permission.updated replies through V2
  • delayed permission.updated after a successful local reply does not re-enter the queue
  • standalone legacy permission.updated remains visible and replies through legacy

Scope

This PR intentionally does not add speculative timeout, reconnect, or modal-rendering changes. It only fixes the reproduced source-routing bug and preserves verified legacy behavior.

Validation

  • npm run typecheck
  • npm run build --workspace @codenomad/ui
  • 144 existing runnable UI tests passed
  • browser integration tests passed, including all permission lifecycle regressions

Closes #566

Treat permission.updated as an update to an existing pending request instead of a new legacy request. This preserves the V2 reply route and prevents delayed orphan updates from recreating an already-cleared permission modal.

Add browser-store regression coverage proving V2 requests still use the V2 reply API and orphan updates stay out of the queue, and run it in PR validation.

@pascalandr pascalandr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Gatekeeper review - round 1

Finding (P1): the new orphan permission.updated guard drops valid initial legacy permission requests. Supported older OpenCode binaries can emit permission.updated as the sole initial request event, so their sessions would remain blocked with no permission visible in CodeNomad.

Deterministic result: a standalone legacy permission.updated leaves both UI permission queues empty.

Required fix: accept standalone permission.updated as legacy, preserve the existing source when it updates an already-pending V2 request, and rely on replied-request tombstones to reject delayed post-reply updates.

Status: changes requested; another published gatekeeper round will follow.

Accept standalone permission.updated events as legacy requests for older supported OpenCode binaries while preserving the source of already-pending V2 requests.

Extend regression coverage to prove standalone legacy requests remain actionable and delayed updates stay suppressed after a successful local reply.

@pascalandr pascalandr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Gatekeeper review - round 2

Zero actionable findings.

Verified:

  • standalone permission.updated remains a valid legacy request
  • permission.asked remains legacy
  • permission.v2.asked followed by permission.updated preserves the V2 reply route
  • delayed permission.updated after a successful reply does not re-enter either permission queue
  • malformed permission IDs are ignored

Relevant UI tests, browser integration tests, typecheck, and UI build pass. Residual limitation: no direct reproduction on the reporter's Windows device.

@pascalandr

Copy link
Copy Markdown
Contributor Author

@shantur LGTM

@github-actions

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/29919742236

Artifacts expire in 7 days.
Artifacts:

  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-tauri-macos
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-tauri-windows
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-electron-macos
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-tauri-macos-arm64
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-tauri-linux
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-electron-linux
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-electron-windows

1 similar comment
@github-actions

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/29919742236

Artifacts expire in 7 days.
Artifacts:

  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-tauri-macos
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-tauri-windows
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-electron-macos
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-tauri-macos-arm64
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-tauri-linux
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-electron-linux
  • pr-621-a53cdf8598aed9403f0b25e38feca752ad642da8-electron-windows

@shantur
shantur merged commit 70c9548 into NeuralNomadsAI:dev Jul 26, 2026
15 checks passed
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.

Permission request keeps reappearing after being granted, causing app freeze

2 participants