Skip to content

feat: port upstream PR #6371 — guard cheap/recovery model from writing deliverables (extend to Kimi fallback) #31

Description

@AnilChinchawale

Tracks upstream paperclipai/paperclip#6371 (merged 2026-05-19).

Problem

Today there is no constraint stopping a "cheap recovery model" run from writing production deliverables. When a primary model fails and Paperclip falls back to a cheaper model (e.g., Kimi K2.6 in our case), that cheaper run can author PRs, modify files, comment on issues, etc. — exactly the failure mode reported upstream in #6698 ("Failure when using cheap model when primary fails due to limit").

Why this matters for Levi

Levi's PR #26 introduces exactly the kind of cross-model fallback this guard is designed to constrain. Without it, the Kimi fallback could write production deliverables on what was meant to be a recovery-only model. We need the guard BEFORE the cheap-fallback footprint grows.

What the upstream PR adds

  • Separates status-only cheap recovery from normal source-work continuations
  • Route guards: cheap-recovery runs cannot write deliverables (commit, PR, document mutations)
  • 529 additions across heartbeat/recovery + route guards

Effort

M — recovery state machine is one of the most-touched files upstream; conflicts with Levi's #26 path are likely.

Risk

M — recovery state machine is failure-sensitive. Mitigate with a focused regression test on the Claude→Kimi fallback case ensuring it cannot post commits/PRs.

Levi-specific implementation note

Re-target the guard to also cover the Kimi-via-env-swap (or kimi-CLI-delegate) path: the fallback should mark the run as recovery_only and inherit the same write restrictions. Coordinate with the PR #26 rework to wire the recovery_only flag in the same change.

Acceptance criteria

  • A run marked recovery_only cannot POST to /api/issues/:id/comments, PATCH issue body, or invoke git/PR tools
  • When Kimi fallback fires, the resulting run is marked recovery_only by default
  • Per-agent override: adapterConfig.fallback.allowDeliverables: true lets operators opt in
  • Regression test: simulated Claude quota → Kimi fallback → assistant tries to commit → blocked with clear error

Surveyed by the Levi planning agent on 2026-05-26.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions