GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(core): add push notifications for the mobile apps by Tarquinen · Pull Request #66130 · anomalyco/opencode

Conversation

@Tarquinen

@Tarquinen Tarquinen commented Nov 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Issue for this PR

No issue; this is a new feature.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds push notifications for the mobile apps to the server.

A phone registers with the server, and the server notifies it when a session:

  • finishes or fails
  • asks a question
  • asks for permission

Also:

  • Notification text is end-to-end encrypted, so the relay that delivers it can't read it.
  • Each phone picks a level: everything, only when a session needs you, or nothing. A session can override that with its own bell, for one phone or for all of them.
  • Notifications can be paused for the whole server or for one phone.
  • Phones can be listed and removed.
  • A notification is removed from the phone when it goes stale: the question or permission was answered elsewhere, a finished session got a new message or was opened on another client, or the session was deleted. A view reported within 5 seconds of the turn ending is ignored, since a client with the session already open reports it whether or not anyone is looking.

There is no feature flag: push is on for everyone, and does nothing until a phone registers. The routes are under /api/experimental/push, so the API can still change.

Phones are only reached through the two OpenCode notification relays (production and dev); a callback URL anywhere else is rejected.

How did you verify your code works?

Typecheck and the new tests pass. A real Android phone running anomalyco/opencode-android#297 received and cleared notifications from a server on this branch.

Screenshots / recordings

No UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Public API: adds experimental /api/experimental/push routes, client operations, Push schema types and the experimental.push.updated event (backwards compatible)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Tarquinen added 13 commits November 24, 2026 20:11
@Tarquinen
feat(core): register phones for push notifications behind the push flag
747af9e
Add /api/experimental/push with GET (phones and settings) and PUT/DELETE
device/<id>, which keeps one KV record per phone, checks the relay callback URL
against the allowed relays and answers with the server's P-256 key for the
phone. /api/info gains capabilities.push while the flag is on, and a push
config setting adds relays beyond the production one.

Verified: bun typecheck in schema, protocol, core, server; core
test/push-list.test.ts and server test/push-routes.test.ts pass.
@Tarquinen
feat(core): add push pauses, session bells and the push.updated event
193457b
Phones can be paused (PATCH device/<id>), each phone can set its own bell for a
session, a session can have a shared bell, and everything can be paused until a
time (settings). Bells and pauses survive re-registration, expire at their
until, and bells are dropped when their session is deleted. Every change
publishes push.updated so clients refetch.

Verified: bun typecheck in core, server, protocol, client; core
test/push-list.test.ts (8 pass), server test/push-routes.test.ts (3 pass),
protocol bun test.
@Tarquinen
feat(core): encrypt and send push notifications through the relay
593ad24
PushSender picks each phone's level (everything paused, phone paused, the
phone's session bell, the shared bell, the phone's default), builds the
v1 message, shortens the body so it fits the relay's box limit, seals it with
AES-256-GCM under the phone's shared key and posts {box} to its callback URL
with a 10 s timeout and no redirects. 404/410 remove the phone, 5xx and network
errors retry twice, anything else moves on. Sending runs in the background.

Verified: core bun typecheck; test/push-sender.test.ts reproduces the Android
app's known box and covers gone, failing and filtered phones against a fake
relay; test/push-list.test.ts still passes.
@Tarquinen
feat(core): notify phones when a top-level session finishes
9122b96
The push watcher subscribes to session.execution.succeeded, failed and
interrupted (inactivity only) server-wide and sends 'Finished', 'Failed'
or 'Stopped' for sessions without a parent. PushOptions becomes a small
global service so the watcher and the server handlers share it.

Verified: bun typecheck (core, server); core push-list, push-sender and
push-watcher tests (13 pass); server push-routes tests (3 pass).
@Tarquinen
feat(core): notify phones when a session asks a question or for permi…
ba18129
…ssion

The push watcher also subscribes to form.created (question forms only)
and permission.asked server-wide, including from subagents. The
notification carries the top-level session's ID and title, the first
question's text or 'Needs permission: <action>', and counts as 'needs
you', so it passes the attention level.

Verified: bun typecheck (core); push-watcher tests (2 pass).
@Tarquinen
fix(core): keep a renewed phone when its old push URL is gone
5f72aa8
The sender now removes a phone on 404/410 only if the stored callback URL is
still the one it posted to, checked under the list's lock, so a phone that
re-registered meanwhile keeps its new registration and bells. Registering over
an expired entry starts afresh instead of reviving its pause, bells and key.
Callback URLs must be exactly canonical (no empty query, fragment, userinfo or
dot segments). A failure while dropping a deleted session's bells is logged
instead of ending the subscription.

Verified: bun run script/test.ts test/push-list.test.ts (10 pass).
@Tarquinen
fix(core): fit push messages to the relay and skip removed relays
1a1d8c3
The sender shortens the body and then the title by their encoded JSON size, so
multi-byte and escaped text keep as much as fits and long titles no longer
overflow the relay's box limit. Phones on a relay no longer in config get no
posts. Each phone's send runs on its own, logging any defect instead of
cancelling the others. The response body is drained, and HTTP client tracing is
off for these requests so callback URLs never reach span attributes.

Verified: bun run script/test.ts test/push-sender.test.ts (4 pass, incl. 404
removal, 429 dropped, redirect manual, removed relay skipped).
@Tarquinen
fix(core): notify finished only after a model turn
3c32c50
session.execution.succeeded fires for any busy period, including session moves,
revert clears and manual compactions; the watcher now sends Finished only when a
model step started in that period. Drops the inactivity Stopped notification,
since nothing emits that reason. The watcher reads the flag only when a phone is
registered, treats an empty title as missing, and logs handler defects instead
of ending its subscriptions.

Verified: push-watcher tests (2 pass); against a local server, a prompt sent one
Finished push and revert clear, compact and move sent none.
@Tarquinen
fix(core): advertise only https push relays from config
430261f
Config relays that aren't https URLs or repeat the default are left out of the
allowed list and capabilities.push.relays. Also builds the info capabilities
once and adds push to the client's expected experimental groups.

Verified: bun test in packages/client (269 pass), server push-routes (3 pass).
@Tarquinen
refactor(core): reshape the push API after review
5e7bd9a
@Tarquinen
refactor(core): allow only the one notification relay
88f3f14
@Tarquinen
fix(core): accept the dev notification relay
d5ce17a
@Tarquinen
feat(core): clear phone notifications that were answered elsewhere
b4e9a93
@Tarquinen
Tarquinen force-pushed the push-notifications branch from 9c81bfa to b4e9a93 Compare November 25, 2026 01:12
Tarquinen added 4 commits November 24, 2026 21:06
@Tarquinen
feat(core): turn push notifications on for everyone
074740e
@Tarquinen
chore(core): drop a stray blank line
d23b13a
@Tarquinen
refactor(core): rename the push device param, error and event
5541783
@Tarquinen
fix(core): clear phone notifications of a deleted session
420ca5d
@github-actions github-actions Bot mentioned this pull request Nov 25, 2026
📊 AI CLI 工具社区动态日报 2026-11-25 litang9/big_model_radar#756
Open
Tarquinen added 5 commits November 24, 2026 23:03
@Tarquinen
fix(core): tighten push validation and brand the device id
181091f
@Tarquinen
fix(server): reject push bells on subagent sessions
50558ac
@Tarquinen
fix(core): forget sent push notifications after a week
9767089
@Tarquinen
feat(core): clear a finished push notification once the session is vi…
64d526e
…ewed
@Tarquinen
fix(core): ignore push views within five seconds of a turn ending
aacb11b
@Tarquinen
Tarquinen marked this pull request as ready for review November 25, 2026 04:32
opencodejr[bot]
opencodejr Bot reviewed Nov 25, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I found nothing that should block this. I ran the new core, server and client tests (all pass) and a tsc -b build of packages/server (no errors), and read through the list, sender and watcher. I couldn't check delivery end to end because that needs the relay and a phone.

The push state is wired sensibly: Bus and Session are global nodes, so the global watcher sees every session's events. Notifications from subagents go under the top-level session, so its bell applies. Callback URLs are limited to the two relays. Errors in the watcher, sender and the cleanup on session deletion are logged and swallowed, so they can't take the server down. The tests use TestClock and a stubbed fetch, with no real network calls or sleeps.

Public API (all additions, backwards compatible):

  • New HTTP routes under /api/experimental/push:
    • GET /
    • PUT, PATCH and DELETE on /device/:deviceID
    • PUT and DELETE on /device/:deviceID/session/:sessionID
    • PUT and DELETE on /session/:sessionID
    • PUT /settings
  • Matching operations in the OpenAPI spec (experimental.push.*), the TS client (experimental.push.*) and the Rust and Luau clients.
  • A new PushDeviceNotFoundError (404).
  • New Push.* schema types.
  • A new ephemeral experimental.push.updated event, added to the event manifest and to the event-subscribe filter.

No existing route, type or event changes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Tarquinen and others added 4 commits November 24, 2026 23:38
@Tarquinen
test(sdk): catch the closed event stream before closing the host
e65857e
@Tarquinen
fix(core): clear a finished push notification on any later view of th…
85d5198
…e session
@Tarquinen
Revert "fix(core): clear a finished push notification on any later vi…
8e462a1
…ew of the session"

This reverts commit 85d5198.
@Tarquinen
Merge branch 'dev' into push-notifications
085aa6e
opencodejr[bot]
opencodejr Bot reviewed Nov 25, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Nothing new to raise. The push code is identical to what I reviewed last time: the change to clearing a finished notification on view is added and then reverted, and the rest is a merge of dev. The one remaining change, attaching the catch before close() in packages/sdk/test/promise.test.ts, is a sound fix for a rejection that could otherwise go unhandled. The SDK promise tests (3) and the core push tests (22) pass. The public API is unchanged from my last review.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Tarquinen
Tarquinen merged commit 4c2977b into dev Nov 25, 2026
13 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Tarquinen
Tarquinen deleted the push-notifications branch November 25, 2026 04:52
@Edo771977 Edo771977 mentioned this pull request Nov 25, 2026
chore: merge upstream/dev into the fork Edo771977/opencode#101
Merged
@opencodejr opencodejr Bot mentioned this pull request Nov 25, 2026
Permission push notifications don't carry what is being asked #66444
Closed
@steventsao steventsao mentioned this pull request Nov 25, 2026
iOS: background push notifications for OpenCode sessions steventsao/byot#73
Open
@simonklee simonklee mentioned this pull request Nov 25, 2026
fix(cli-rs): bring the Rust client level with the TUI #66470
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Tarquinen
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.