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 — [Bug]: OpenCode V2 adapter (#9016) drops parentID on session.create, so task and background subagent sessions appear top-level · Issue #10173 · code-yeongyu/oh-my-openagent

[Bug]: OpenCode V2 adapter (#9016) drops parentID on session.create, so task and background subagent sessions appear top-level #10173

New issue
Copy link
New issue
Copy link
Open
Open
[Bug]: OpenCode V2 adapter (#9016) drops parentID on session.create, so task and background subagent sessions appear top-level#10173
Copy link
Labels
opencodeOpenCode edition: packages/omo-opencode

Description

@mradwankhalil
mradwankhalil
opened on Oct 15, 2026
Issue body actions

Bug Description

On OpenCode V2 (via the V1/V2 adapter in #9016), sessions that oh-my-openagent spawns for subagents (task, call_omo_agent, background agents) are persisted without a parent. They show up as top-level sessions in OpenCode / OpenChamber instead of nested under the session that spawned them.

The callers are fine: tools/delegate-task/sync-session-creator.ts, features/background-agent/manager.ts (startTask) and features/background-agent/spawner.ts all pass body.parentID. The link is lost in the V2 adapter: packages/omo-opencode/src/v2/session-actions.ts createSession reads body.parentID, stores it only as metadata.omoParentID and in adapter memory (state.recordParent), and calls the native api.create(...) without parentID. OMO itself does not notice, because withParent / childSessions rebuild the relation from that metadata, so only the native store and UI see orphans.

OpenCode V2 accepts parentID on plugin session.create since v2.0.22 (anomalyco/opencode#52359). When parentID is set the native host places the child at the parent's location and ignores location.

Steps to Reproduce

  1. Run OpenCode V2 (verified on 2.0.28) with oh-my-openagent built from Support OpenCode V1 and V2 from one plugin export #9016 (head 502a4f0fd).
  2. From any session, delegate with task (category or subagent_type) or launch a background agent.
  3. Inspect the new session: GET /api/session/<child id> returns no parentID, and session_v2.parent_id is NULL.

Isolated reproduction without a model: a project plugin builds the facade exactly as host.ts does (createV1PluginInput(ctx, { state: createAdapterState(...) })) and calls client.session.create({ body: { title, parentID: root.id }, query: { directory } }), the same call sync-session-creator.ts makes.

Expected Behavior

The child session is created with the native parentID, so it is nested under the spawning session in the store, the API and the UI. A child that asks for a different directory (team member worktree, task cwd) still ends up in that directory.

Actual Behavior

Isolated run against the real OpenCode 2.0.28 binary (loopback server, throwaway XDG/HOME roots):

facade return value GET /api/session/:id parentID session_v2.parent_id
child in project dir ses_root null NULL
child in another dir ses_root null NULL

With the fix below, both children report the root as parent through the API and in session_v2, the other-directory child is stored with the requested directory, and both still report the parent after a cold server restart. The root stays parentless.

Doctor Output

Not applicable: the defect is a dropped field at the adapter/native boundary and reproduces in an isolated server with no providers configured.

Error Logs

No error is raised; the link is silently dropped. The visible symptom is that OpenCode and OpenChamber list every delegated session as a separate top-level conversation.

Configuration

Default. No OMO configuration is involved in the create path.

Additional Context

Fix (2 files, +61/-9), built on top of the #9016 head so it can be cherry-picked into that PR:
mradwankhalil@7513b4c
(branch mradwankhalil:fix/v2-native-parent-linkage-on-9016)

  • session-actions.ts: pass parentID to the native create. Because the native host ignores location for children, a child whose requested directory differs from where the host placed it is moved there with session.move right after creation. The metadata.omoParentID and adapter-state bookkeeping are kept.
  • host.test.ts: the existing "create remembers parentID" owner test now asserts the native create receives parentID (it only checked the metadata before, which is why this slipped through); a new case covers the different-directory child (parentID + move, returned record reports the requested directory).

Verification on the #9016 head: host.test.ts 15 pass / 0 fail (the two changed assertions fail on the unfixed code with Expected: "ses_parent", Received: undefined), tsgo --noEmit -p packages/omo-opencode/tsconfig.json clean.

No PR is opened against dev because src/v2 only exists on #9016. Happy to open one against whichever branch the maintainers prefer.

Operating System

Windows 11

OpenCode Version

2.0.28

Activity

  1. github-actions
    added
    opencodeOpenCode edition: packages/omo-opencode
    on Oct 15, 2026
  2. code-yeongyu commented on Nov 2, 2026

    @code-yeongyu
    code-yeongyu
    on Nov 2, 2026
    Owner
    More actions

    Thanks @mradwankhalil for confirming the callers pass parentID and the link is lost in the adapter's createSession. Sorry this sat for a while. This report is against the V2 adapter from #9016, which hasn't merged into dev and currently has merge conflicts, so for now it's most useful as input to that PR.

  3. mradwankhalil commented on Nov 3, 2026

    @mradwankhalil
    mradwankhalil
    on Nov 3, 2026
    ContributorAuthor
    More actions

    Thanks for clarifying that this belongs with #9016. The parentID forwarding evidence remains scoped to that unmerged adapter.

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

    opencodeOpenCode edition: packages/omo-opencode

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — 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.