Skip to content

fix(coding-agent): adopt upstream background-command notice deduplication #64

Description

@rynfar

A finished background command can queue a completion notice before the model reads its result in the next cell. The redundant notice can then trigger an unnecessary extra turn.

Review and adopt Prime upstream #2159, merged as ecd60e3. The upstream change withdraws a pending completion notice when a live cell consumes the finished command's result.

Acceptance:

  • Preserve unread notifications that wake idle sessions, including reads by detached watchers that do not deliver a result to a live cell.
  • Withdraw only the matching pending notice; preserve delivered notices and distinguish reused PIDs/identical commands.
  • Run the affected Python and coding-agent regressions for reads before dispatch, after host acceptance, and after delivery.
  • Verify the native Pylon path completes the intended turn without a redundant completion-triggered turn, while preserving prompt ownership, queue delivery, and Stop behavior.

Suggested priority: reliability fixes first.

Backlog follow-up under #1 and Pylon's Prime integration tracker. The completed September integration remains the baseline; this issue tracks later upstream adoption. Before implementation, refresh upstream evidence and record the ownership decision and focused verification in .pylon/features.yaml and .pylon/upstream-review.md.

Activity

  1. rynfar commented on Sep 14, 2026

    @rynfar
    Author

    Pre-adoption review of upstream ecd60e3cd4313643dede3cb2fcf13b4e2e9a2a75 found an identity gap: bash.consumed carries only PID and command, and _withdrawAsyncBashCompletionNotice removes the earliest matching queued notice. If two retained handles reuse a PID for the same command and the newer handle is read first, this removes the older unread notice. The upstream test checks queue length after two reads, but does not establish which handle's notice survives.

    Before adoption, cover reversed read order with distinguishable completion details and preserve the older unread notice. Prefer a per-handle completion identity carried through acceptance and withdrawal, with explicit behavior for an older host/runtime. Retain the existing live-cell/detached-reader safeguards and no withdrawal after delivery. This is a source-level finding; an isolated runtime reproduction is still required.

  2. rynfar commented on Sep 15, 2026

    @rynfar
    Author

    Source adoption merged in #72 as 5af6c31631367248fb0c1303a3aa706571f6f31b after all required checks passed, including both publication platforms. The per-handle completion identity and exact host acknowledgment close the PID/command reuse gap. Detached readers, unread and delivered notices, and older-host behavior retain their safeguards.

    Verification includes 109 Python REPL tests, the focused TypeScript/kernel regressions, and 42 focused tests after updating the branch with OpenCode maintenance routing. CI for the reviewed commit is green.

    Final runtime delivery remains in pylon-code/pylon#557. pylon-code/pylon#577 adds the explicit native background-result acceptance case; its real-kernel cells and response-parser checks pass locally, but its complete proof against the final signed artifact is still pending. No new Prime runtime has been installed for this batch yet.

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

    bugSomething isn't workingpkg:coding-agentAffects packages/coding-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions