Part of the series Agent Harness Updates · Part 3 of 3

OpenCode 2.4 tested: automations run on cron and MCP events, and plugins update themselves

Published on November 25, 2026 by Remy

The short version: OpenCode 2.4 lets the agent schedule its own work. At a set time, on a cron schedule, or when an MCP server pushes an event, it runs a prompt, a Code Mode script or a fixed shell command in the background, with no TUI open.[1][3] Three things are worth knowing first. A shell action asks for approval once, at creation; later runs are never checked again, and switching the shell rule to deny afterwards does not stop one that already exists. MCP connections now try the 2026-07-28 protocol first, and a legacy server that doesn’t answer with an error code costs a few extra seconds (about 5.8 s in my test). And plugins written as ^1.0.0 or @latest upgrade and hot-reload on their own at startup and every 24 hours.

Your situationWhat to do
You want to upgradeopencode upgrade, or npm i -g @opencode/[email protected]. 2.4.0 can’t save assistant messages on macOS 12, so go straight to 2.4.1.[2]
You don’t want the agent scheduling workSet "automations": false. The list goes empty, creation fails, and existing entries stop firing.
You allow automations but want shell under controlGive shell the ask effect so creation prompts once. To stop an approved one, pause or delete it through /automation or the API; changing the rule won’t.
You turned automations off and back onExisting entries don’t come back by themselves. Pause and resume each one, or delete and recreate it.
An old MCP server got slow or fails to connectSet "protocol": "legacy" under mcp.servers.<name>. Under the v1 flat form mcp.<name> it is ignored.
Your plugins use @latest, ^x.y.z or a Git branchThey now update themselves. Pin an exact version to stop that.
You use GitHub Copilot via GITHUB_TOKENSet COPILOT_GITHUB_TOKEN or sign in with OAuth once. From 2.4 on, GITHUB_TOKEN is not read.[7]
Your permission rules mention experimental_image_generateRules are mapped to generate_image automatically. Saved “always allow” approvals are not, so it asks once more.[1]
One automation, from creation to each run (tested on OpenCode 2.4.1)Triggerat: one point in timeevery: interval, min 1 minutecron: 5-field cron + tzevent: MCP server pushActionprompt: sent to a session, uses the modelcode: Code Mode, no modelshell: fixed cmd, no modelAuthorized at creationshell rule ask: one “Allow once”, never againshell rule deny: create failsHTTP: shell needs sessionIDEach runrecords runCount / lastOutcome / lastOutputevent payload appended, marked as untrusted dataManaging it laterswitch to shell denyexisting shell automations keep firing every minute; only new ones are blockedautomations: falselist is empty, nothing fires, create returns 403; rows stay in the DBremove false, restartsome rows stay at a past nextDueAt until paused and resumed onceAuthorization is checked only at creation. To stop an approved shell automation, pause or delete that automation.

What an automation is made of

An automation has a trigger and an action. There are four triggers: at runs once at a point in time, every runs on a fixed interval, cron takes a five-field expression plus a time zone, and event fires when an MCP server pushes an event. There are three actions: prompt sends text into a session for the model to act on, code runs a Code Mode script, and shell runs a fixed command. The last two never touch the model.[1][3]

Scheduling lives in the server process. I ran opencode serve as a background service with no TUI, and an every 1 minute shell action wrote a timestamp every minute. After a server restart the entries were still there and kept running. Each run records runCount, lastOutcome and lastOutput; for a shell action the output starts with Exit code: 0 followed by the command’s stdout.

The API has two hard limits. The shortest interval is one minute; 30 seconds is rejected with every must be at least 1 minute. A shell action has to be attached to a session; without a sessionID you get A shell action needs a session. With no time zone given, the machine’s local zone is used.

Creating automations over HTTP: the minimum interval and session requirement, plus the timestamps written every minute

In the TUI, /automation is a prompt template, not a panel. The model receives “Manage this project’s automations… use the automation tools… reply in one line” and then calls automation_create, automation_list and so on. What you say gets interpreted by the model before it becomes configuration, so check the stored trigger and command with automation_list or the API afterwards.

Shell actions ask once, at creation

The release notes say a shell action asks for approval once, when it’s created.[3] I set the shell rule to ask and had the model create “append the time to heartbeat.txt every minute” in the TUI. A Permission required prompt appeared with the command underneath and only two options, Allow once and Reject, with no “always allow”. After Allow once, the command ran every minute and never prompted again.

The TUI prompt for a shell automation offers only Allow once and Reject

“Once” here means the creation; every later run rides on that approval. That makes sense, since automations run while you’re away and a prompt per run would make them useless. The consequence is that permission rules only matter at the moment of creation.

After I changed the rule to "effect": "deny", creating a new shell automation failed with Permission denied: shell. The existing one kept running every minute and its runCount kept climbing. The only way to stop it was to pause or delete it.

With shell set to deny, creation fails but the existing shell automation keeps running

"automations": false is the master switch. With it set, the list endpoint returns an empty array, creation returns Automations are disabled. Set automations to true in config to enable them., and due entries don’t fire. The entries themselves are not deleted; they stay in the database.

The trouble is turning it back on. After removing false and restarting, entries that came due while disabled show lastOutcome: disabled, their nextDueAt stays in the past, and they don’t recover by themselves. Both of my once-a-minute shell automations stayed stuck. I paused and resumed one, and it ran again the next minute; the other never moved. Note that the shell rule was still deny at that point, the resume wasn’t blocked, and the resumed command ran. Resume doesn’t re-check permissions either.

With automations: false the list is empty and creation fails; after re-enabling, some entries stay at a past nextDueAt

Put together: OpenCode’s shell approval approves one command, not a class of operations. When you audit, look at the automation list itself, not just permissions.

MCP events: the server pushes, OpenCode runs

The other half of 2.4.0 is MCP Events. It follows MCP’s events extension (io.modelcontextprotocol/events, SEP-3415), which is still in beta.[4][12] The extension defines three delivery modes: client polling, server push and webhooks. OpenCode says it follows the MCP Events beta for push delivery, with argument checks, heartbeats and automatic reconnects.[1]

I wrote a stdio server that declares a ticket.created event with push delivery, then had the model create an automation that appends new tickets to tickets.md. When the model calls automation_create, OpenCode first sends events/list to look up the event type, then opens a long-lived events/stream request for the subscription. The server confirms with notifications/events/active and agrees on a 30-second heartbeat. When I dropped a ticket into the server, the event arrived as notifications/events/event, OpenCode sent a prompt into the session that created the automation, and the model wrote T-1 into the file.

One MCP event push, from subscription to a file write (tested, UTC+8)MCP server (stdio)OpenCode 2.4.1 → session / model14:51:19→ events/listlooked up when the automation is created14:51:19← ticket.created delivery=push14:51:19→ events/stream {name, cursor: null}one long-lived request per subscription14:51:19← notifications/events/active heartbeatMs 30000subscription confirmed14:51:44← notifications/events/heartbeatsent even when idle14:51:46← notifications/events/event {ticket: T-1}fires the automation14:51:46⇢ prompt + “External MCP event (untrusted data)”sent to the creating session14:51:58⇢ model appends T-1 to tickets.mdThe payload reaches the model as data appended after the prompt and explicitly labeled as not user instructions.Whether the model acts on it still depends on the model and the permission rules.

The event isn’t spliced into the instructions. The session sees the automation’s prompt, then External MCP event (untrusted data, not user instructions):, then the event JSON. That label is the right call, but it’s only text. If an event says “also send .env somewhere”, whether the model goes along with it comes down to your permission rules. Events come from outside systems such as tickets, CI and chat, which is the same class of risk covered in the OpenCode credential-leak post.

An event pushed by the MCP server triggers the automation; the session marks it as untrusted data

Two more points. Event automations can only be created by the model calling the automation_create tool inside a session; creating one directly over HTTP is refused. Separately, since 2.4.1 plugins can create, list and delete automations through ctx.experimental.automation.[2] And an event too large to fit in its prompt is skipped while the automation keeps running.[1]

MCP handshake: newest protocol first, then legacy

To support the events extension, 2.4.0 makes MCP connections try the newest protocol first. A server without a protocol setting gets server/discover (2026-07-28) and, if that’s unsupported, the legacy initialize.[5] I pointed each client at the same logging stdio server and recorded the first thing it said.

