Skip to content

warn when a deploy sets a reserved env var (KERNEL-1620) - #230

Merged
akxue merged 1 commit into
mainfrom
anthony/kernel-1620-warn-reserved-env-var
Aug 17, 2026
Merged

warn when a deploy sets a reserved env var (KERNEL-1620)#230
akxue merged 1 commit into
mainfrom
anthony/kernel-1620-warn-reserved-env-var

Conversation

@akxue

@akxue akxue commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

surfaces the silent KERNEL_API_KEY override to the user at deploy time.

right now if you set KERNEL_API_KEY via --env/--env-file, the platform overrides it with the per-deployment key and your value is silently dropped — no signal, and it's the reason behind KERNEL-1620 / a pylon thread. this prints a pterm.Warning (same convention as the existing "Requested --per-page N; capped to 100" warnings) when a reserved var is supplied, on both deploy paths (file/CLI + github source):

KERNEL_API_KEY is reserved by Kernel and will be ignored (Kernel sets it automatically). Use a different variable name if you need your own value.
  • warn-only, no behavior change — the override itself is unchanged.
  • covers KERNEL_API_KEY and ENTRYPOINT_RELPATH; guarded behind output != "json" so json output stays clean.
  • server-side gets a log.WarnContext breadcrumb for the SDK/API deploy paths (separate kernel/kernel PR), and the deployment key lifecycle + reserved vars are now documented (kernel/docs #504).

did not go with respecting a user-supplied key — they can already pass their own under a non-reserved name and read it explicitly, so honoring KERNEL_API_KEY would just add ambiguity.

🤖 Generated with Claude Code


Note

Low Risk
CLI-only UX change with no deploy API or override logic modified; low risk aside from extra stderr warnings in interactive mode.

Overview
Adds deploy-time warnings when --env / --env-file includes platform-reserved variables (KERNEL_API_KEY, ENTRYPOINT_RELPATH), which the backend overwrites and previously dropped without feedback.

Introduces warnReservedEnvVars in cmd/deploy.go (aligned with the API deploy activity’s reserved set) and invokes it after env merging on both local/file deploy and GitHub source deploy, using the same pterm.Warning style as other CLI caps. Warnings are skipped when -o json so machine output stays clean. Deploy behavior is unchanged—warn-only.

Reviewed by Cursor Bugbot for commit eff437b. Bugbot is set up for automated code reviews on this repo. Configure here.

KERNEL_API_KEY and ENTRYPOINT_RELPATH are set by the platform on every
deployment and a user-supplied value is silently overridden. Print a warning at
deploy time (both the file/CLI and GitHub-source paths) so a dropped value does
not surprise the user later.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@akxue
akxue marked this pull request as ready for review August 17, 2026 17:52
@akxue
akxue requested a review from ehfeng August 17, 2026 19:16
@akxue
akxue merged commit 2d03765 into main Aug 17, 2026
7 checks passed
@akxue
akxue deleted the anthony/kernel-1620-warn-reserved-env-var branch August 17, 2026 21:39
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.

2 participants