Skip to content

feat: add OPENCODE_NO_NOTIFY env var to suppress notifications#2

Open
christophkroeppl wants to merge 1 commit intokdcokenny:mainfrom
christophkroeppl:feature/no-notify-env-var
Open

feat: add OPENCODE_NO_NOTIFY env var to suppress notifications#2
christophkroeppl wants to merge 1 commit intokdcokenny:mainfrom
christophkroeppl:feature/no-notify-env-var

Conversation

@christophkroeppl
Copy link
Copy Markdown

@christophkroeppl christophkroeppl commented Mar 29, 2026

Problem

When opencode is invoked programmatically from an external harness — build orchestrators, CI pipelines, automation scripts, etc. — desktop notifications are unhelpful and disruptive. No human is watching the process, so the notifications are pure noise.

Example: worktrunk (wt step commit) calls opencode run to generate commit messages. Each invocation triggers a "Ready for review" desktop notification that interrupts the user even though the process is fully automated and headless.

Solution

A single opt-in environment variable OPENCODE_NO_NOTIFY. When set to "1" or "true", the entire plugin is disabled at initialization — returning {} before any event listeners are registered. This means:

  • No desktop notifications of any kind (idle, error, permission, question)
  • Zero overhead — no handlers, no listeners, no deduplication timers
  • Completely opt-in — existing behavior is unchanged when the env var is not set

Usage

# Suppress notifications for a single invocation
OPENCODE_NO_NOTIFY=1 opencode run "commit this change"

# Or set it in a wrapper/harness script
export OPENCODE_NO_NOTIFY=1
opencode run "$@"

@christophkroeppl christophkroeppl force-pushed the feature/no-notify-env-var branch 3 times, most recently from e86dbf4 to 08dc78c Compare March 29, 2026 10:10
@christophkroeppl
Copy link
Copy Markdown
Author

There's a couple of open issues and PRs on OpenCode tackling plugin management but none allow for disabling a plugin for a single execution. Also this feature is easy enough to remove in the future if oc decides to impl. plugin suppression.

When opencode is invoked programmatically from an external harness
(build orchestrators, CI pipelines, automation tools), desktop
notifications are unhelpful and disruptive. Example: worktrunk
(wt step commit) calls opencode run to generate commit messages —
these sessions send "Ready for review" notifications that are pure
noise since no human is waiting for them.

Setting OPENCODE_NO_NOTIFY=1 or OPENCODE_NO_NOTIFY=true disables
all notification types by returning an empty plugin at init time.
This is opt-in — existing behavior is unchanged when the env var
is not set.
@christophkroeppl christophkroeppl force-pushed the feature/no-notify-env-var branch from 08dc78c to 8bc0f82 Compare March 29, 2026 10:19
@christophkroeppl christophkroeppl marked this pull request as ready for review March 29, 2026 10:21
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