Skip to content

fix(cli): explain trigger auth source on 403#248

Merged
khaliqgant merged 1 commit into
mainfrom
fix/trigger-auth-403-hint
Jun 21, 2026
Merged

fix(cli): explain trigger auth source on 403#248
khaliqgant merged 1 commit into
mainfrom
fix/trigger-auth-403-hint

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Jun 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Track whether deployment CLI auth came from WORKFORCE_* env credentials or the Agent Relay cloud session.
  • Include that auth source in agentworkforce trigger 403 errors so operators know whether to unset stale env credentials or refresh cloud login.
  • Add focused tests for the new 403 hints and env-token auth source.

Validation

  • pnpm --filter @agentworkforce/cli exec tsc -p tsconfig.json --noEmit
  • pnpm --filter @agentworkforce/cli exec tsc -p tsconfig.json && node --test packages/cli/dist/trigger-command.test.js
  • pnpm --filter @agentworkforce/deploy exec tsc -p tsconfig.json --noEmit
  • cd packages/deploy && pnpm --filter @agentworkforce/deploy exec tsc -p tsconfig.json && node --test dist/login.test.js

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@khaliqgant, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 25 minutes and 54 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 383cb23f-4e1e-4171-a768-380fae1523b0

📥 Commits

Reviewing files that changed from the base of the PR and between 45f733c and 425ee81.

📒 Files selected for processing (5)
  • packages/cli/src/list-command.ts
  • packages/cli/src/trigger-command.test.ts
  • packages/cli/src/trigger-command.ts
  • packages/deploy/src/login.test.ts
  • packages/deploy/src/login.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/trigger-auth-403-hint

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 and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces tracking of the authentication source (authSource) as either 'env' or 'cloud-session' when resolving workspace tokens. This source is then utilized to provide more descriptive error hints during manual trigger failures (specifically 403 Forbidden errors). The feedback suggests simplifying the code in list-command.ts by directly accessing auth.authSource instead of using the redundant readAuthSource helper function, as the property is already strongly typed.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +368 to 381
const authSource = readAuthSource(auth);
return {
cloudUrl,
workspace,
token: auth.token,
...(authSource ? { authSource } : {})
};
}

function readAuthSource(value: unknown): 'env' | 'cloud-session' | undefined {
if (!value || typeof value !== 'object') return undefined;
const authSource = (value as { authSource?: unknown }).authSource;
return authSource === 'env' || authSource === 'cloud-session' ? authSource : undefined;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since auth is returned by resolveWorkspaceToken, which is typed to return WorkspaceAuthToken & { workspace?: string }, the authSource property is already strongly typed as 'env' | 'cloud-session' | undefined. We can directly access auth.authSource without needing the helper function readAuthSource and its runtime type checks. This simplifies the code and improves maintainability.

  return {
    cloudUrl,
    workspace,
    token: auth.token,
    ...(auth.authSource ? { authSource: auth.authSource } : {})
  };
}

@khaliqgant khaliqgant merged commit 5b74c28 into main Jun 21, 2026
3 checks passed
@khaliqgant khaliqgant deleted the fix/trigger-auth-403-hint branch June 21, 2026 12:20
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.

1 participant