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 — agents: subagent "work in background" pattern leads to hallucinated answers when no independent work exists · Issue #63785 · anomalyco/opencode

agents: subagent "work in background" pattern leads to hallucinated answers when no independent work exists #63785

New issue
Copy link
New issue
Copy link
Open
Open
agents: subagent "work in background" pattern leads to hallucinated answers when no independent work exists#63785
Copy link
Labels
area/coreAgent loop, tools and configplatform/macosmacOStype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@aymenbidasap
aymenbidasap
opened on Nov 13, 2026
Issue body actions

Summary

When a subagent is spawned to explore a codebase, the agent is instructed to "keep working on non-overlapping tasks" while the subagent runs. When there are no other independent tasks to work on, the agent fills the gap by generating an answer without real data — producing hallucinated code snippets and file paths that don't exist. The user receives a confident but fabricated response before the real exploration results arrive.

Environment

  • opencode version: 2.3.0
  • OS: Darwin 27.2.0 (darwin arm64)
  • Terminal: TERM_PROGRAM=vscode, TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /bin/zsh
  • Install/channel: latest
  • Active plugins: None found

Reproduction

  1. Ask the agent a question about the codebase that requires exploration (e.g., "does removing field X from config break anything?")
  2. The agent spawns an explore subagent to search the codebase
  3. Instead of waiting for results, the agent immediately provides an answer with fabricated code snippets and file paths
  4. When the subagent returns with real results, the initial answer turns out to contain hallucinated content

Expected Behavior

When a subagent is spawned and there is no other independent work to do, the agent should tell the user the exploration is in progress and wait for the results before answering.

Actual Behavior

The agent generates a full answer with fabricated code snippets, file paths, and type definitions while the subagent is still running. The hallucinated content looks authoritative but references files and types that don't exist. The user has no way to distinguish this from a real answer until they verify manually or the subagent returns.

Additional Context

  • The root cause appears to be the instruction: "Keep working on non-overlapping tasks, or briefly tell the user what you launched and end your response." The second option ("briefly tell the user and end your response") is the correct behavior when there's nothing else to work on, but the agent defaults to the first option and treats "answering the user's question" as a non-overlapping task — even though it depends on the subagent's results.
  • Reproducibility: Observed in this session. Frequency unknown — may depend on model, prompt complexity, or other factors.
  • This was first noticed after upgrading to opencode 2.3.0. The subagent/background pattern may be new or changed in this version.
Reacted by GigAnon

Activity

  1. opencodejr commented on Nov 13, 2026

    @opencodejr
    opencodejrBot
    on Nov 13, 2026
    Contributor
    More actions

    Thanks for the detailed report. You're right that 2.3.0 changed this: since #63382, subagents always run in the background. The call returns right away, and the agent gets a <subagent> message when the child goes idle. The tool tells the model to "keep working on non-overlapping tasks, or briefly tell the user what you launched and end your response". Your expected behavior matches the second option.

    Whether a model answers early like this depends a lot on which model it is, so we need a bit more to reproduce it:

    1. Provider and model you were using (e.g. anthropic/claude-..., openai/..., a Zen or Go model), and the variant if you picked one.
    2. The prompt you sent, or one close to it, and whether you used the default build agent or a custom one.
    3. If you can, an export of the session (or the relevant part): the subagent tool call, the answer the agent gave right after it, and the <subagent> result that came later.
    4. Whether it happens every time or only sometimes with that model.

    You can reply here with the details, or edit the issue. If you edit it, please still leave a comment saying you've updated it, so we know when you're done.

    I didn't find an existing report of this. These are related, ordered by likelihood:

    • fix(core): only discourage unprompted subagent status checks #63662: a recent change to the wording of the same subagent prompt (about status checks, not this behavior)
    • agent: fabricates [User] messages and subagent results (hallucinated self-prompts) #50534: an older, closed report of the agent making up subagent results, from a different cause
  2. opencodejr
    added
    area/coreAgent loop, tools and config
    platform/macosmacOS
    triaging
    type/bugSomething is broken
    version/v2OpenCode 2.x
    on Nov 13, 2026
  3. aymenbidasap commented on Nov 13, 2026

    @aymenbidasap
    aymenbidasap
    on Nov 13, 2026
    Author
    More actions

    Thanks for the quick response. Here are the details:

    1. Provider and model: anthropic/claude-opus-4-6 (Anthropic Claude Opus 4.6)
    2. Agent: Default plan agent (Plan mode)
    3. Prompt: "if activities from configuration do not have skuItemId inside them does this breaks anything?" — a codebase exploration question.
    4. What happened:
      • The agent spawned an explore subagent to search the codebase
      • Instead of waiting, it immediately provided a full answer with fabricated code snippets referencing files and types that don't exist in the codebase (e.g., service/src/lib/activity/activity.ts, service/src/lib/activity/entitlement.ts, service/src/lib/configuration/configuration.ts, a ConfigurationActivity type, a hasSkuEntitlement function)
      • When the subagent returned with real results, the hallucinated content was clearly wrong
    5. Frequency: Tried again with the same model and it produced a similar hallucinated response.
  4. opencodejr
    removed
    triaging
    on Nov 13, 2026
  5. opencodejr commented on Nov 13, 2026

    @opencodejr
    opencodejrBot
    on Nov 13, 2026
    Contributor
    More actions

    Thanks for the model, agent and prompt details. I couldn't reproduce this here. It depends on how anthropic/claude-opus-4-6 itself responds after the subagent starts, and this sandbox has no Anthropic account. A simulated model would only send back what I scripted, so it can't show this behavior.

    What I could confirm from the 2.3.0 code: subagent calls now always run in the background and return right away. Nothing in the code holds back the parent's answer until the subagent's result arrives. Whether it waits depends on the model following the tool's instructions. A maintainer with access to that model will need to try your steps (plan agent, a question that makes it start an explore subagent, then check whether it answers before the results come back).

    If you can, attaching an export of one of the affected sessions would help them see exactly what the model received and replied.

  6. aymenbidasap commented on Nov 13, 2026

    @aymenbidasap
    aymenbidasap
    on Nov 13, 2026
    Author
    More actions

    No I can't

  7. DEV-S-SHAH commented on Nov 19, 2026

    @DEV-S-SHAH
    DEV-S-SHAH
    on Nov 19, 2026
    More actions

    I've implemented a fix for this.

    Root cause: The subagent tool's description and background result told models to 'work on non-overlapping tasks, or briefly tell the user what you launched and end your response.' Models misread 'answering the user's question' as a non-overlapping task when it actually depends on the subagent's results, producing confident but fabricated answers.

    Fix: Added an explicit warning to both the tool description and the background result:

    Do not answer the user's original question until you have the subagent's results - the answer depends on what the subagent finds.

    This makes it unambiguous that when there's nothing independent to do, the correct action is to briefly say what was launched and end - not to fabricate an answer.

    Changes:

    • packages/core/src/tool/plugin/subagent.ts - added warning to description and backgroundResult, exported backgroundResult for testing
    • packages/core/test/tool/subagent-output.test.ts - 2 new tests verifying both strings contain the warning

    All subagent tests pass (30/30). TypeScript passes.

    PR ready for review.

  8. opencodejr
    marked Warn models not to answer before subagent results #64986 as a duplicate of this issue on Nov 19, 2026
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

    area/coreAgent loop, tools and configplatform/macosmacOStype/bugSomething is brokenversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.