Skip to content

Deploy v1 CLI runtime credentials and customer example#109

Merged
khaliqgant merged 4 commits into
mainfrom
codex/deploy-v1-cred-runtime-workforce
May 13, 2026
Merged

Deploy v1 CLI runtime credentials and customer example#109
khaliqgant merged 4 commits into
mainfrom
codex/deploy-v1-cred-runtime-workforce

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

Summary

  • Replaces login/logout workspace-token flow with @agent-relay/cloud auth, workspace selection, token persistence, and resolver precedence.
  • Adds deployment list CLI, runtime picker, relayfile integration resolver/preflight, BYOK/managed harness-source wiring, and cloud destroy/list support.
  • Wires runtime ctx.memory to the cloud memory endpoint, extends GitHub helpers, and adds the Notion essay PR example, smoke test, onboarding guide, and completed spec checklist.

Verification

  • corepack pnpm --filter @agentworkforce/runtime test
  • corepack pnpm --filter @agentworkforce/deploy test
  • corepack pnpm --filter @agentworkforce/cli test
  • corepack pnpm run typecheck:examples
  • compiled Notion essay PR smoke: 2 tests passed
  • git diff --check

Merge after cloud PR https://github.com/AgentWorkforce/cloud/pull/580 is deployed, then publish the CLI/onboarding docs.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 41e1ab4b-91cc-4398-b08a-32cff4b573da

📥 Commits

Reviewing files that changed from the base of the PR and between 26ae5c0 and de1f90f.

📒 Files selected for processing (4)
  • packages/deploy/src/login.ts
  • packages/deploy/src/modes/cloud.test.ts
  • packages/deploy/src/modes/cloud.ts
  • packages/runtime/src/cloud-defaults.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/deploy/src/modes/cloud.test.ts
  • packages/deploy/src/login.ts
  • packages/runtime/src/cloud-defaults.ts

📝 Walkthrough

Walkthrough

Implements deploy-v1 cloud auth and credential flows, Relayfile-backed integration resolver, runtime FilesContext and cloud memory, GitHub PR client, CLI runtime/deployments/login/logout, Notion→essay example + persona, extensive tests, and onboarding/docs.

Changes

Deploy-v1 Feature Complete

