Skip to content

fix: tighten env var surface#560

Merged
thymikee merged 1 commit into
mainfrom
codex/audit-env-surface
May 19, 2026
Merged

fix: tighten env var surface#560
thymikee merged 1 commit into
mainfrom
codex/audit-env-surface

Conversation

@thymikee
Copy link
Copy Markdown
Member

@thymikee thymikee commented May 19, 2026

Summary

Tightens the public env-var surface for agent-device and closes the env visibility/security cleanup from #559.

Closes #559

  • Removes hidden/legacy env controls for simulator/device scoping aliases, private source URLs, timeout tuning, retry logs, strict flags, Android bundletool mode, apps filtering, and AGENT_DEVICE_PROXY_TOKEN.
  • Defaults Metro proxy auth to AGENT_DEVICE_DAEMON_AUTH_TOKEN when proxy mode is enabled and no explicit Metro bearer token is provided.
  • Keeps the documented public env surface focused on supported user/operator inputs, with stale docs and tests updated accordingly.
  • Preserves prior CI timeout budgets as fixed defaults and removes the now-unused shared timeout profile wrapper.
  • Refactors Metro prepare/proxy setup into smaller helpers and removes dead compatibility branches; the final pass also simplified reload helper shape and aligned missing-base-url errors with proxy-only prepare.
  • Updates the provider-backed Android scenario contract to distinguish apkInstallCalls from bundleInstallCalls, matching the fixed universal AAB install path explicitly.

Touched-file count: 47. Scope expanded beyond docs into CLI/runtime cleanup because the audit found removed envs wired through source and tests.

Validation

Ran formatting, lint/typecheck, dead-code/complexity audit, focused unit tests for Metro/proxy/runtime cleanup, install-source/source safety, Android devices/install, iOS runner config, retry helpers, args/docs coverage, plus pnpm build:xcuitest for the Swift runner env cleanup. Final focused Vitest pass covered 12 files / 330 tests. CI fix validation: pnpm exec vitest run --project provider-integration test/integration/provider-scenarios/android-lifecycle.test.ts, pnpm format, and pnpm check:quick. The focused Vitest suite requires loopback server binding, so it was run outside the sandbox after earlier sandboxed runs hit listen EPERM.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstackincubator.github.io/agent-device/pr-preview/pr-560/

Built to branch gh-pages at 2026-05-19 13:35 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55364b90d6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/client-metro.ts Outdated
} {
if (proxyBaseUrl && !proxyBearerToken) {
const resolvedProxyBearerToken = proxyBaseUrl
? proxyBearerToken || normalizeOptionalString(env.AGENT_DEVICE_DAEMON_AUTH_TOKEN) || ''
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Respect the Metro bearer-token env fallback

When prepareMetroRuntime/prepareRemoteMetro are used directly with proxyBaseUrl and an env containing AGENT_DEVICE_METRO_BEARER_TOKEN, this still treats proxy auth as missing because the new fallback only reads AGENT_DEVICE_DAEMON_AUTH_TOKEN. CLI flag resolution masks this for normal CLI invocations, but the exported runtime API accepts an env map and the error/docs now tell users to set AGENT_DEVICE_METRO_BEARER_TOKEN, so direct API callers following that guidance will get the incomplete-proxy-config error instead of using the token.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in efa649b40: direct prepareMetroRuntime / prepareRemoteMetro proxy auth now resolves in this order: explicit proxyBearerToken, env.AGENT_DEVICE_METRO_BEARER_TOKEN, then env.AGENT_DEVICE_DAEMON_AUTH_TOKEN. Added a focused regression test for the Metro bearer env path.

Validation: focused Metro tests passed with loopback permissions, and pnpm check:quick passed.

@thymikee thymikee force-pushed the codex/audit-env-surface branch 13 times, most recently from c1616c7 to 267403b Compare May 19, 2026 13:31
@thymikee thymikee force-pushed the codex/audit-env-surface branch from 267403b to 0cdf338 Compare May 19, 2026 13:34
@thymikee thymikee merged commit 840bef5 into main May 19, 2026
19 checks passed
@thymikee thymikee deleted the codex/audit-env-surface branch May 19, 2026 15:11
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.

Audit env-var surface and promote safe defaults

1 participant