Skip to content

relayfile status misdirects a delegated-credential 401 to 'agent-relay cloud login' #427

Description

@khaliqgant

runStatus maps any 401 to ErrCloudRefreshExpired, but the client it calls authenticates with the delegated token. So a stale or under-scoped delegated credential makes relayfile status tell the operator to run agent-relay cloud login — a command that does not fix a delegated-credential problem.

This is the same defect class #426 just fixed on the mount path (an error prescribing an action that cannot work in the caller's context), left unclosed on the operator-facing surface.

Where

Line numbers are provisional against 407918b (tip of fix/delegated-credential-sdk-remint-0815, merged as c56c816):

  • cmd/relayfile-cli/main.go:9130 — runStatus does if isUnauthorizedAPIError(err) { return ErrCloudRefreshExpired }
  • cmd/relayfile-cli/main.go:7755-7767 — prepareWorkspaceCommandClient builds that client with the delegated bearer token

Why it is wrong

#426 added a doc comment defining ErrCloudRefreshExpired as "canonical Cloud session absent/incomplete/cannot refresh". The runStatus call site violates that definition: the 401 it observes can equally come from a delegated credential that is expired or lacks the required scope, which is what ErrDelegatedScopeInsufficient / ErrDelegatedScopeInvalid exist to express.

Not a regression

The pre-#426 text was equally wrong, so nothing got worse. #426 closed the loop on the mount daemon path only.

Suggested fix

Classify at the runStatus call site the same way degradedStallClassFor does on the mount path — distinguish a canonical-session 401 from a delegated-credential 401 and return the matching sentinel — rather than collapsing both to ErrCloudRefreshExpired.

Definition of done

  • A test that drives runStatus with a 401 originating from a delegated credential and asserts the operator text does not prescribe agent-relay cloud login.
  • A paired test for the genuine canonical-session 401 that asserts it still does. (Must-fire and must-not-fire, not just the new arm.)

Found by the independent review of #426 (reviewer rf426-independent-review-0816, finding F1); filed by factory-lead. Not dispatched — no readiness label.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions