Skip to content

fix(linux): preserve actions in approval notifications#895

Merged
ilysenko merged 4 commits into
ilysenko:mainfrom
assembledev:fix/linux-notification-actions
Jul 12, 2026
Merged

fix(linux): preserve actions in approval notifications#895
ilysenko merged 4 commits into
ilysenko:mainfrom
assembledev:fix/linux-notification-actions

Conversation

@assembledev

Copy link
Copy Markdown
Contributor

Summary

Closes #893.

  • route action-bearing Linux notifications through the standard freedesktop
    notification interface
  • forward the selected action index to the existing Codex notification callback
  • retain the current Electron notification as a fail-soft fallback when actions
    are unavailable
  • stage the native bridge for source installs, native packages, AppImage,
    updater rebuilds, and Nix builds

The bridge does not execute commands or make approval decisions. It only
returns the selected notification action to the existing upstream handler.

This is default-on Linux compatibility behavior and does not add an opt-in
Linux feature.

Scope

This change affects approval notifications that already contain upstream
notification actions, such as command and file-change approvals produced by a
Custom approval policy configured through config.toml.

The built-in permissions Ask for approval flow does not currently emit a
desktop notification and is outside the scope of this change.

Validation

  • cargo test -p codex-notification-actions-linux
  • cargo clippy -p codex-notification-actions-linux -- -D warnings
  • node --test scripts/patches/impl/main-process/notifications.test.js
  • node --test scripts/patch-linux-window-ui.test.js — 366 passed
  • bash tests/scripts_smoke.sh
  • nix flake check path:$PWD --no-build
  • built the Nix notification-actions-linux check
  • verified patch idempotence against the current upstream main-process bundle
  • verified a real Custom approval policy notification with action buttons on
    Linux

@ilysenko ilysenko left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the well-isolated, fail-soft implementation. There is one lifecycle issue to address before merge: in bridge mode, close() sets closed = true before the bridge emits its closed event, so emitClose() suppresses the registered close callback. The wrapped Electron notification preserves that event. Please preserve the close-event contract and add a regression test covering programmatic close().

@ilysenko ilysenko left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for fixing the original close-event suppression and adding the regression test. Two blockers remain:

  1. closeRequested is not respected by show(), startFallback(), or the pre-shown failure paths. Closing while the bridge is starting can therefore show the Electron fallback afterward. Please prevent fallback/show after close is requested and add a close-before-shown regression test.
  2. The Nix installer does not export the prebuilt CODEX_NOTIFICATION_ACTIONS_SOURCE and has no Cargo runtime input, so nix run .#installer silently installs without the bridge. Please stage the prebuilt bridge in that path as well.

@ilysenko ilysenko left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed the current head after resolving the notification lifecycle, close/fallback race, stdout-drain, and Nix installer staging issues. Regression coverage is in place and all required checks pass.

@ilysenko
ilysenko merged commit ce510f2 into ilysenko:main Jul 12, 2026
10 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.

Linux approval notifications drop upstream action buttons

2 participants