Skip to content

retry_worktree recipe step silently drops model parameter — causes context limit failures on retry #720

@Trecek

Description

@Trecek

Problem

When a headless implementation session (e.g. implement step using opus[1m]) fails and triggers a retry_worktree step, the retry session silently downgrades to sonnet (200K context) regardless of what model the original session used.

This caused Issue #711's retry session to hit "Prompt is too long" at 176,593 tokens — one edit away from completion — when it had 823K tokens of headroom on the original model.

Root Cause

The retry_worktree step in implementation.yaml has no model: key in its with: block. The resolution chain:

  1. Recipe step → no model:run_skill(model="")
  2. _resolve_model(step_model="", config) → falls through to config.model.default = "sonnet"
  3. Session launches with --model sonnet instead of the original opus[1m]

There is no mechanism to carry the model from the implement step to its retry.

Scope

All retry/resolve steps in implementation.yaml are affected:

  • retry_worktree — no model key
  • resolve_failures — no model key
  • resolve_review — no model key

Additionally, remediation.yaml and merge-prs.yaml should be audited for the same gap.

Proposed Fix (Recipe Remediation)

  1. Add a semantic validation rule (e.g. model-required-for-claude-steps) that ensures any recipe step calling run_skill includes a model: parameter — either explicit or via context variable
  2. Add model: to all affected recipe steps, using a context variable that the orchestrator sets from the original step's resolved model

Evidence

Investigation report: .autoskillit/temp/investigate/investigation_issue711_context_limit_2026-04-10_232500.md

Session 1 (implement): claude-opus-4-6 confirmed in JSONL
Session 2 (retry_worktree): claude-sonnet-4-6 confirmed in JSONL — silent downgrade

Clarification: run_skill already accepts a model parameter — the tool interface is fine. The bug is that the retry_worktree (and resolve_failures, resolve_review) recipe steps in implementation.yaml don't include model: in their with: block, so the parameter is never passed through to the headless session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugExisting behavior is brokenrecipe:remediationRoute: investigate/decompose before implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions