Skip to content

A branch whose diff times out or fails reports prose or raw git stderr in error, so clients can't tell a timeout from other failures #126

Open

Description

@matt-edmondson

What's wrong

The design spec asks for a diff timeout to be reported as its own per-branch failure, the equivalent of a 504 for that branch:

Plan: docs/superpowers/specs/2026-08-19-gitbranchstatecache-design.md L213-L217 in ktsu-dev/GitLfsCache``

A git diff exceeding DiffTimeout returns 504 for that branch only; other branches in the same request still answer. A partial answer is explicitly labelled so a client never mistakes it for "nothing changed".

What exists today:

  • Per-branch isolation and partial: true both work (GitBranchStateCache/Endpoints/BranchStateHandler.cs, BuildStateAsync). Test: Post_State_WhenADiffTimesOut_TheOtherBranchesStillAnswer.
  • GitBranchStateCache/Diffs/DiffOutcome.cs records TimedOut, but the handler never reads it.
  • BranchStateHandler.cs:258 sets the branch's error to diff.Failure:
    • On a timeout that is the sentence "The diff for this branch exceeded its time budget." (DiffOutcome.cs:35).
    • On any other failure it is the git stderr summary (DiffSource.cs:67, DiffOutcome.Failed(result.Summary)).
  • The only machine-readable per-branch code is no-merge-base (BranchStateHandler.cs:248).

What's missing: a stable, documented per-branch error code. A client that wants to retry a timed-out branch, but not one with a corrupt object, has to match on English prose or on git's own stderr. Both can change with a reworded message or a different git version. Raw stderr in a response body also exposes mirror paths and git internals to the client.

Failure scenario

A UE editor plugin queries 20 branches, and one large branch exceeds DiffTimeout. The response is 200, partial: true, and that branch carries error: "The diff for this branch exceeded its time budget.". To decide "retry later" rather than "warn the user that something is broken", the client has to compare against that exact sentence. A different branch failing with fatal: bad object … carries that stderr text in the same field, and nothing in the shape of the response separates the two.

Acceptance criteria

  • A timed-out diff reports error: "timeout" on its branch.
  • Any other diff failure reports a distinct fixed code, for example diff-failed. Git's stderr goes to the log (as EndpointLog.BranchFailed already does) or to a separate optional message field, never to error.
  • no-merge-base stays as it is.
  • Post_State_WhenADiffTimesOut_TheOtherBranchesStillAnswer asserts the code, and a new test covers the non-timeout failure.
  • The README lists the per-branch error codes.

Dependencies

#69 (git timeouts in merge-base and the commit check are reported as no-merge-base or unknown-base) suggests mapping a merge-base timeout to "the branch-level timeout error the diff path already uses", but no such code exists yet. Land this first so #69 can reuse it, or widen #69 to cover both.

Activity

  1. matt-edmondson commented on Nov 7, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    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