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 — fix(core): don't pause automations on failed runs or missing tools by rekram1-node · Pull Request #66422 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Nov 25, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Automations no longer pause because a run failed or a tool was briefly missing. A failed run is recorded and the automation keeps its schedule. Automations now pause only for setup problems that can't fix themselves: the owner session was deleted, the directory is gone, or the run child's location or permissions no longer match.

This bit a real hourly automation: an MCP server reconnected for a moment, its tools left the registry, the next run failed with Unknown Code Mode tool, and the automation paused at once. Nothing resumes a paused automation and nothing told anyone, so it stayed paused for about 19 hours.

Other schedulers handle this the same way: a failed run is recorded and the next one goes ahead. Where they do auto-pause, it's only after a long streak and with a notification. Silent self-pausing is the most common complaint about schedulers that do it.

How it works

 code run, before running: a tool the script names is missing from the registry
-  -> paused, "Paused: Unknown Code Mode tool: <path>"
+  -> script not run, lastOutcome "skipped", lastOutput "skipped: <path> unavailable"

 code run fails (throws, times out, bad return value, parse error, needs approval, ...)
-  timer: retry in 1 minute; paused after 3 failures in a row, or at once if "invalid"
-  event: paused at once
+  lastOutcome "failed", lastOutput <bounded reason>, failures += 1
+  timer: next run at its normal next slot
+  event: cursor moves past that event

 event prompt fails to be admitted (e.g. a prompt conflict)
-  the watch pauses
+  lastOutcome "failed", cursor moves past that event

 owner session deleted, directory gone, run child's location/permissions changed, send target unreachable
   -> paused with the reason (unchanged)
  • Status stays active through skips and failures. failures is still counted and reset on success, so it shows a streak, but nothing reads it anymore.
  • Deleted: the 1-minute code retry, the 3-failure pause, the immediate pause for invalid outcomes and for event-trigger failures, and the invalid flag on code outcomes (MAX_CODE_FAILURES and CODE_FAILED_RETRY are gone).
  • A code action's send that fails on an unreachable target now pauses through the same path as a prompt action's target (InvalidError), so its reason no longer has a Paused: prefix. A send that fails for another reason, such as an admission conflict, counts as a failed run.
  • Timer prompt actions are unchanged: an admission failure still retries after 5 minutes and never paused.
  • No public schema or SDK changes. Skips and failures reuse the existing skipped and failed values of Automation.Outcome.

Trade-offs

  • An automation that fails on every run keeps running and failing until someone looks. Each failure is visible in lastOutcome/lastOutput, which is better than a silent pause that never resumes.
  • Events that arrive while a run fails or a tool is missing are dropped, not replayed. Before, the watch paused on that event, and in practice it stayed paused until someone noticed.
  • A one-time (at) automation whose run fails is now done (with failed), rather than retried and then paused.

Out of scope: telling the owning session when runs keep failing or skipping. That's the follow-up.

Verification

  • packages/core/test/automation.test.ts:
    • A failing timer stays active through 4 failures in a row, more than the old limit of 3. Each one moves nextDueAt to the next minute and increments failures. Once the tool works again, the next run fires and failures resets to 0.
    • An invalid return value is recorded as failed with its reason, the next slot is unchanged, and a later valid run fires.
    • A missing tool is skipped three times without pausing and runs once the tool is back.
    • Unreachable send targets still pause with their reasons.
  • packages/core/test/automation-event.test.ts:
    • A throwing code run is recorded as failed, the cursor moves past the event, and the next event runs.
    • A rejected event prompt behaves the same way.
    • A missing tool skips its event.
    • The existing rejected-handoff test still pauses.
  • Existing pause tests still pass: deleted creator session, missing target session, missing directory (timer, code handoff and shell).
  • bun test for automation, automation-event, automation-shell, tool-automation: 86 pass. These ran with a temporary HOME so local MCP config can't interfere.
  • bun run typecheck in packages/core and bunx tsc -p tsconfig.build.json --noEmit in packages/simulation, packages/sdk and packages/server all pass.

Sorry, something went wrong.

Uh oh!

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

All reactions
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 recommend merging this. I ran the PR's two new tests on dev: both fail with Paused: Unknown Code Mode tool: …, so the bug is real. With the change, the automation, automation-event, automation-shell and tool-automation tests all pass (84), and tsc -b in packages/core passes.

The skip reuses the existing skipped pattern. Failures and retry_at are left alone, the next run moves to the normal slot, and every other invalid case still pauses. The tests are small and run on the test clock.

