Skip to content

Polish --sandbox auto-kit output and tool auto-install logging#2878

Open
dgageot wants to merge 7 commits into
docker:mainfrom
dgageot:sandbox-kit-polish
Open

Polish --sandbox auto-kit output and tool auto-install logging#2878
dgageot wants to merge 7 commits into
docker:mainfrom
dgageot:sandbox-kit-polish

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented May 22, 2026

The --sandbox auto-kit output now reads better and carries more context when tools auto-install at runtime. These changes improve both the user-visible summary and the underlying tool-staging logic.

Auto-kit summary readability. Subtle ANSI styling is now applied to the kit summary printed by --sandbox (kit path in cyan, section headers and names in bold, faint notes for (from …) / workspace mount, yellow for (redacted) markers and the secret count). The styling gracefully degrades when stdout isn't a TTY — tests and piped output stay plain thanks to fatih/color's auto-detection.

Path display. Every host path in the kit summary now goes through pathx.ShortenHome, including the kit directory itself, so $HOME is consistently collapsed to ~ for readability.

Skill staging respects the agent config. The stageSkills logic now consults each agent's SkillsConfig instead of unconditionally shipping every local skill found. It ships nothing if no agent enables local skills, every local skill if any agent enables them without an include filter (the wide case wins), and otherwise only the union of agents' include filters. Five new tests cover these scenarios.

Auto-install logging mentions the package. When an MCP/LSP server auto-installs at runtime, both the debug log and a new user-visible stderr line now name the package as command (owner/repo@version) before the download starts, providing context for the go install chatter that follows. The stderr banner respects isatty on stderr directly and honours NO_COLOR / TERM=dumb.

All changes maintain backward compatibility. Linting and all 132 package tests pass.

@dgageot dgageot requested a review from a team as a code owner May 22, 2026 15:25
docker-agent

This comment was marked as outdated.

@aheritier aheritier added area/tools For features/issues/fixes related to the usage of built-in and MCP tools area/cli CLI commands, flags, output formatting kind/fix PR fixes a bug (maps to fix: commit prefix) labels May 22, 2026
aheritier

This comment was marked as outdated.

@aheritier aheritier added the area/security Authentication, authorization, secrets, vulnerabilities label May 23, 2026
dgageot added 7 commits May 24, 2026 10:31
Add subtle ANSI styling to the auto-kit summary printed by --sandbox.
fatih/color auto-disables when stdout isn't a TTY, so tests and piped
output stay plain.

- kit path: cyan
- section headers (skills:, prompt files:, summary:): bold
- skill / prompt-file names: bold
- (from ...) and 'workspace mount' notes: faint
- (redacted) markers and the secret count: yellow
- counts in the summary line: bold
The kit dir lives under $HOME/.cache, so the printed header used to
show the full host home path. Route it through pathx.ShortenHome like
every other host path the summary prints.
stageSkills now consults every agent's SkillsConfig before copying any
local skill into the kit:

- no agent enables local skills -> ship nothing
- at least one agent enables local skills without an include filter ->
  ship every local skill (wide case wins)
- every local-enabled agent restricts skills via include -> ship only
  the union of those filters

This matches what the in-sandbox runtime actually loads, so the kit no
longer leaks unrelated host skills into agents that don't use them.
When the agent auto-downloads a missing MCP/LSP server, the only
user-visible output used to be the raw 'go install' chatter, which
gives no clue what's being fetched or why. Print a one-line stderr
message naming the command and the resolved package@version right
before the install kicks off.

The line is styled subtly (bold command, faint package ref) and
fatih/color auto-disables when stderr isn't a TTY, so logs and CI
output stay plain.
fatih/color's global NoColor is computed from os.Stdout, so the
previous announceInstall comment ('auto-disables when stderr isn't a
TTY') was wrong in two ways: piping stderr to a log while keeping
stdout on the TTY would write escape codes into the log, and the more
common case — piping stdout while keeping stderr on the TTY — would
take the styled branch but emit plain text because SprintFunc consults
the (stdout-derived) NoColor flag.

Decide explicitly on stderr (honouring NO_COLOR and TERM=dumb), and
EnableColor() the local *color.Color values so styling actually
survives when the global flag has stripped it. Fall back to a plain
line when colour isn't safe.
Skills used to be discovered from $HOME alone, so a config-load
failure was harmless for them. Now stageSkills consults the agent
config and returns nothing when cfg is empty, so an unavailable
config drops both skills and prompt files. Update the comment and
the slog message to reflect the current behaviour.
The first log line in doInstall fired before the registry lookup, so
debug logs showed 'Auto-installing missing command via aqua registry
command=foo' with no clue which package would be downloaded. Drop
that early line and emit a single, fully-attributed entry after
resolution so the log names both the command and the resolved
owner/repo@version before installing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli CLI commands, flags, output formatting area/security Authentication, authorization, secrets, vulnerabilities area/tools For features/issues/fixes related to the usage of built-in and MCP tools kind/fix PR fixes a bug (maps to fix: commit prefix)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants