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 — opencode run teardown race after session.idle can create empty continuation assistant turn ("parts": []) · Issue #15267 · anomalyco/opencode

opencode run teardown race after session.idle can create empty continuation assistant turn ("parts": []) #15267

New issue
Copy link
New issue
Copy link
Closed
#31389
Closed
opencode run teardown race after session.idle can create empty continuation assistant turn ("parts": [])#15267
#31389
Copy link
Assignees
rekram1-node

Description

@twm-dynamo
twm-dynamo
opened on Feb 26, 2026
Issue body actions

Summary

In non-interactive opencode run, ULW/Ralph continuation can be injected after session.idle while run teardown/disposal is already starting. The second loop turn may be created with an empty assistant payload ("parts": []).

This is reproducible with /ulw-loop ... --max-iterations=2 under both --strategy=continue and --strategy=reset.

Environment

  • OpenCode CLI: 1.2.14
  • oh-my-opencode plugin: 3.8.5
  • OS: Linux

Reproduction

opencode run "/ulw-loop Write TRACE_TWICE and do not promise completion --max-iterations=2"
opencode run "/ulw-loop Write TRACE_TWICE_RESET and do not promise completion --max-iterations=2 --strategy=reset"

Then inspect the session:

opencode session list --format json -n 3
opencode export <session_id> > /tmp/<session_id>.json

Expected

  • If continuation is injected, the continuation assistant turn should contain a non-empty response payload.
  • If run mode is intentionally single-pass, continuation should not be injected.

Actual

  • Continuation directive is injected for loop 2.
  • A follow-up assistant message exists but has empty content ("parts": []).

Evidence

Exported sessions (directive present + empty assistant payload)

  • /tmp/ses_368d1cd6affeagO950PZdu6tid.json:279
  • /tmp/ses_368d1cd6affeagO950PZdu6tid.json:314
  • /tmp/ses_368d192b2ffeyCZLYWUS8MUyo8.json:295
  • /tmp/ses_368d192b2ffeyCZLYWUS8MUyo8.json:330

Trace ordering (idle/dispose timing overlaps continuation enqueue)

  • /tmp/ulw_trace_run.log:360
  • /tmp/ulw_trace_run.log:364
  • /tmp/ulw_trace_run.log:365
  • /tmp/ulw_trace_run.log:382
  • /tmp/ulw_trace_run.log:501

Related runtime signal during continuation startup

  • /tmp/ulw_trace_run.log:487

Working hypothesis

session.idle continuation enqueue and run-mode disposal are not serialized, allowing continuation to be posted during teardown and resulting in a partial second turn.

Local mitigation (plugin-side, not core fix)

Continuation hooks were disabled in run mode in local plugin bundle:

  • /home/wagner/.config/opencode/node_modules/oh-my-opencode/dist/index.js:58415
  • /home/wagner/.config/opencode/node_modules/oh-my-opencode/dist/index.js:58488
  • /home/wagner/.config/opencode/node_modules/oh-my-opencode/dist/index.js:58808
  • /home/wagner/.config/opencode/node_modules/oh-my-opencode/dist/index.js:58812
  • /home/wagner/.config/opencode/node_modules/oh-my-opencode/dist/index.js:58838

This avoids partial loop behavior in run mode but does not address runtime sequencing.

Requested core fix

  1. Serialize run teardown with post-idle continuation enqueue.
  2. If continuation is posted, defer disposal until that turn reaches a terminal state (completed/failed/rejected).
  3. If run mode disallows continuation, reject/skip enqueue before posting the directive.

Acceptance criteria (testable)

  1. Running /ulw-loop ... --max-iterations=2 in opencode run never produces continuation assistant messages with "parts": [].
  2. Behavior is deterministic in both --strategy=continue and --strategy=reset.
  3. Exactly one mode is enforced per run:
    • continuation allowed: directive is injected and continuation response is non-empty, or
    • continuation disallowed: no continuation directive is injected.
  4. A regression test covers the idle->dispose sequencing case where continuation posting and teardown are concurrent candidates.

Activity

  1. github-actions
    assigned
    thdxr
    on Feb 26, 2026
  2. github-actions
    added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Feb 26, 2026
  3. twm-dynamo commented on Feb 26, 2026

    @twm-dynamo
    twm-dynamo
    on Feb 26, 2026
    Author
    More actions

    Adding inline evidence excerpts so triage does not depend on my local /tmp files.

    Observed in exported sessions:

    /tmp/ses_368d1cd6affeagO950PZdu6tid.json:279
      "ultrawork [SYSTEM DIRECTIVE: OH-MY-OPENCODE - RALPH LOOP 2/100] ..."
    
    /tmp/ses_368d1cd6affeagO950PZdu6tid.json:314
      "parts": []
    
    /tmp/ses_368d192b2ffeyCZLYWUS8MUyo8.json:295
      "ultrawork [SYSTEM DIRECTIVE: OH-MY-OPENCODE - RALPH LOOP 2/100] ..."
    
    /tmp/ses_368d192b2ffeyCZLYWUS8MUyo8.json:330
      "parts": []
    

    Trace ordering excerpt:

    /tmp/ulw_trace_run.log:364  service=bus type=session.idle publishing
    /tmp/ulw_trace_run.log:365  service=default directory=/home/wagner disposing instance
    /tmp/ulw_trace_run.log:382  service=server method=POST path=/session/.../message request
    /tmp/ulw_trace_run.log:396  service=session.prompt step=0 sessionID=... loop
    /tmp/ulw_trace_run.log:503  service=state key=/home/wagner state disposal completed
    

    This matches the report: continuation directive appears, then a continuation assistant turn is created with empty payload (parts: []).

  4. thdxr
    assigned
    rekram1-node
    and unassigned
    thdxr
    on Apr 26, 2026
  5. thdxr
    removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  6. rekram1-node
    closed this as completedin #31389on Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

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.