Skip to content

[DEBT] Make execute session prewarm lazy (Lever F1) #136

Description

@AdrienneBosch

Context

In a real /github-workflow:execute run (2026-06-24), the Session
prewarm
fired three gh calls — candidates, label inventory,
rate_limitbefore the Phase 1 fast path (wf pick) returned ok.
The execute body's own note states .claude/candidates.json "is never
read" when the fast path succeeds. So on the happy path (the path that
actually ran), the candidate fetch was provably wasted, and the
~120-line inline fallback it was warming never executed.

The prewarm predates wf owning pick→claim→board→branch in one call. It
eagerly front-loads work for the inline fallback, inverting priorities:
the common path pays to warm the rare path.

See docs/context-optimization-plan.md → Lever F1. This is the
lowest-risk lever: it removes nothing — the inline fallback stays fully
intact for the Python-less / wf-broke case. It only stops pre-paying
for a path that usually never runs.

Requirements (acceptance criteria)

  • The candidate fetch (.claude/candidates.json) is gated on the
    fast path NOT returning ok
    — it runs only when wf pick yields
    unsupported/error/missing-interpreter and the inline fallback is
    actually entered.
  • Trace where .claude/label-cache.json is consumed (board moves now
    done by wf; finish phase). If no happy-path phase reads it, gate the
    label-inventory fetch the same way; if a later phase still needs it,
    document which and keep it (or defer to first use). Record the finding in
    the PR.
  • The eager rate check stays (cheap, keep-in-context).
  • The prewarm prose moves into a references/ file loaded only when
    the inline fallback fires
    (one level deep from SKILL.md).
  • The inline fallback still works unchanged when entered (no capability
    removed; Python never becomes a hard dependency).
  • Quality gate green; offline tests green; one real end-to-end dry run
    on both the ok fast path and a forced-fallback path.
  • _shared-skills/ source edited if shared, sync run, versions bumped.

Savings goal

Eliminate 2–3 wasted gh API calls per happy-path run (latency +
rate-limit budget) and remove the ~58-line prewarm section from the hot
path. Target: zero eager candidate/label fetches when wf pick returns
ok.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions