Skip to content

opencode v2 native: acp_status tool returns legacy flat report instead of the status panel #911

Closed

Description

@ranxianglei

Repro

Native mode (self-spawned proxy, dist/agent/opencode-native.js): in the opencode v2 TUI, let the model call acp_status (or just ask it for context status). The tool output is the legacy flat report:

ACTIVE SURFACE: pack=default | host=billion-context 0.1.115
CONTEXT BREAKDOWN
  0 tool (0%) | 47 text (100%) | 0 summaries (0%)
...
Tip: buildStatusReport(...)

while the /acp slash command renders the rich panel (host label, usage, blocks, nudge) — tool and command disagree.

Root cause

The v2 plugin forwards acp_status via forwardTool → the proxy's /__bili/plugin/tool executes the kernel's acp_status, whose text output is the legacy flat buildStatusReport. The rich panel (buildStatusPanel) is only served by the read-only status endpoint /__bili/plugin/status (status.panel), which the /acp command consumes.

Panel-first rendering was originally shipped for the in-process local kernel (#909), which is now closed/superseded by the native-proxy alignment — the fix must be re-landed on the v2 mainline.

Impact

Model-visible status is the legacy format in ALL opencode v2 modes that forward tools to the proxy (native self-spawn, launcher, attach). Confusing next to the /acp panel; loses the richer per-section data (host identity, sent vs pruned, nudge reasoning).

Suggested fix

In src/agent/opencode-v2.ts tool execute: for acp_status (read-only), read fetchStatus(base, sessionID) first and return status.panel when non-empty; fall back to forwardTool (older proxy / unknown conversation). No proxy-side change; bili pi untouched.

Activity

  1. ranxianglei commented on Sep 17, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

    [bot] 🏷 Verified — this fix already exists and is ready to merge: #912 (head 96368b2, base 2026-09-15_opencode-native-plugin, clean / no conflicts).

    What the PR does (matches your suggested fix exactly): in src/agent/opencode-v2.ts, when the v2 plugin executes acp_status (read-only), it now reads fetchStatus(base, sessionID) first and returns status.panel when non-empty — the same source the /acp command consumes. It falls back to forwardTool when no panel comes back (older proxy / unknown conversation). No proxy-side change; bili pi untouched. Re-lands the panel-first UX from the closed #909 on the native-proxy mainline.

    Verification I ran independently (checked out the head, clean install):

    • Code follows the existing /acp panel pattern; fetchStatus soft-fails to undefined on a status 404 so the fallback path is safe, and any throw is still caught by the surrounding try/catch.
    • Test covers both paths: panel served → tool returns the panel with no forwarded tool call; status 404 → forwards and returns the kernel result, asserting a tool call was recorded.
    • npm run typecheck ✅ · npm run build ✅ (emits dist/agent/opencode-native.js) · full suite 1662 tests, 0 fail (2 skipped) · CI e2e green · mergeable.

    One cosmetic nit (non-blocking): the new line uses status?.["panel"] while the nearby /acp handler uses status.panel — functionally identical, left as-is to keep the diff minimal.

    中文摘要:已在 PR #912 让 opencode v2 的 acp_status 优先读取代理 status 端点的富面板(与 /acp 同源)、无面板时回退到转发内核工具,并独立复验 typecheck/build/全量测试(1662 通过 0 失败)均绿,可以合并。

  2. added a commit that references this issue on Sep 18, 2026
    96368b2
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