Skip to content

CLI runner: add orphaned-user-message repair for fallback retries #54192

@mitchmcalister

Description

@mitchmcalister

Context

Identified during review of #44188 (unified fallback retry safety). The embedded runner path (attempt.ts) has orphaned-user-message repair that prevents duplicate user turns on fallback retries, but the CLI runner path (cli-runner.ts) does not.

When a CLI provider retry happens with an existing cliSessionId (resume mode) after a rate limit or timeout, the same prompt is appended again to the backend session. This is pre-existing behavior — not introduced by #44188 — but worth addressing.

Expected behavior

CLI runner fallback retries against resumed sessions should not produce duplicate user turns.

Possible approach

Port the orphaned-user-message repair pattern from the embedded runner (attempt.ts) to the CLI runner path, or detect and skip re-submission when the prompt already exists as the last user turn in the CLI session.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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