Skip to content

fix(cli): avoid Agent Relay lookup for saved token workspace - #397

Draft
khaliqgant wants to merge 1 commit into
mainfrom
fix/389-cli-test-hang
Draft

fix(cli): avoid Agent Relay lookup for saved token workspace#397
khaliqgant wants to merge 1 commit into
mainfrom
fix/389-cli-test-hang

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Aug 4, 2026

Copy link
Copy Markdown
Member

Fixes #389.

`loadDelegatedCredentialsForRequest` invoked the real `agent-relay` CLI for credential discovery before checking whether a saved token workspace already had usable delegated credentials, blocking in `exec.Cmd.Wait` — this is what caused `TestReadUsesTokenWorkspace`-family tests to hang. When a token-derived workspace value is empty and legacy delegated credentials already satisfy the requested scopes, use them directly instead of shelling out.

Test plan

  • `go test ./cmd/relayfile-cli/... -run TestReadUsesTokenWorkspaceWhenWorkspaceArgOmitted -v -count=1` — 0.04s (was ~6s before, heading toward the reported hang)
  • `go test ./cmd/relayfile-cli/... -count=1`

Review in cubic

loadDelegatedCredentialsForRequest invoked the real agent-relay CLI
for credential discovery before checking whether a saved token
workspace already had usable delegated credentials, blocking in
exec.Cmd.Wait. When a token-derived workspace value is empty and
legacy delegated credentials already satisfy the requested scopes,
use them directly instead of shelling out.

Fixes #389.

Verified independently:
- go test ./cmd/relayfile-cli/... -run TestReadUsesTokenWorkspaceWhenWorkspaceArgOmitted -v -count=1 (0.04s, was ~6s before)
- go test ./cmd/relayfile-cli/... -count=1
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3e4aae7e-7e33-43c9-b8d6-f907d52e831e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Relayfile Eval Review

Run: .relayfile/evals/runs/2026-08-04T18-00-27-569Z-HEAD-provider
Mode: provider
Git SHA: 4b0afa0

Passed: 4 | Needs human: 0 | Reviewable: 0 | Missing output: 0 | Failed: 0 | Skipped: 0

Human Review Cases

No reviewable human-review cases captured Relayfile output.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate CLI test hang in TestReadUsesTokenWorkspace

1 participant