Skip to content

[Bug]: opencode-go works via direct infer but fails in embedded agent runtime with session takeover #88457

Closed as not planned

Description

@ReyesAdrian

Bug type

Provider/runtime compatibility bug.

Summary

opencode-go/mimo-v2.5 works through direct inference, but fails consistently when used as the embedded agent runtime for the main Telegram/dashboard agent. The observed failure is EmbeddedAttemptSessionTakeoverError / session file changed while the embedded prompt lock was released.

This still reproduces after updating to OpenClaw 2026.5.28 stable, adding the provider-specific API key, restarting the gateway, creating fresh sessions, purging stale session files, and disabling the local session-snapshot stripping LaunchAgent.

Expected behavior

If openclaw infer model run --model opencode-go/mimo-v2.5 succeeds and the provider is configured/authenticated, the same model should be usable as an agent runtime model for normal Telegram/dashboard conversations, including follow-up turns and tool use.

Actual behavior

Direct inference succeeds, but the embedded agent runtime fails during normal conversation flow with a session takeover/lock error. Switching the same agent runtime to openai/gpt-5.5 works immediately as a control.

Reproduction / steps already tried

Environment: macOS install, OpenClaw updated from 2026.5.28-beta.4 to 2026.5.28 stable during the investigation.

  1. Configure opencode-go/mimo-v2.5 as the agent runtime model for main.
  2. Confirm direct inference works:
openclaw infer model run --model opencode-go/mimo-v2.5 --prompt "Responde exactamente: ok"
  1. Use the same model in the embedded agent runtime through Telegram/dashboard.
  2. First/direct call may work, but follow-up turns/tool sessions fail with EmbeddedAttemptSessionTakeoverError / session file changed while embedded prompt lock was released.

Troubleshooting steps that did not resolve it:

  • Added OPENCODE_GO_API_KEY to the OpenClaw environment.
  • Restarted the gateway.
  • Started a clean Telegram session with /new.
  • Purged stale files from agents/main/sessions/.
  • Updated OpenClaw from 2026.5.28-beta.4 to 2026.5.28 stable.
  • Ran openclaw doctor --fix.
  • Performed full purge + restart + /new again.
  • Disabled the local strip-session-snapshots LaunchAgent / compaction-adjacent file rewrite process.
  • Retested after the above cleanup.

Control test:

  • Switching the same agent runtime to openai/gpt-5.5 works immediately.
  • Other working runtime models observed locally: github-copilot/gpt-5.4-mini, github-copilot/gpt-5.5, and anthropic/claude-opus-4-7.

Why this seems provider/runtime-specific

The important distinction is that direct model inference succeeds, but the embedded runtime path fails. That suggests this is not only a provider auth issue or a basic model availability issue. The failing path appears tied to the OpenClaw agent session lifecycle: session locks, follow-up turns, tool calling, compaction/session-file updates, or provider adapter behavior inside embedded agent execution.

Workaround

Use opencode-go/mimo-v2.5 only for direct inference for now:

openclaw infer model run --model opencode-go/mimo-v2.5 --prompt "ok"

For the main Telegram/dashboard agent, use a different runtime model such as openai/gpt-5.5 or github-copilot/gpt-5.4-mini.

Related issues that may be adjacent but do not seem to cover this exact failure

Suggested next step

Please verify whether the opencode-go provider adapter supports the same embedded agent runtime/session lifecycle as the other providers. A focused regression test could compare:

  1. direct infer model run success,
  2. first embedded agent turn success,
  3. second embedded agent turn success,
  4. embedded tool-call turn success,
  5. behavior when session compaction/snapshot updates occur.