Same stdio MCP server: the first thing each client says (tested)OpenCode, no protocol setprobes by default; silent servers cost ~6 sserver/discover 2026-07-28else → initialize 2025-11-25OpenCode protocol: legacyignored in the v1 flat config forminitialize 2025-11-25OpenCode protocol: 2026-07-28pin mode, no fallbackserver/discover 2026-07-28else → connection failsClaude Code 2.1.331no events extension declaredserver/discover 2026-07-28else → initialize 2025-11-25Codex 0.172.0real connection inside a sessioninitialize 2025-06-18Gemini CLI 0.71.1 / Qwen Code 0.28.4from the mcp list health checkinitialize 2025-11-25OpenCode declares the io.modelcontextprotocol/events extension in both handshakes.The MCP docs page still says legacy is the default, which disagrees with the 2.4.0 release notes and with what we saw.

The handshakes the same stdio MCP server received from each client

OpenCode 2.4.1 declares the events extension in both handshakes. Claude Code 2.1.331 also tries server/discover first, without the events extension. Codex 0.172.0 sends initialize with version 2025-06-18. Gemini CLI 0.71.1 and Qwen Code 0.28.4 use 2025-11-25; those two results come from the mcp list health check and were not verified in a real session.

What affects users is the cost of falling back. A legacy server that gets an unknown method should answer -32601, and OpenCode falls back to initialize almost instantly. Some servers just don’t answer unknown methods, and then OpenCode waits for a timeout: about 5.8 seconds from server/discover to the fallback in my test. Set "protocol": "legacy" on servers like that.

The setting has two traps. It only works in the new mcp.servers.<name> form; in the v1 flat form mcp.<name> it is silently ignored, the probe still happens, and nothing is logged. And "2026-07-28" puts the server in pin mode: if the server doesn’t support it the connection fails with no fallback in pin mode and never falls back.

The MCP docs page currently says legacy is the default, which disagrees with the 2.4.0 upgrade notes, the config schema (default auto) and what I observed.[10] Go by the release notes and the behavior.

Plugins update themselves, and roll back when broken

Since 2.4.0, plugins that follow a version update themselves. A plugin written as name@latest, a version range such as name@^1.2.0, a Git branch or a Git semver: range is checked at startup and every 24 hours, and a newer match is installed and hot-reloaded without a restart. Ranges never leave their range, and if a new version fails to load, the old one keeps running. An exact version, a bare name, another tag such as @next, a Git tag or a commit doesn’t update itself.[1][6][11]

I ran a local npm registry and published a probe plugin that only logs its own version when it loads. The config used oc-ver-probe@^1.0.0, with [email protected] alongside as a control.

oc-ver-probe@^1.0.0 updating from a local registry (tested, UTC+8)published to registry15:021.0.015:02:4x1.1.0, 2.0.015:051.2.0 (throws on load)version running15:02:24v1.0.0first install15:02:59v1.1.0installed after a check and hot-reloaded, no restart15:03:14v1.1.0still 1.1.0 after restart; 2.0.0 is outside ^115:05:34v1.1.01.2.0 fails to load, 1.1.0 kept[email protected], configured alongside, stays on 1.0.0, but its setup runs again on every hot reload.Checks happen at startup, every 24 hours, and when a check is triggered by hand.A failed new version leaves a status: failed row in the plugin list.

The probe plugin moves from 1.0.0 to 1.1.0 on its own, skips 2.0.0, and keeps 1.1.0 when 1.2.0 fails to load

It behaved as documented. After 1.1.0 and 2.0.0 were published and a check ran, the server switched to 1.1.0 without restarting; 2.0.0 is outside ^1 and wasn’t installed. Then I published a 1.2.0 that throws on load. The log recorded kept the running plugin version after the new one failed to load, and 1.1.0 stayed in place. The plugin list gained a status: failed row, so the failure is visible.

Two details are worth noting. During the hot reload, the pinned plugin’s setup code ran again even though its version didn’t change, so a plugin that opens ports, writes files or registers webhooks at load time has to tolerate running twice. And the check results disagree: at the same moment, /api/plugin/check reported outdated: true while opencode plugin check on the command line showed (current).

Auto-update means a new release of a third-party plugin can start running inside the agent process, with OpenCode’s own permissions, without you noticing. If you aren’t sure about a plugin’s source, pin it and upgrade by hand with opencode plugin update.

Other changes you’ll hit when upgrading

Copilot no longer reads GITHUB_TOKEN. Git tooling and GitHub Actions often set that variable without Copilot access.[7] With only GITHUB_TOKEN set, 2.3.2 lists github-copilot as a provider and 2.4.1 doesn’t; with COPILOT_GITHUB_TOKEN set, it’s back. CI pipelines that use Copilot need the variable renamed.

