From 3de5e0721ac1a6dce686664289c644507888318b Mon Sep 17 00:00:00 2001 From: Anton Nekipelov <226657+anton-107@users.noreply.github.com> Date: Mon, 16 Nov 2026 16:02:39 +0000 Subject: [PATCH 1/2] acc: share the CI env unset in an unset_ci_env helper Three acceptance scripts unset the same list of CI and CI/CD provider variables so the native Claude Code hint line also prints in CI. Move the list into one unset_ci_env helper in the root script.prepare, the only prepare file that covers both cmd/aitools and air, with a pointer to the SDK's useragent/cicd.go so it stays in sync. Co-authored-by: Isaac --- .agents/rules/testing.md | 2 +- acceptance/air/image-push/script | 3 ++- acceptance/cmd/aitools/claude-config-dir/script | 2 +- acceptance/cmd/aitools/telemetry/hint/script | 2 +- acceptance/script.prepare | 9 +++++++++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.agents/rules/testing.md b/.agents/rules/testing.md index 1f6af36d68c..cb1b22538b2 100644 --- a/.agents/rules/testing.md +++ b/.agents/rules/testing.md @@ -143,7 +143,7 @@ Ignore = ["databricks.yml"] # parsed as EnvMatrix.Ignore, not top-level Ignore - `musterr CMD...`: run CMD and fail the whole test if it *succeeds*; on the expected failure the script continues. Use to assert a command must error. - `withdir DIR CMD...`: run CMD with the working directory set to DIR, restoring it afterwards. - `git-repo-init`: initialize a deterministic git repo (fixed user/email, no hooks) and commit `databricks.yml`. -- `uuid`, `sethome DIR`, `venv_activate`, `as-test-sp CMD...`, `readplanarg FILE`, `envsubst`: see `acceptance/script.prepare` for the full list and exact semantics. +- `uuid`, `sethome DIR`, `venv_activate`, `as-test-sp CMD...`, `readplanarg FILE`, `envsubst`, `unset_ci_env`: see `acceptance/script.prepare` for the full list and exact semantics. **RULE: Wrap commands whose invocation should be visible in `output.txt` with `trace`.** The `>>> ...` line ties each block of output to the command that produced it; without it the output is an unlabeled wall of text. diff --git a/acceptance/air/image-push/script b/acceptance/air/image-push/script index 86e0c4ccf69..a0343b728ab 100644 --- a/acceptance/air/image-push/script +++ b/acceptance/air/image-push/script @@ -66,7 +66,8 @@ title "in a Claude Code session the auth docker configure child adds no install # As in a Claude Code tool call, with no session id, so the session throttle # can't be what keeps the child quiet. The CI variables would drop the native # line in CI only. -unset CI GITHUB_ACTIONS GITLAB_CI JENKINS_URL TF_BUILD CIRCLECI TRAVIS BITBUCKET_BUILD_NUMBER PROJECT_ID CODEBUILD_BUILD_ARN TFC_RUN_ID CLAUDE_CODE_SESSION_ID +unset_ci_env +unset CLAUDE_CODE_SESSION_ID # A host CLAUDE_CONFIG_DIR would move the plugin lookup away from the isolated HOME. unset CLAUDE_CONFIG_DIR export CLAUDECODE=1 CLAUDE_CODE_CHILD_SESSION=1 diff --git a/acceptance/cmd/aitools/claude-config-dir/script b/acceptance/cmd/aitools/claude-config-dir/script index ad72ab82556..ce4f3b20dd6 100644 --- a/acceptance/cmd/aitools/claude-config-dir/script +++ b/acceptance/cmd/aitools/claude-config-dir/script @@ -4,7 +4,7 @@ export CLAUDECODE=1 export CLAUDE_CODE_CHILD_SESSION=1 unset CLAUDE_CODE_SESSION_ID # CI and the CI/CD provider markers the SDK detects (GitHub Actions sets both). -unset CI GITHUB_ACTIONS GITLAB_CI JENKINS_URL TF_BUILD CIRCLECI TRAVIS BITBUCKET_BUILD_NUMBER PROJECT_ID CODEBUILD_BUILD_ARN TFC_RUN_ID +unset_ci_env # Hint-exempt commands (aitools, auth, one-shot lookups such as version and current-user me, # completion) skip the install hint; clusters list exercises it against the fake server. diff --git a/acceptance/cmd/aitools/telemetry/hint/script b/acceptance/cmd/aitools/telemetry/hint/script index f1edd5eec54..7e51e7bdb97 100644 --- a/acceptance/cmd/aitools/telemetry/hint/script +++ b/acceptance/cmd/aitools/telemetry/hint/script @@ -4,7 +4,7 @@ export CLAUDECODE=1 # As inside Claude Code: enables the native line (not in CI). export CLAUDE_CODE_CHILD_SESSION=1 # CI and the CI/CD provider markers the SDK detects (GitHub Actions sets both). -unset CI GITHUB_ACTIONS GITLAB_CI JENKINS_URL TF_BUILD CIRCLECI TRAVIS BITBUCKET_BUILD_NUMBER PROJECT_ID CODEBUILD_BUILD_ARN TFC_RUN_ID +unset_ci_env unset CLAUDE_CODE_SESSION_ID # A host CLAUDE_CONFIG_DIR would move the plugin file away from the isolated HOME. unset CLAUDE_CONFIG_DIR diff --git a/acceptance/script.prepare b/acceptance/script.prepare index 506e03ce2be..ffe6f1a18ba 100644 --- a/acceptance/script.prepare +++ b/acceptance/script.prepare @@ -197,3 +197,12 @@ readplanarg() { printf "" fi } + +# unset_ci_env clears CI and the CI/CD provider markers, so a test behaves the +# same in CI as on a laptop. The provider list mirrors listCiCdProviders in the +# Go SDK's useragent/cicd.go (read by useragent.CiCdProvider()); keep it in +# sync when the SDK adds a provider. PROJECT_ID alone defeats the Google Cloud +# Build check, which requires all of its variables. +unset_ci_env() { + unset CI GITHUB_ACTIONS GITLAB_CI JENKINS_URL TF_BUILD CIRCLECI TRAVIS BITBUCKET_BUILD_NUMBER PROJECT_ID CODEBUILD_BUILD_ARN TFC_RUN_ID +} From 13578d5ca982daf6b01ddd08a29226444908d48c Mon Sep 17 00:00:00 2001 From: Anton Nekipelov <226657+anton-107@users.noreply.github.com> Date: Wed, 18 Nov 2026 00:22:03 +0000 Subject: [PATCH 2/2] acc: drop the unset_ci_env comment copies in the aitools scripts The helper in acceptance/script.prepare already documents the list. Co-authored-by: Isaac --- acceptance/cmd/aitools/claude-config-dir/script | 1 - acceptance/cmd/aitools/telemetry/hint/script | 1 - 2 files changed, 2 deletions(-) diff --git a/acceptance/cmd/aitools/claude-config-dir/script b/acceptance/cmd/aitools/claude-config-dir/script index ce4f3b20dd6..b6ffcaa61a3 100644 --- a/acceptance/cmd/aitools/claude-config-dir/script +++ b/acceptance/cmd/aitools/claude-config-dir/script @@ -3,7 +3,6 @@ export CLAUDECODE=1 # enables the native line; CI suppresses it. export CLAUDE_CODE_CHILD_SESSION=1 unset CLAUDE_CODE_SESSION_ID -# CI and the CI/CD provider markers the SDK detects (GitHub Actions sets both). unset_ci_env # Hint-exempt commands (aitools, auth, one-shot lookups such as version and current-user me, diff --git a/acceptance/cmd/aitools/telemetry/hint/script b/acceptance/cmd/aitools/telemetry/hint/script index 7e51e7bdb97..0282ff401a4 100644 --- a/acceptance/cmd/aitools/telemetry/hint/script +++ b/acceptance/cmd/aitools/telemetry/hint/script @@ -3,7 +3,6 @@ sethome home export CLAUDECODE=1 # As inside Claude Code: enables the native line (not in CI). export CLAUDE_CODE_CHILD_SESSION=1 -# CI and the CI/CD provider markers the SDK detects (GitHub Actions sets both). unset_ci_env unset CLAUDE_CODE_SESSION_ID # A host CLAUDE_CONFIG_DIR would move the plugin file away from the isolated HOME.