Skip to content

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

@JohnnyVicious

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.

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