Skip to content

Session-scoped default /opencode:result and /opencode:cancel selection #31

Closed

Description

@JohnnyVicious

Summary

/opencode:status is scoped to the current Claude session, but implicit /opencode:result and /opencode:cancel are not. In a multi-session workspace, one Claude session can hide another session's running jobs in status but still cancel or display them through the implicit default selection path.

Local evidence

  • handleStatus() passes { sessionId } to buildStatusSnapshot(...).
  • handleResult() calls resolveResultJob(state.jobs ?? [], ref) without session filtering.
  • handleCancel() calls resolveCancelableJob(state.jobs ?? [], ref) without session filtering.

The underlying helpers in plugins/opencode/scripts/lib/job-control.mjs also do not accept a session-id option.

Expected behavior

  • With no explicit job id, result and cancel should use the same current-session visibility rules as status.
  • If the current session has no matching job, implicit result/cancel should say so rather than selecting another session's job.
  • Explicit result <job-id> and cancel <job-id> can remain cross-session precision operations.

Suggested fix

Filter jobs by getClaudeSessionId() in handleResult() and handleCancel() only when ref is omitted. Keep exact/prefix explicit references searching all jobs.

Add tests for:

  1. status hides another session's jobs.
  2. implicit cancel does not cancel another session's running job.
  3. implicit result does not show another session's latest finished job.
  4. explicit job-id lookup still works across sessions.

Upstream references

Derived from openai/codex-plugin-cc#82 and related session-scoping behavior from #81.

Activity

  1. changed the title [-]Implicit /opencode:result and /opencode:cancel ignore Claude session scoping[/-] [+]Session-scoped default /opencode:result and /opencode:cancel selection[/+] on Apr 12, 2026
  2. JohnnyVicious commented on Apr 12, 2026

    @JohnnyVicious
    OwnerAuthor

    Consolidating #45 here. The canonical scope is session-aware implicit job selection for both result and cancel, while preserving explicit job-id lookup as a cross-session override.

  3. JohnnyVicious commented on Apr 12, 2026

    @JohnnyVicious
    OwnerAuthor

    Fixed by PR #51 commit 260d84b — resolveCancelableJob now filters default target by sessionId; explicit ref still searches all active jobs. handleResult and handleCancel similarly scope.

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