← Back to Pull requests

fix(refocus): show held and pending work as labelled context when nothing is in progress #3821

Closed
unknown closed this pull request without merging on Nov 25, 2026 16:42 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 09:10 UTC
Author

What changed

A seat that compacts or refocuses while its work is parked on another row, or still pending, lost its mission context:

  • the default path (work packet off, on both runtimes) printed FALLBACK — no current typed baton … Showing the project-level chain from the work root;

  • the work-packet path printed No in-progress queue row names your work.
  • Neither showed the mission the seat's held or pending rows belong to.

    Now, when nothing is in progress, held and pending rows come back as labelled context: never as current work, and nothing resumes them.

    The daemon (current-work.ts, routes/queue.ts):

  • Held and next rows carry their own scope: their mission:/slice: tags, resolved through the same resolveMissionsRoot + resolveTagged as an in-progress tag candidate. A slice pairs with its mission only when the row has exactly one of each, as before.

  • A row with no summary gets its body's first line instead.

  • With nothing in progress, rig queue whoami --json --held-work (route held=1) carries these rows as heldAndPendingWork, using the same bounded reads as --work-candidates: blocked and pending only, 50 each, with per-list truncation flags. Like candidates=1, it's only on request, so a plain whoami answer is unchanged.

  • The answer is unchanged for a seat with work in progress, and the field is absent with no held or pending rows.
  • The hook (refocus.cjs): it asks for held work on its one lookup (--held-work) only where its trace can use it (work packet off, no explicit start, not a topology-only trace), and passes heldAndPendingWork to the trace (--held-work -). There's no second lookup. An older CLI that rejects the flag is asked again plainly. A current work node, an explicit start or a topology-only trace never passes it.

    The trace (trace-to-root.py):

  • One shared trace only when every held and pending row resolves to the same mission directory (compared by resolved path, so the same name in two project roots is two missions) and neither list was cut. It goes down to the slice only when every row resolves to the same slice directory; otherwise it stops at the mission. The trace is headed CONTEXT FROM HELD AND PENDING WORK … It is context, not your current work: using it does not resume a task.

  • Otherwise a list for the agent to choose from: each named mission with its folder, the reason no single one was traced, and the existing --work-start line. Today's broad orientation stays below it. The reasons: different missions, a row with no mission or an unresolved one, a cut list, or an older daemon that sends no folders.

  • No mission named at all: today's fallback, unchanged.

  • Held and next rows also show [mission: … / slice: …], with UNRESOLVED ON THIS HOST when their tags didn't resolve.
  • Unchanged: queue state, custody, wakes, priority, the daemon's currentWork/currentWorkBasis, explicit work selection and the resolved in-progress path. Completed work never appears. Recently closed work isn't added here.

    Tests


  • New cells in refocus-work-packet.test.ts, refocus-context-ref.test.ts and queue-routes.test.ts:

  • - held-only, pending-only, conflicting missions, none, same mission with different slices (stops at the mission), same names in different project roots (no shared chain);
    - a held row with a mission tag and no slice (reaches the mission);
    - four partial cases (a cut held list, a cut list from an older daemon, an unresolved mission, a row with no mission);
    - an empty summary, a catalogued project outside the workspace, the packet path;
    - the hook with the packet off (Claude and Codex) and the older-CLI fallback;
    - the route's plain answer;
    - an end-to-end parked seat through the real hook and trace.
  • With the four product files swapped back to main, 25 cells fail; all pass here.

  • Completed-only work never becoming current, and nothing extra beside in-progress work, pass on both.

  • At dfcd2360: the 19-file refocus/current-work/whoami/queue-route set 536/536; refocus-role and the other refocus-hook files pass; CLI queue.test.ts 188/188. scripts/pr-scenarios.test.mjs: 24/24. mirror-skills --check passes; skill-edge-digests.generated.json was regenerated with npm run mirror-skills. tsc --noEmit is clean for the daemon and the CLI.

  • Printed trace commands quote every real path once (a missions root with a space works), and held and pending scope text uses the existing one-line, 160-character bound.
  • Scenario pins updated: refocus-parked-baton-packet-off used to require the FALLBACK for a parked seat. It now requires the labelled context and the held row, and forbids FALLBACK and WORK FROM QUEUE EVIDENCE. The verifier in test-system/ci/result.mjs and pr-scenarios.test.mjs match it.

    trace-to-root.py is a sensitive file.

    🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    When no work is in progress, refocusing can display held and pending queue items as labelled context. Items that resolve to a shared mission or slice can guide the trace; otherwise, it presents mission choices and read commands.
    Queue context includes mission and slice details, brief summaries, and indicators when lists are truncated. Unresolved or fallback-resolved scopes are identified.
    Added the --held-work option to rig queue whoami to request held and pending work details. Completed items are excluded, and default responses remain unchanged.
    Documentation
    Updated refocusing guidance to explain how held and pending work appears in traces, including scope resolution and fallback behavior.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: mvschwarz Review duration: 3331m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3821"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%