Layer / File(s) Summary
Documentation and onboarding
docs/customers/proactive-agents-onboarding.md, docs/plans/deploy-v1-credentials-runtime-checklist.md
Onboarding guide for the Notion→essay example and a deploy-v1 checklist covering schema migrations, login, provider credentials, CLI, runtime wiring, memory, integration connect, tests, and risk controls.
Notion→essay agent and persona
examples/notion-essay-pr/agent.ts, examples/notion-essay-pr/persona.json
Event handler for Notion page.created that reads page markdown, recalls workspace memories, drafts an essay via harness, writes /workspace/output/<page>.md, opens a GitHub PR on essay/<sanitized> branch, saves a memory record, and includes payload parsing and sanitization.
Notion→essay smoke and e2e tests
examples/notion-essay-pr/notion-essay-pr.smoke.test.ts, packages/deploy/test/e2e/notion-essay-pr.smoke.test.ts
Local and e2e smoke tests using a mocked runtime to assert AGENTS.md generation, Notion page read, output file contents, single PR creation with expected metadata (including files), and memory save.
Runtime types and GitHub client
packages/runtime/src/types.ts, packages/runtime/src/clients/github.ts, packages/runtime/src/clients/github.test.ts
Adds FilesContext and HarnessUsage types, extends memory options (ttlSeconds/scope), updates MemoryContext.save return type, adds WorkforceCtx.files, and implements GithubClient.createPullRequest to write Relayfile draft JSON with optional files.
Runtime context: files and cloud memory
packages/runtime/src/ctx.ts, packages/runtime/src/ctx.test.ts
Adds CtxBuildOptions.files, filesFromSandbox adapter, defaultMemoryFor and createCloudMemoryContext implementing cloud-backed memory save/recall with auth, TTL handling, timeouts, and safe fallbacks; tests exercise delegation, HTTP shapes, error/timeouts, relaycast fallbacks, and memory.enabled=false.
Cloud defaults and harness runner
packages/runtime/src/cloud-defaults.ts, packages/runtime/src/runner.ts, packages/runtime/src/runner.test.ts
Introduces createCloudRuntimeDefaults exposing sandbox/files/integrations/harnessRunner, spawn-and-capture harness execution, usage extraction/reporting, workspace path enforcement, and wires startRunner to use cloud defaults; tests validate harness execution, PR creation, and usage reporting.
CLI runtime picker and deployments list
packages/cli/src/runtime-picker.ts, packages/cli/src/list-command.ts, packages/cli/src/list-command.test.ts, packages/cli/src/cli.ts, packages/cli/package.json
Adds interactive runtime picker (pickRuntime), deployments list CLI (runDeploymentList) with parsing and table/JSON output, updates help/usage and top-level routing, and adds @agent-relay/cloud dependency.
Deploy command, login, and logout
packages/cli/src/deploy-command.ts, packages/cli/src/deploy-command.test.ts
Injectable deploy dependencies for tests; runtime selection when --mode omitted (with no-prompt enforcement); refactored runLogin to select/workspace mint and persist workspace tokens; new runLogout clears stored auth/tokens; tests added for login/logout.
Workspace token persistence & cloud auth
packages/deploy/src/login.ts, packages/deploy/src/login.test.ts
Extends stored login shape (workspaceSlug, workspaceId), prefers cloud-stored auth with local JSON fallback, adds loadActiveWorkspaceToken, writeStoredWorkspaceToken, clearStoredWorkspaceToken, cloud-auth read/refresh/write helpers, and tests for persistence, env precedence, no-prompt behavior, and clearing.
Relayfile-backed integration resolver
packages/deploy/src/connect.ts, packages/deploy/src/connect.test.ts
Implements relayfileIntegrationResolver to query Relayfile integrations, initiate connect sessions, optionally open browser URLs, and poll status until connected or timeout; updates connectIntegrations messaging when prompts are disabled; includes tests for isConnected, connect polling, and timeout handling.
Deploy wiring and cloud launcher refactor
packages/deploy/src/deploy.ts, packages/deploy/src/index.ts, packages/deploy/src/modes/cloud.ts, packages/deploy/src/modes/cloud.test.ts
deploy() unified workspace auth resolution; introduces mode-aware defaultIntegrationResolver (env vs relayfile); cloud launcher collects credential_selections from ensureHarnessReady; saveProviderCredential returns credential IDs and supports /provider-credentials/managed and /provider-credentials/byok; OAuth connect uses connectProvider + polling; tests updated to match new provider-credentials contract and BYOK handling.
Tests and minor CLI/package updates
multiple packages/* test files and package.json changes
Numerous test additions and updates (deploy, connect, runner, ctx, runtime, CLI) to cover new behaviors; CLI and deploy packages add @agent-relay/cloud dependency; help text and usage updates applied across CLI.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

"I hopped through code with a tiny pen,
Drafted essays from Notion, then pushed them again,
Tokens tucked safe, memories snug and bright,
CLI chose a runtime, harness hummed through the night,
A PR sprang up — hooray! — beneath the CI light."

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/deploy-v1-cred-runtime-workforce

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
packages/cli/src/cli.ts (1)

2148-2158: ⚡ Quick win

Remove the duplicate deployments dispatch path in runList.

The early args.includes('--deployments') branch already routes and exits, so the later if (deployments) block is redundant and can drift over time.

♻️ Suggested simplification
 async function runList(args: readonly string[]): Promise<never> {
   if (args.includes('--deployments')) {
     await runDeploymentList(args.filter((arg) => arg !== '--deployments'));
     process.exit(0);
   }
 
-  const { json, filterHarness, filterTag, display, deployments } = parseListArgs(args);
-  if (deployments) {
-    await runDeploymentList(args.filter((arg) => arg !== '--deployments'));
-    process.exit(0);
-  }
+  const { json, filterHarness, filterTag, display } = parseListArgs(args);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/cli.ts` around lines 2148 - 2158, In runList, remove the
redundant second dispatch that checks `if (deployments)` and calls
`runDeploymentList`/`process.exit(0)` because the earlier `if
(args.includes('--deployments'))` branch already handles that; locate the
`runList` function and the `if (deployments)` block (after the call to
`parseListArgs`) and delete that block so only the initial
`args.includes('--deployments')` branch routes to `runDeploymentList`
(references: runList, parseListArgs, runDeploymentList).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/plans/deploy-v1-credentials-runtime-checklist.md`:
- Line 3: Replace the machine-specific absolute path after the "Source spec:"
label with a repo-relative path to the spec file (e.g.,
"docs/plans/deploy-v1-credentials-and-runtime-spec.md") so the reference
resolves for all contributors; update the literal string following "Source
spec:" to the repo-relative path format and ensure it points to the correct file
within the repository.

In `@packages/deploy/src/connect.ts`:
- Around line 89-123: The isConnected and connect functions are ignoring the
resolver's workspace argument and always use opts.workspaceId; update both
functions to prefer the passed-in workspace value (the function parameter
object, e.g. the workspace property in isConnected({ provider, workspace }) and
connect({ provider, workspace })) when building URLs and query params (use
encodeURIComponent(workspace) if present, otherwise fall back to
opts.workspaceId), including the connect-session POST URL and the status URL
(and when setting connectionId query param). Ensure all uses of opts.workspaceId
in isConnected, connect (session creation, sessionUrl handling, and status
polling) are replaced with this workspace-aware value.

In `@packages/runtime/src/ctx.ts`:
- Around line 242-277: The save and recall methods perform fetch calls without
timeouts; add an AbortController-based timeout for both functions (e.g., create
const controller = new AbortController(); set a const timer = setTimeout(() =>
controller.abort(), timeoutMs) where timeoutMs is a reasonable default or
configurable), pass controller.signal to fetch (in save: fetch(endpoint, { ...,
signal: controller.signal }), in recall: fetch(url, { headers: ..., signal:
controller.signal })), clearTimeout(timer) after the fetch completes
successfully or in finally, and update the catch blocks to treat an aborted
request (AbortError) as a timeout while logging via args.log and returning
undefined as before.

---

Nitpick comments:
In `@packages/cli/src/cli.ts`:
- Around line 2148-2158: In runList, remove the redundant second dispatch that
checks `if (deployments)` and calls `runDeploymentList`/`process.exit(0)`
because the earlier `if (args.includes('--deployments'))` branch already handles
that; locate the `runList` function and the `if (deployments)` block (after the
call to `parseListArgs`) and delete that block so only the initial
`args.includes('--deployments')` branch routes to `runDeploymentList`
(references: runList, parseListArgs, runDeploymentList).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 68e9873a-e914-499f-bf88-40a380bc0fd9

📥 Commits

Reviewing files that changed from the base of the PR and between 525334b and cb47485.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (31)
  • docs/customers/proactive-agents-onboarding.md
  • docs/plans/deploy-v1-credentials-runtime-checklist.md
  • examples/notion-essay-pr/agent.ts
  • examples/notion-essay-pr/notion-essay-pr.smoke.test.ts
  • examples/notion-essay-pr/persona.json
  • packages/cli/package.json
  • packages/cli/src/cli.ts
  • packages/cli/src/deploy-command.ts
  • packages/cli/src/list-command.test.ts
  • packages/cli/src/list-command.ts
  • packages/cli/src/runtime-picker.test.ts
  • packages/cli/src/runtime-picker.ts
  • packages/deploy/src/connect.test.ts
  • packages/deploy/src/connect.ts
  • packages/deploy/src/deploy.test.ts
  • packages/deploy/src/deploy.ts
  • packages/deploy/src/index.ts
  • packages/deploy/src/login.test.ts
  • packages/deploy/src/login.ts
  • packages/deploy/src/modes/cloud.test.ts
  • packages/deploy/src/modes/cloud.ts
  • packages/deploy/src/modes/input-values.test.ts
  • packages/deploy/test/e2e/notion-essay-pr.smoke.test.ts
  • packages/runtime/src/clients/github.test.ts
  • packages/runtime/src/clients/github.ts
  • packages/runtime/src/ctx.test.ts
  • packages/runtime/src/ctx.ts
  • packages/runtime/src/index.ts
  • packages/runtime/src/proactive.test.ts
  • packages/runtime/src/runner.ts
  • packages/runtime/src/types.ts

Comment thread docs/plans/deploy-v1-credentials-runtime-checklist.md Outdated
Comment thread packages/deploy/src/connect.ts Outdated
Comment thread packages/runtime/src/ctx.ts
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Ricky Schema Cascade added 2 commits May 13, 2026 14:15
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (4)
packages/deploy/src/login.ts (1)

275-277: 💤 Low value

Deleting object entries during iteration is safe but consider clarity.

The code deletes entries from tokens while iterating over Object.entries(tokens) at lines 275-277. In JavaScript, Object.entries() creates a snapshot of entries before iteration, so this is safe. However, using a filter or reduce pattern would make the intent clearer and avoid potential confusion.

♻️ Alternative approach for clarity
-  for (const [key, login] of Object.entries(tokens)) {
-    if (key === target || workspaceMatches(login, target)) delete tokens[key];
-  }
+  const tokens = Object.fromEntries(
+    Object.entries(current.workforce?.workspaceTokens ?? {})
+      .filter(([key, login]) => !(key === target || workspaceMatches(login, target)))
+  );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/deploy/src/login.ts` around lines 275 - 277, The loop deletes
entries from the tokens object during an Object.entries() iteration which is
safe but unclear; replace it by building a new tokens object using a
filter/reduce pattern (e.g., use
Object.fromEntries(Object.entries(tokens).filter(...)) or a reduce) that keeps
only entries where the key !== target && !workspaceMatches(login, target), so
update the code that references tokens (the variable named tokens and the
workspaceMatches(login, target) check) to assign the filtered object back to
tokens instead of deleting while iterating.
packages/deploy/src/modes/cloud.ts (3)

591-601: ⚡ Quick win

Provider detection might incorrectly match substring patterns.

The deriveModelProvider function uses includes() checks on the lowercase model string (lines 594-597), which could produce false positives. For example:

  • A model named "my-openai-alternative" would match "openai"
  • A model named "pseudo-anthropic" would match "anthropic"

After the substring checks, line 599 splits on / or : and takes the first part, but if the model string doesn't contain these delimiters, it returns the entire lowercased model name. If that's empty or whitespace-only, it falls back to persona.harness at line 600.

Consider adding word boundary checks or using exact prefix matching to reduce false positives.

♻️ More precise provider detection
 function deriveModelProvider(persona: PersonaSpec): string {
   const model = typeof persona.model === 'string' ? persona.model.trim() : '';
+  if (!model) return persona.harness;
   const lower = model.toLowerCase();
-  if (lower.includes('anthropic') || lower.includes('claude')) return 'anthropic';
-  if (lower.includes('openai') || lower.includes('codex') || lower.includes('gpt')) return 'openai';
-  if (lower.includes('google') || lower.includes('gemini')) return 'google';
-  if (lower.includes('openrouter') || lower.includes('opencode')) return 'openrouter';
+  // Check provider prefixes first
+  if (lower.startsWith('anthropic/') || lower.startsWith('anthropic:') || lower.startsWith('claude')) return 'anthropic';
+  if (lower.startsWith('openai/') || lower.startsWith('openai:') || lower.startsWith('gpt') || lower.startsWith('codex')) return 'openai';
+  if (lower.startsWith('google/') || lower.startsWith('google:') || lower.startsWith('gemini')) return 'google';
+  if (lower.startsWith('openrouter/') || lower.startsWith('openrouter:')) return 'openrouter';
+  // Fall back to substring checks for compatibility
+  if (lower.includes('anthropic') || lower.includes('claude')) return 'anthropic';
+  if (lower.includes('openai') || lower.includes('gpt')) return 'openai';
   const [provider] = model.split(/[/:]/, 1);
   if (provider?.trim()) return provider.trim().toLowerCase();
   return persona.harness;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/deploy/src/modes/cloud.ts` around lines 591 - 601, The
deriveModelProvider function currently uses loose substring includes() checks
that can false-match names like "my-openai-alternative"; update
deriveModelProvider to use stricter token/prefix matching (e.g., regex with word
boundaries or start-of-string + (end|separator) checks) for the known providers
("anthropic", "claude", "openai", "codex", "gpt", "google", "gemini",
"openrouter", "opencode"), and only fall back to splitting the model on / or :
and returning the first token (trimmed and lowercased) if no strict provider
match is found; ensure the final fallback still returns persona.harness when the
token is empty.

172-173: 💤 Low value

Redundant field names sent for compatibility.

Both credentialSelections (camelCase) and credential_selections (snake_case) are sent in the deploy payload at lines 172-173. Similarly, the BYOK endpoint sends both modelProvider/model_provider and key/api_key at lines 580-583. While this redundancy ensures compatibility with backend variations, it's worth documenting why both forms exist or consolidating once the backend contract stabilizes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/deploy/src/modes/cloud.ts` around lines 172 - 173, The payload
currently sends duplicate fields for compatibility—credentialSelections and
credential_selections (and similarly modelProvider/model_provider and
key/api_key) —so add a short in-code comment at the payload construction site
explaining that both camelCase and snake_case keys are intentionally included to
support mixed backend contracts and that duplicates should be removed once the
API is standardized; alternatively, if you can guarantee the backend contract,
consolidate to a single naming style by removing the redundant keys (update
places where credentialSelections, credential_selections, modelProvider,
model_provider, key, and api_key are set).

694-710: ⚡ Quick win

Token refresh failure silently returns null, losing error context.

At line 698, when refreshStoredAuth fails, the error is caught and null is returned silently. This loses valuable error context that could help debug authentication issues. The caller then proceeds as if no auth exists, which may lead to confusing "run workforce login" messages even when the user is logged in but refresh failed for another reason (e.g., network issue, revoked token).

Consider logging the refresh failure or propagating specific error types.

🔍 Log refresh failures for better diagnostics
 async function readUsableCloudAuth(apiUrl: string): Promise<StoredAuth | null> {
   let auth = await cloudCredentialDeps.readStoredAuth().catch(() => null);
   if (!auth) return null;
   if (isAuthExpired(auth.accessTokenExpiresAt)) {
-    auth = await cloudCredentialDeps.refreshStoredAuth(auth).catch(() => null);
+    auth = await cloudCredentialDeps.refreshStoredAuth(auth).catch((err) => {
+      // Log refresh failure for diagnostics, then proceed as if no auth
+      console.warn(`cloud: token refresh failed: ${err instanceof Error ? err.message : String(err)}`);
+      return null;
+    });
   }
   if (!auth) return null;
   return {
     ...auth,
     apiUrl
   };
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/deploy/src/modes/cloud.ts` around lines 694 - 710,
readUsableCloudAuth is silently swallowing errors from
cloudCredentialDeps.refreshStoredAuth which hides why refresh failed; update
readUsableCloudAuth so the catch around cloudCredentialDeps.refreshStoredAuth
captures the thrown error (e) and either (1) logs it with context (e.g.,
processLogger.error or a module logger) including e.message and e.stack before
returning null, or (2) only swallow and return null for known "no-stored-auth" /
expired-token cases but rethrow or wrap and throw for other errors (network,
revoked token) so callers can differentiate; reference the readUsableCloudAuth
function and cloudCredentialDeps.refreshStoredAuth (and isAuthExpired) when
making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/deploy/src/login.ts`:
- Line 224: The current line auth = await refreshStoredAuth(auth).catch(() =>
auth) silently swallows refresh failures and continues with possibly expired
credentials; replace this with explicit error handling in the calling function
(e.g., wrap refreshStoredAuth(auth) in try/catch) so that on failure you either
throw the refresh error to fail fast or, if you must fallback, first verify the
original auth is still valid (check expiry fields on the auth object) and only
use it when unexpired; update the code paths referencing auth to handle the
thrown error or validated fallback accordingly (referencing refreshStoredAuth
and the surrounding login logic that consumes auth).

In `@packages/runtime/src/cloud-defaults.ts`:
- Around line 436-453: The fetch to usageUrl when reporting harness usage
currently has no timeout and can hang the runner; modify the send so it uses an
AbortController with a short timeout (e.g., few seconds), pass controller.signal
into the fetch options, and ensure the call is wrapped in a try/catch that
ignores or logs abort/timeouts (so the harness run doesn't block); update the
fetch invocation that uses token and body built from args (workspaceId,
deploymentId, agentId, personaId, harness, model, durationMs, exitCode, usage)
to include the signal and clear the timeout on completion.

---

Nitpick comments:
In `@packages/deploy/src/login.ts`:
- Around line 275-277: The loop deletes entries from the tokens object during an
Object.entries() iteration which is safe but unclear; replace it by building a
new tokens object using a filter/reduce pattern (e.g., use
Object.fromEntries(Object.entries(tokens).filter(...)) or a reduce) that keeps
only entries where the key !== target && !workspaceMatches(login, target), so
update the code that references tokens (the variable named tokens and the
workspaceMatches(login, target) check) to assign the filtered object back to
tokens instead of deleting while iterating.

In `@packages/deploy/src/modes/cloud.ts`:
- Around line 591-601: The deriveModelProvider function currently uses loose
substring includes() checks that can false-match names like
"my-openai-alternative"; update deriveModelProvider to use stricter token/prefix
matching (e.g., regex with word boundaries or start-of-string + (end|separator)
checks) for the known providers ("anthropic", "claude", "openai", "codex",
"gpt", "google", "gemini", "openrouter", "opencode"), and only fall back to
splitting the model on / or : and returning the first token (trimmed and
lowercased) if no strict provider match is found; ensure the final fallback
still returns persona.harness when the token is empty.
- Around line 172-173: The payload currently sends duplicate fields for
compatibility—credentialSelections and credential_selections (and similarly
modelProvider/model_provider and key/api_key) —so add a short in-code comment at
the payload construction site explaining that both camelCase and snake_case keys
are intentionally included to support mixed backend contracts and that
duplicates should be removed once the API is standardized; alternatively, if you
can guarantee the backend contract, consolidate to a single naming style by
removing the redundant keys (update places where credentialSelections,
credential_selections, modelProvider, model_provider, key, and api_key are set).
- Around line 694-710: readUsableCloudAuth is silently swallowing errors from
cloudCredentialDeps.refreshStoredAuth which hides why refresh failed; update
readUsableCloudAuth so the catch around cloudCredentialDeps.refreshStoredAuth
captures the thrown error (e) and either (1) logs it with context (e.g.,
processLogger.error or a module logger) including e.message and e.stack before
returning null, or (2) only swallow and return null for known "no-stored-auth" /
expired-token cases but rethrow or wrap and throw for other errors (network,
revoked token) so callers can differentiate; reference the readUsableCloudAuth
function and cloudCredentialDeps.refreshStoredAuth (and isAuthExpired) when
making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ef88374c-6eb1-4664-bdd5-5ad9dd706228

📥 Commits

Reviewing files that changed from the base of the PR and between cb47485 and c1e9513.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • docs/plans/deploy-v1-credentials-runtime-checklist.md
  • examples/notion-essay-pr/persona.json
  • packages/cli/src/cli.ts
  • packages/cli/src/deploy-command.test.ts
  • packages/cli/src/deploy-command.ts
  • packages/deploy/package.json
  • packages/deploy/src/connect.test.ts
  • packages/deploy/src/connect.ts
  • packages/deploy/src/deploy.ts
  • packages/deploy/src/index.ts
  • packages/deploy/src/login.ts
  • packages/deploy/src/modes/cloud.test.ts
  • packages/deploy/src/modes/cloud.ts
  • packages/runtime/src/cloud-defaults.ts
  • packages/runtime/src/ctx.test.ts
  • packages/runtime/src/ctx.ts
  • packages/runtime/src/runner.test.ts
  • packages/runtime/src/runner.ts
  • packages/runtime/src/types.ts
🚧 Files skipped from review as they are similar to previous changes (9)
  • examples/notion-essay-pr/persona.json
  • packages/runtime/src/types.ts
  • packages/runtime/src/ctx.test.ts
  • packages/deploy/src/connect.test.ts
  • packages/deploy/src/connect.ts
  • packages/cli/src/deploy-command.ts
  • packages/deploy/src/deploy.ts
  • packages/cli/src/cli.ts
  • packages/runtime/src/ctx.ts

Comment thread packages/deploy/src/login.ts Outdated
Comment thread packages/runtime/src/cloud-defaults.ts
@khaliqgant khaliqgant merged commit a3d41e8 into main May 13, 2026
2 checks passed
@khaliqgant khaliqgant deleted the codex/deploy-v1-cred-runtime-workforce branch May 13, 2026 12:56
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