Activity

  1. clawsweeper commented on May 30, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 21, 2026, 4:35 AM ET / 08:35 UTC.

    Summary
    Keep open: current main still has a plausible embedded prompt-lock takeover path for OpenCode Go embedded runs, and the most relevant recovery work is an open pull request that closes a broader session-takeover issue rather than this provider-specific report.

    Reproducibility: no. there is not a high-confidence live reproduction for the exact OpenCode Go Telegram/dashboard flow. The issue has concrete steps and current source still shows the prompt-lock takeover path, but direct-infer, first embedded turn, follow-up turn, and tool-call proof were not run here.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.
    • Include redacted logs or terminal output.

    Next step
    Maintainers should review the open recovery pull request and decide whether OpenCode Go needs separate live validation or provider-specific follow-up before any new automated fix branch is safe.

    Review details

    Best possible solution:

    Keep this provider-specific tracker open until maintainers either land the broader session-takeover recovery path and verify OpenCode Go embedded turns, or identify a narrower OpenCode Go/runtime fix with live proof.

    Do we have a high-confidence way to reproduce the issue?

    No, there is not a high-confidence live reproduction for the exact OpenCode Go Telegram/dashboard flow. The issue has concrete steps and current source still shows the prompt-lock takeover path, but direct-infer, first embedded turn, follow-up turn, and tool-call proof were not run here.

    Is this the best way to solve the issue?

    Unclear: the broader session-takeover recovery in #89039 looks like the likely owner boundary for message-loss recovery, but this provider-specific issue still needs live OpenCode Go validation before maintainers can call it solved.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No current-main live run proves the exact OpenCode Go path across direct inference, first embedded Telegram/dashboard turn, follow-up turn, and tool-call turn.
    • The open generic recovery pull request may fix the retry/takeover/message-loss class, but provider-specific OpenCode Go behavior remains unverified until it lands or is tested directly.
    • This area crosses provider retry behavior, session-state ownership, and channel reply delivery, so a narrow automated fix without maintainer coordination could choose the wrong owner boundary.

    Codex review notes: model internal, reasoning high; reviewed against 9940110b881b.

    Label changes

    Label justifications:

    • P1: A configured agent runtime model can fail real Telegram/dashboard conversations while the same model works through direct inference.
    • impact:session-state: The reported failure is an embedded session-lock/fingerprint takeover during the agent runtime lifecycle.
    • impact:message-loss: The embedded follow-up/tool-turn failure can prevent the expected channel reply from reaching the user.
    • impact:auth-provider: The failure is provider/model-specific: OpenCode Go authenticates and works for direct inference but fails in the embedded runtime path.
    Evidence reviewed

    Acceptance criteria:

    • Live OpenCode Go proof: openclaw infer model run --model opencode-go/mimo-v2.5, first embedded Telegram/dashboard turn, follow-up turn, and tool-call turn.
    • If code changes, focused tests around prompt-lock release/reacquisition, provider retry forwarding, and user-visible reply behavior.
    • Review fix: prevent silent message loss from EmbeddedAttemptSessionTakeoverError #89039 against this provider-specific flow before opening a separate repair branch.

    What I checked:

    • Repository policy read: Read the root and scoped AGENTS.md files for the agent runner and extension boundaries; the review applied the guidance that provider routing, auth/session state, channel delivery, and fallback behavior are compatibility-sensitive and need high-confidence source and proof before closure. (AGENTS.md:1, 9940110b881b)
    • Live issue state: The live issue remains open, has no assignees, and has no closing pull request references; the reporter provided concrete direct-inference success and embedded-runtime failure steps.
    • OpenCode Go is a supported runtime provider: The provider docs describe opencode-go as a runtime provider and show configuring it as the default agent model, so the expected embedded-agent use is within documented product behavior. Public docs: docs/providers/opencode-go.md. (docs/providers/opencode-go.md:9, 9940110b881b)
    • Reported model is in the bundled catalog: Current main includes mimo-v2.5 under provider opencode-go with api: "openai-completions", tying the report to the native OpenAI-compatible transport path. (extensions/opencode-go/provider-catalog.ts:217, 9940110b881b)
    • Prompt-lock takeover path remains present: The embedded runner still releases the prompt lock around the model stream and reacquires it afterward; reacquireAfterPrompt() still asserts the session-file fence and can throw EmbeddedAttemptSessionTakeoverError. (src/agents/embedded-agent-runner/run/attempt.session-lock.ts:1978, 9940110b881b)
    • Current tests preserve takeover rejection: The lock tests still assert that an external edit before prompt-stream lock reacquisition rejects with EmbeddedAttemptSessionTakeoverError; that proves the central failure class is still an intentional source path on current main. (src/agents/embedded-agent-runner/run/attempt.session-lock.test.ts:1794, 9940110b881b)

    Likely related people:

    • joshavant: Authored and merged the session-file ownership race work that introduced a large part of the embedded session-lock ownership surface now implicated by the report. (role: embedded session ownership feature owner; confidence: high; commits: 3349fe21bbde; files: src/agents/pi-embedded-runner/run/attempt.session-lock.ts, src/agents/pi-embedded-runner/run/attempt.ts, src/agents/embedded-agent-runner/run/attempt.session-lock.ts)
    • vincentkoc: Recent blame and history on the current session-lock and OpenAI transport files point to Vincent Koc, including the ctime digest session-lock fix and the current shallow-main lines. (role: recent session-lock contributor; confidence: medium; commits: 449043802397, 9940110b881b; files: src/agents/embedded-agent-runner/run/attempt.session-lock.ts, src/agents/embedded-agent-runner/run/attempt.session-lock.test.ts, src/agents/openai-transport-stream.ts)
    • steipete: Recently updated OpenCode Go provider catalog/context metadata on the provider side of the reported opencode-go runtime path. (role: recent OpenCode Go provider contributor; confidence: medium; commits: 82552270b9b7; files: extensions/opencode-go/index.ts, extensions/opencode-go/provider-catalog.ts, src/agents/context.opencode-go.test.ts)
    • ImLukeF: Authored the merged pull request that added OpenCode Go provider support and the provider documentation. (role: OpenCode Go provider introducer; confidence: medium; commits: 7761e7626ffe; files: docs/providers/opencode-go.md, extensions/opencode-go)
    • Jerry-Xin: Authored the open session-takeover recovery pull request that may address part of this issue's broader failure class, although it is not merged and does not specifically close this issue. (role: candidate fix owner; confidence: medium; commits: e3b42c966605; files: src/agents/embedded-agent-runner/run/attempt.session-lock.ts, src/agents/embedded-agent-runner/run/attempt.ts, src/auto-reply/reply/agent-runner-execution.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on May 30, 2026
  3. openclaw-barnacle commented on Jun 15, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  4. added
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    and removed
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    on Jun 15, 2026
  5. added
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    and removed
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    on Jun 19, 2026
  6. openclaw-barnacle commented on Jul 6, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  7. openclaw-barnacle commented on Jul 15, 2026

    @openclaw-barnacle

    Closing due to inactivity.
    If this is still an issue, please retry on the latest OpenClaw release and share updated details.
    If you are absolutely sure it still happens on the latest release, open a new issue with fresh steps to reproduce.

  8. locked as resolved and limited conversation to collaborators on Sep 2, 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

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions