Visitar URL original
feat(core): move timed-out shell commands to the background by default by rekram1-node · Pull Request #63699 · anomalyco/opencode · GitHub
Skip to content

feat(core): move timed-out shell commands to the background by default - #63699

Merged
rekram1-node merged 1 commit into
devfrom
shell-timeout-default
Nov 13, 2026
Merged

rekram1-node merged 1 commit into
devfrom
shell-timeout-default

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Shell commands that outlive their foreground timeout now move to the background in every build instead of being killed. Until now this was behind the shell_timeout_background flag (#63024, tightened in #63703), on in local and dev builds and off in releases, so release users still had long builds and test runs killed at the default 120 seconds.

before (releases):  foreground timeout expires -> kill the command
after (all builds): foreground timeout expires -> background the same process, notify when it finishes

This is the behavior dev builds already have since #63703:

Call Result
{ command: "bun test" } waits 120 s, then moves to the background
{ command: "bun test", timeout: 0 } treated as the default, so it can't block the turn until the command exits
{ command: "bun dev", background: true } runs until it exits
{ command: "bun dev", background: true, timeout: 600000 } stopped after 10 min with the usual timeout notice

What the model reads:

  • Tool description: "Commands still running after their timeout move to the background."
  • timeout: "Optional timeout in milliseconds (default 120000). When it expires, a foreground command moves to the background and a background command is stopped."

The flag is removed entirely, including experimental.shell_timeout_background in the config schema. It never shipped turned on in a release, and a config that still sets the key loads fine (the key is dropped). Client types and the OpenAPI document are regenerated.

Tests: the test that covered killing a foreground command at its timeout and the flag-off background timeout test are removed, and the rest drop the flag setup.

Checked: bun test test/tool-shell.test.ts test/job.test.ts (123 pass; the 2 failures are the conditional process substitution tests, which also fail on dev with macOS bash 3.2), schema tests, bun typecheck in packages/core, bun run check.


Added by the opencode bot (AI-generated).

Related: #61374

Public API: removes the unreleased shell_timeout_background flag and its experimental config key (configs that set it still load); shell timeout now backgrounds foreground commands in all builds

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks sound: the flag is gone and the plugin keeps a single code path. In every build, a foreground shell command still running after its timeout now moves to the background instead of being killed.

I checked this on the base by turning the flag off (OPENCODE_FLAGS=-shell_timeout_background, as in releases): the test "moves a foreground timeout to the background…" fails because the command is killed. With this PR the same test passes under the same setting. tool-shell.test.ts, job.test.ts and config normalization tests pass on Linux, and tsc is clean for core and schema.

Public API impact

  • Removed the shell_timeout_background feature flag, so OPENCODE_FLAGS=±shell_timeout_background no longer has any effect.
  • experimental.shell_timeout_background stays in the config schema as a deprecated, ignored key. Only its position moved in the OpenAPI document and the generated client types.
  • Shell tool behaviour and description changed in release builds: timed-out foreground commands are backgrounded, and an explicit timeout on a background command is ignored.
  • Existing configs keep loading. Users who relied on kill-at-timeout can no longer opt back into it.

One optional follow-up, outside the diff: the description of the timeout input (shell.ts:58) still says "Set to 0 to disable the timeout" and "Background commands have no timeout by default". That suggests an explicit timeout limits background commands, but it is now ignored for them. Rewording it would keep the model's instructions accurate.

Related: #61374

@rekram1-node
rekram1-node enabled auto-merge (squash) November 13, 2026 06:36

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The new commits look good. The earlier optional point is addressed: the timeout input now describes a foreground wait that is ignored for background commands.

Dropping experimental.shell_timeout_background from the schema is safe for existing configs. A config that still sets it normalizes without diagnostics: the key is silently dropped and the rest of experimental is kept. At the new head, tool-shell.test.ts passes on Linux and tsc is clean for core and schema.

Public API impact

  • Removed the shell_timeout_background feature flag.
  • Removed the experimental.shell_timeout_background config key from the schema, OpenAPI and client types. Configs that set it still load.
  • Changed the shell tool's timeout description and behaviour: it now only limits the foreground wait.

This is backwards compatible, but users can no longer opt back into kill-at-timeout.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This update looks good; I found nothing new to raise. After the rebase onto #63703, the change just removes the flag and applies the dev-build behaviour in every build. The earlier point about the timeout description is addressed.

I turned the flag off on the new base, as releases do: a foreground timeout still kills the command there, while this PR moves it to the background. tool-shell.test.ts and job.test.ts pass on Linux, and tsc is clean for core and schema.

Public API impact

  • Removed the shell_timeout_background flag and the experimental.shell_timeout_background config key from the schema, OpenAPI and client types. Configs that set the key still load.
  • In release builds, the shell tool's behaviour now matches dev builds:
    • Foreground commands move to the background when their timeout runs out.
    • Foreground timeout: 0 falls back to the 120 s default instead of waiting until the command finishes.
    • An explicit timeout on a background command still stops it.

This is backwards compatible, but users can no longer opt back into kill-at-timeout.

@rekram1-node
rekram1-node merged commit b80a389 into dev Nov 13, 2026
13 of 14 checks passed
@rekram1-node
rekram1-node deleted the shell-timeout-default branch November 13, 2026 08: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