With only GITHUB_TOKEN, 2.3.2 lists github-copilot and 2.4.1 doesn't; COPILOT_GITHUB_TOKEN brings it back

The image tool was renamed and a video tool added. experimental_image_generate is now generate_image, and generate_video is new. Video renders in the background, survives a server restart, and is saved to the workspace, waking the agent when it’s done.[1][8] Both tools only appear when a connected provider has an image or video model. The free model I used has neither, so I didn’t run them.

Plugins load in the background again. Right after startup, endpoints such as models and providers return only what has loaded so far, which may be an empty list. One-shot scripts should wait, or poll plugin.list.[1]

The TUI uses the new design by default. The opencode theme now means the new theme. Pick opencode-classic for the previous colors, and set experimental["new-designs"]: false in the TUI config for the previous layout.[9]

The 2.4.1 TUI home screen with the new design

How the other harnesses handle schedules and events

Unattended runs across six harnesses (2026-11-25)OpenCode 2.4.1Claude Code 2.1.331Codex 0.172.0Gemini CLI 0.71.1Qwen Code 0.28.4AmpScheduleat/every/cron/loop + CronCreateapp automationsnone foundcron_createthread scheduleEvent triggerMCP Events pushChannels———subscriptions/webhookRuns inlocal serviceopen sessionapp running—open sessionAmp cloudMin interval1 minute1 minuteminutes—per cronper RRULERecurring expiryoptional expires30 days——7 days defaultuntil pausedKill switchautomations:falseDISABLE_CRON=1app settings—DISABLE_CRON=1pause/deleteFirst MCP messageprobe 2026-07-28probe 2026-07-282025-06-182025-11-252025-11-25not testedThe variables are CLAUDE_CODE_DISABLE_CRON and QWEN_CODE_DISABLE_CRON.Codex schedules live in the Codex app; the CLI has no command to manage them.Amp was not signed in, so its column comes from the docs.

Claude Code 2.1.331: /loop and CronCreate are session-scoped. They run only while the session is open and are restored on --resume if not expired. The minimum is one minute and a session holds up to 50 tasks. Recurring tasks expire after 30 days (7 days before 2.1.330), and CLAUDE_CODE_DISABLE_CRON=1 turns the scheduler off. For schedules independent of a session there are cloud and Desktop scheduled tasks. For events, Claude Code pushes things like CI failures into the session through Channels rather than the MCP events extension.[13][14]

Codex 0.172.0 keeps scheduling in the Codex App (cron or thread heartbeats); the CLI has no commands for it. In codex features list, in_app_local_automation is stable and wake_on_agent_messages is under development.[15]

Qwen Code 0.28.4 has cron_create, cron_list, cron_delete and loop_wakeup, with experimental.cron on by default. Tasks live only in the current session by default, recurring ones expire after 7 days (cronRecurringMaxAgeDays, 0 means never), and QWEN_CODE_DISABLE_CRON=1 turns it all off.[16]

Gemini CLI 0.71.1: I found no scheduling tools in the package, and the release notes don’t mention any.[17]

Amp has thread schedules (RRULE, one per thread), can subscribe to events such as GitHub CI or take webhooks, and runs them in Amp’s cloud.[18] I didn’t sign in, so this is untested.

Looking for scheduling tools and switches in each package

Side by side, OpenCode is the only one that puts all three together: resident on your machine, fed by MCP push, and able to run shell directly. Claude Code and Qwen tie schedules to a session that stops when you close it; Codex and Amp keep durable schedules in an app or the cloud. OpenCode keeps them in a local server, which can touch local files and doesn’t depend on a session. The price is that governance is all local: who created what, what it runs and what was approved is yours to check.

Decide these before you use automations

  1. Set shell to ask. Under the default rules, creating a shell automation over HTTP shows no prompt at all.
  2. Check the automation list now and then, not just permissions. An approved shell command doesn’t stop because a rule changed.
  3. Keep event-automation prompts narrow, one well-defined job, and block tools it shouldn’t touch with deny rules.
  4. If you’re unsure how an MCP server implements the protocol, use the mcp.servers form and set "protocol": "legacy".
  5. Pin plugin versions in production.

The previous issue covered OpenCode 2.3.2 moving the system prompt into a developer message, and the one before it OpenCode 2.3 moving subagents, slow shell commands and compaction to the background. For tool selection once you have many MCP servers, see MCP server sprawl and tool selection at scale. For the overall structure of Claude Code’s core loop, see Agent Harness patterns.

What I tested and what I didn’t

Tested (Linux x64; OpenCode on the free deepseek-v4.1-flash-free model; other CLIs pointed at a local mock or checked from the command line only; no real accounts; times are UTC+8):

The CLI versions installed for this issue

  • OpenCode 2.4.1: shell and prompt actions on every triggers, the HTTP API limits, /automation and the shell prompt in the TUI, ask and deny rules, automations: false and re-enabling, pause and resume, persistence across server restarts.
  • MCP: a hand-written stdio server, the full push-mode path from subscription to file write; handshakes with no protocol, legacy, 2026-07-28 and the v1 flat form; fallback time for a server that doesn’t return an error code.
  • Plugins: upgrade, out-of-range versions and load-failure rollback for ^1.0.0 and a pinned version on a local npm registry.
  • Copilot: the provider list on OpenCode 2.3.2 and 2.4.1 with only GITHUB_TOKEN and with COPILOT_GITHUB_TOKEN.
  • Handshake comparison: Claude Code 2.1.331 and Codex 0.172.0 connecting inside a session; Gemini CLI 0.71.1 and Qwen Code 0.28.4 via mcp list.

Not tested:

  • cron and at triggers, the code action, poll and webhook event delivery.
  • The 24-hour update timer (a manual check stood in for it), Git-branch and semver: plugins.
  • Actual generate_image and generate_video output, the Desktop app, a real Copilot login.
  • Creating a shell automation over HTTP under an ask rule.
  • Anything in Amp; Gemini CLI and Qwen Code handshakes in a real session; automations in the Codex App.

References

  1. OpenCode v2.4.0 changelog: https://opencode.ai/changelog/v2.4.0, GitHub release: https://github.com/anomalyco/opencode/releases/tag/v2.4.0 ↩
  2. OpenCode v2.4.1 changelog: https://opencode.ai/changelog/v2.4.1, GitHub release: https://github.com/anomalyco/opencode/releases/tag/v2.4.1 ↩
  3. OpenCode PRs #65296 and #65186, automations: https://github.com/anomalyco/opencode/pull/65296, https://github.com/anomalyco/opencode/pull/65186 ↩
  4. OpenCode PRs #65271 and #65673, MCP Events: https://github.com/anomalyco/opencode/pull/65271, https://github.com/anomalyco/opencode/pull/65673 ↩
  5. OpenCode PR #65282, MCP protocol negotiation: https://github.com/anomalyco/opencode/pull/65282 ↩
  6. OpenCode PRs #64764, #65052 and #65056, plugin auto-update: https://github.com/anomalyco/opencode/pull/64764, https://github.com/anomalyco/opencode/pull/65052, https://github.com/anomalyco/opencode/pull/65056 ↩
  7. OpenCode PR #64697, Copilot token: https://github.com/anomalyco/opencode/pull/64697 ↩
  8. OpenCode PRs #63666 and #65682, generate_video and generate_image: https://github.com/anomalyco/opencode/pull/63666, https://github.com/anomalyco/opencode/pull/65682 ↩
  9. OpenCode PR #64988, new TUI design: https://github.com/anomalyco/opencode/pull/64988 ↩
  10. OpenCode docs, MCP servers: https://opencode.ai/docs/mcp-servers ↩
  11. OpenCode docs, Plugins: https://opencode.ai/docs/plugins ↩
  12. MCP SEP-3415, Events extension: https://modelcontextprotocol.io/seps/3415-events-extension, reference implementation: https://github.com/modelcontextprotocol/ext-events ↩
  13. Claude Code docs, Scheduled tasks: https://code.claude.com/docs/en/scheduled-tasks, Channels: https://code.claude.com/docs/en/channels ↩
  14. Claude Code v2.1.331 release notes: https://github.com/anthropics/claude-code/releases/tag/v2.1.331 ↩
  15. Codex automations docs: https://learn.chatgpt.com/docs/automations, rust-v0.172.0 release notes: https://github.com/openai/codex/releases/tag/rust-v0.172.0 ↩
  16. Qwen Code v0.28.4 release notes: https://github.com/QwenLM/qwen-code/releases/tag/v0.28.4 ↩
  17. Gemini CLI v0.71.1 release notes: https://github.com/google-gemini/gemini-cli/releases/tag/v0.71.1 ↩
  18. Amp docs, Automations: https://ampcode.com/docs/orbs/automations, Amp news, Schedule: https://ampcode.com/news/schedule ↩