Public API: unchanged. skipped is an existing Automation.Outcome value, and unavailable is internal to core.

One inline point on event watches: a skip moves the cursor past the event, so events that arrive during a short MCP reconnect are lost.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread packages/core/src/automation.ts Resolved

Uh oh!

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

rekram1-node added 2 commits November 25, 2026 12:56
@rekram1-node
fix(core): skip a code automation run when a tool it names is unavail…
12b9697
…able
@rekram1-node
fix(core): never pause an automation because a run failed
db4065b
@rekram1-node
rekram1-node force-pushed the fix/automation-skip-missing-tool branch from 429bb72 to db4065b Compare November 25, 2026 19:00
@rekram1-node rekram1-node changed the title fix(core): skip code automation runs while a tool they name is unavailable fix(core): don't pause automations on failed runs or missing tools Nov 25, 2026
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.

The new commits look sound, apart from the dropped quick retry flagged inline. Thanks for writing up dropped events as a deliberate trade-off; that settles my earlier question about the event cursor.

The automation, automation-event, automation-shell and tool-automation tests pass (86) and tsc -b in packages/core passes. Unreachable send targets and missing directories still pause through InvalidError; everything else now moves the schedule or the event cursor on and keeps the automation active.

Public API: unchanged. Only the lastOutcome/lastOutput values change.

One inline point: removing the 1-minute retry means a short outage costs an hourly, daily or weekly code automation its whole run.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread packages/core/src/automation.ts
failures: row.failures + 1,
last_outcome: "failed",
last_output: AutomationCode.boundedOutput(reason),
retry_at: null,

@opencodejr opencodejr Bot Nov 25, 2026

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.

With retry_at: null and advance(...), a failed timer code run now waits for its next normal run. For an hourly, daily or weekly automation, one short MCP or network failure loses that run, while timer prompt actions still retry after FAILED_RETRY. Stopping the pauses doesn't need the retry to go too. Could timer code failures keep a short retry_at, or retry only the first failure of a streak, without pausing?

Sorry, something went wrong.

Uh oh!

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

All reactions

@rekram1-node rekram1-node Nov 25, 2026

Copy link
Copy Markdown
Member Author

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.

Intended. Code automations are single-shot: a failed run is recorded and the next scheduled run goes ahead, with no retry. A script can fail after it has already sent messages or changed things, and the harness can't tell which part failed or whether rerunning is safe, so an automatic retry could repeat side effects. Prompt retries stay because they only cover a prompt that was never delivered, where nothing ran.

Sorry, something went wrong.

Uh oh!

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

opencodejr[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction

@opencodejr opencodejr Bot Nov 25, 2026

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.

Agreed for failed runs. A script that throws partway may already have sent messages or written state, and codeFailed (automation.ts:432-449) can't tell how far it got, so moving to the next slot with retry_at: null is the safe choice. Prompt retries are different: the catch-all at automation.ts:700-717 only retries after 5 minutes when admission failed, so nothing ran. I'd resolve the bot's comment as intended.

One thing your reasoning doesn't cover is the skip path at automation.ts:609-616. When a tool is unavailable, the script is never started, so no side effects can repeat. It still uses retry_at: null plus advance(...), so the case that motivated this PR still drops a run: an hourly automation whose MCP tool disappears for a few seconds misses that hour. If you want that run back, retry skips only, for example retry_at: now + FAILED_RETRY without advancing the slot on the first skip of a streak, and keep failures single-shot. If losing one slot is acceptable, it's fine as is. It's just a gap, not a bug.

I checked this by reading the code only. I made no changes and ran no tests.

Sorry, something went wrong.

Uh oh!

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

All reactions
@rekram1-node
rekram1-node merged commit 6e01a86 into dev Nov 25, 2026
12 checks passed

Uh oh!

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

@rekram1-node
rekram1-node deleted the fix/automation-skip-missing-tool branch November 25, 2026 20:30
@amrkmn amrkmn mentioned this pull request Nov 26, 2026
opencode 2.4.2 amrkmn/homebrew-tap#1260
Closed
1 task
This was referenced Nov 26, 2026
feat: opencode release v2.4.2 sprisa/opencode-server#97
Merged
Tool release: OpenCode 2 v2.4.2 (was v2.3.2) agent-sh/agnix#1894
Closed
@filipeforattini filipeforattini mentioned this pull request Nov 28, 2026
feat: port OpenCode November improvements reddb-io/redcode#550
Draft
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

@rekram1-node
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.