Skip to content

[origin-review] anomalyco/opencode#50968 — LIMITED #13

Open

Description

@kvnloo

Why this matters

Two TUIs/CLIs on one project can both ensureRunning the same session (per-process maps only). Loops then take turns answering one user message — dozens of finish: "stop" replies.

Evidence

Tip d970983c0bca86d840ac036e2403fe91bc398e69 (base dev):

  • Leaf: cross-process EffectFlock (tryAcquire / Held.verify / holder) wrapping SessionRunState.ensureRunning / startShell; runLoop checks owns(sessionID) each iteration; waiting opencode run can render the other process's assistant reply
  • Author: dual-graph + real opencode run process tests; mutation-killed lock/owns/dedupe
  • Evidence class: SOURCE here. Live cross-process suite on tip: UNKNOWN (not executed in this pass)

Invariant: one session loop owner across processes; waiters cancel cleanly; lock loss stops before the next provider turn.

Ask (design, light) — prospective; non-blocking

  1. Is mkdir-flock + heartbeat the permanent multi-process session lease, or should V2 SessionRunCoordinator become the single owner with this as a V1 bridge?
  2. For never-again: when a waiter stores a prompt under another holder, is “holder answers at next turn boundary” the contract, or should the harness expose an explicit cross-process enqueue/ack?

Fork-only archive of a sealed review draft. Not posted on origin.

Activity

  1. added
    grok bot
    on Sep 25, 2026
  2. kvnloo commented on Sep 25, 2026

    @kvnloo
    OwnerAuthor

    QA re-pin: this mirror is stale relative to the current PR.

    Current origin head is 7b776f3ee34f0b99c40252c84c073d65f9b546c5, not d970983c…, and the candidate changed materially after the mirror pin.

    The PR now reports substantially stronger evidence than “SOURCE only”:

    • two independent layer graphs over one DB/lock dir;
    • mutation-style negative controls for removing the lock / ownership check / interruptible wait;
    • real spawned opencode run processes exercising cross-process behavior;
    • installed-build live run with two processes on one session;
    • packages/opencode: 3,594 pass / 2 timeout failures that pass alone;
    • packages/core: 1,102 pass / one failure also present on clean dev;
    • typecheck clean.

    Please update evidence classification to origin-supplied behavioral/live proof present; independent factory rerun unknown.

    One wording correction: do not state a strict fencing invariant. The PR explicitly says takeover is best-effort: a holder that loses the lease may finish its current in-flight turn/tool before the next owns(sessionID) check. The supported invariant is closer to:

    with a healthy heartbeat, only one process enters successive provider turns; after lease loss, the old owner stops before its next provider turn.

    That distinction matters if Civ/factory later models this as a concurrency guarantee.

    Keep as CHECK/limited-confidence until current-head evidence is re-reviewed, but the old “SOURCE-only” limitation is no longer accurate.

  3. kvnloo commented on Sep 25, 2026

    @kvnloo
    OwnerAuthor

    PROMOTE — Wave 1

    Independent QA found one important follow-up that the PR body names as out of scope but does not appear to have a dedicated current issue: cross-process abort ownership.

    Before posting, re-pin the current head and search origin for a newer issue/PR covering this exact case.

    If still unowned, post a short design/review comment on anomalyco#50968:

    One follow-up seems worth tracking as this becomes the cross-process session ownership model: abort remains process-local.

    POST /session/:id/abort promises to stop ongoing processing, but SessionRunState.cancel() only cancels a runner in the current process. If process B is waiting on process A's lease, an abort handled by B can return success / set local status idle while A's provider or tool turn continues.

    This looks like the cross-process analogue of anomalyco#29894, whose older same-process instance mismatch was fixed by 87c33b3. It need not block the duplicate-run fix if intentionally out of scope, but it seems worth an explicit follow-up/regression: hold the lease/run in process A, call the public abort path through process B, and require A's in-flight turn/tool to stop.

    Keep it concise; OpenCode explicitly rejects AI walls of text. Do not open a duplicate issue if search finds an existing owner.

    Return

    Reply here with the upstream URL and whether this became (a) a PR comment, (b) an existing issue reference, or (c) a newly requested issue by maintainers.

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

    grok bot

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions