opencode-mission-control icon indicating copy to clipboard operation
opencode-mission-control copied to clipboard

feat: Annotate session titles when jobs need attention

Open nigel-dev opened this issue 9 months ago • 0 comments

Prerequisites

  • #74 — Session-aware notification routing (provides launchSessionID on jobs)

Description

When a job completes, fails, or needs user input, annotate the launching session's title in the session picker so the user can see at a glance which sessions have pending work — without switching into them.

Proposed Behavior

Title annotation on job events

Event Title change
Job completed "My Session" → "My Session — ✅ auth-api done"
Job failed "My Session" → "My Session — ❌ auth-api failed"
Job needs input (question/permission) "My Session" → "My Session — ⚠️ auth-api needs input"
Multiple jobs need attention "My Session" → "My Session — ⚠️ 3 jobs need attention"

Title reset

When the user switches into the session (detected via tool.execute.before or command.execute.before firing with that session's ID), reset the title to its original value.

Implementation

  1. Store the original session title when first annotating (avoid clobbering on repeated updates)
  2. Use client.session.update({ path: { id: launchSessionID }, body: { title: annotatedTitle } }) to rename
  3. On session re-entry, restore: client.session.update({ path: { id: sessionID }, body: { title: originalTitle } })
  4. If multiple events fire for the same session before the user checks, aggregate (e.g., "⚠️ 3 jobs need attention" instead of overwriting repeatedly)

UX Flow

  1. User is in Session B
  2. Job launched from Session A completes
  3. Toast pops up — ephemeral "auth-api completed" alert
  4. User opens session picker (ctrl+p) — sees "My Session — ✅ auth-api done"
  5. User switches to Session A — full context message is waiting (#74)
  6. Title resets to "My Session"

Notification Stack (layered)

Layer Mechanism Visibility Persistence
1 Toast Immediate, any session Ephemeral (few seconds)
2 Session title annotation Session picker Until session is opened
3 Message in launching session (#74) In-session Permanent

Files Involved

  • src/index.ts — session entry detection for title reset
  • src/lib/orchestrator.ts — annotate title on job events alongside existing toast/notify calls
  • New: title state tracking (original title storage, aggregation logic)

SDK API

// Rename
await client.session.update({
  path: { id: launchSessionID },
  body: { title: "My Session — ⚠️ auth-api needs input" }
});

// Reset on re-entry
await client.session.update({
  path: { id: sessionID },
  body: { title: originalTitle }
});

nigel-dev avatar Feb 14 '26 17:02 nigel-dev