Skip to content

Rescue foreground calls can time out before OpenCode finishes large tasks #37

Closed

Description

@JohnnyVicious

Summary

The rescue flow can invoke opencode-companion.mjs task in the foreground. For large tasks, the Claude Code Bash/tool timeout can expire before OpenCode finishes, leaving the result only in background state/logs or losing the user-visible handoff.

This is separate from #13, which tracks a missing wall-clock timeout inside runTrackedJob itself.

Local evidence

plugins/opencode/agents/opencode-rescue.md says:

  • prefer foreground for small, bounded rescue requests
  • prefer background for complicated/open-ended work

That guidance relies on the forwarding agent estimating duration correctly. If it chooses foreground for a task that exceeds the host Bash timeout, the command may terminate before output is delivered to the parent conversation.

Expected behavior

Large rescue work should reliably return either:

  1. final output within the foreground timeout, or
  2. a job id immediately with clear instructions to use /opencode:status and /opencode:result.

Suggested fix

Options:

  1. Prefer opencode-companion task --background for any rescue request that may exceed the Bash timeout.
  2. Add a companion-level mode that starts asynchronously and returns a job id immediately, rather than relying on Claude-side run_in_background behavior.
  3. Teach /opencode:rescue to inspect task size/risk and choose async mode more conservatively.
  4. Include the job id in all timeout/failure paths when a worker was started.

Upstream reference

Derived from openai/codex-plugin-cc#122.

Activity

  1. JohnnyVicious commented on Apr 12, 2026

    @JohnnyVicious
    OwnerAuthor

    Consolidated into #17. Foreground timeout behavior should be handled by the same rescue forwarding/backgrounding contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions