feat(cli): set AI_AGENT for subprocesses - #2585
Open
complynx wants to merge 2 commits into
Open
Conversation
complynx
marked this pull request as ready for review
August 4, 2026 12:21
This was referenced Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AI_AGENT=kimito subprocesses launched from both the pip/uv and standalone binary entrypointsWhy a universal marker
Tools launched by coding agents often need to adapt telemetry, UX, logging, or safety behavior based on whether they are running under an agent. Today they generally have to maintain agent-specific process-tree and environment heuristics. A shared
AI_AGENT=<slug>convention lets the producer that already knows its identity declare it once, avoiding an N-by-M matrix of consumer heuristics as agents and tools multiply.This is deliberately an advisory marker, not a security boundary. Kimi only supplies its own slug when the variable is missing or blank, so wrappers and higher-level orchestrators retain control of any explicit non-blank value.
Validation
uv run ruff format --check src/kimi_cli/__main__.py src/kimi_cli/cli/__main__.py src/kimi_cli/utils/subprocess_env.py tests/core/test_startup_imports.pyuv run ruff check src/kimi_cli/__main__.py src/kimi_cli/cli/__main__.py src/kimi_cli/utils/subprocess_env.py tests/core/test_startup_imports.pyuv run pytest tests/core/test_startup_imports.py tests/utils/test_subprocess_env.py -q(14 passed)