Skip to content

Default capture_env to WB_* instead of capturing nothing - #75

Closed
duncankmckinnon wants to merge 1 commit into
mainfrom
capture-env-default-wb
Closed

Default capture_env to WB_* instead of capturing nothing#75
duncankmckinnon wants to merge 1 commit into
mainfrom
capture-env-default-wb

Conversation

@duncankmckinnon

Copy link
Copy Markdown
Owner

Summary

  • Capture only ran when capture_env patterns resolved to something, which required either THIRDEYE_CAPTURE_ENV exported into the hook process or an explicit capture_env in config.yaml. Neither is guaranteed — workbench dispatches agents from contexts that may not source an rc file, and a fresh install has no capture_env at all. The result was a silent no-op: no tags, no wb.* attributes, and nothing to say why.
  • WB_* is thirdeye's own vocabulary (env_to_tag already strips the prefix when shaping tags), so it is the sensible built-in default rather than something a user has to discover and configure.
  • A present capture_env key stays authoritative even when empty — that is the opt-out — and only an absent key takes the default. write_capture_env_patterns therefore persists [] rather than removing the key, since removing it would fall back to the default and leave capture-env clear unable to clear. capture-env show now reports built-in default as the source when no key is set.

Note: this is hardening, not the fix for the cursor-only symptom that prompted it — that root cause was workbench's inject_env defaulting (duncankmckinnon/workbench#69). This closes the adjacent failure mode where capture silently does nothing on a machine that never configured a pattern.

Test plan

  • pytest tests/ — 2732 passed
  • New/updated tests: absent key → ("WB_*",); capture_env: [](); THIRDEYE_CAPTURE_ENV still overrides; clear persists [] and keeps capture off; claude and codex session_start tag WB_* with no pattern configured, and write no tags under an explicit empty capture_env
  • End-to-end: thirdeye-codex-session-start with THIRDEYE_CAPTURE_ENV unset and no capture_env in config now persists the captured env and writes plan-/task-/agent-/step- tags

🤖 Generated with Claude Code

Capture only ran when capture_env patterns resolved to something, and that
required either THIRDEYE_CAPTURE_ENV exported into the hook process or an
explicit capture_env in config.yaml. Neither is guaranteed: workbench
dispatches agents from contexts that may not source an rc file, and a fresh
install has no capture_env at all. The result was a silent no-op - no tags, no
wb.* span attributes, and nothing to say why.

WB_* is thirdeye's own vocabulary (env_to_tag already strips the prefix when
shaping tags), so it is the sensible built-in default rather than something a
user has to discover and configure.

A *present* capture_env key stays authoritative even when empty - that is the
opt-out - and only an absent key takes the default. write_capture_env_patterns
therefore persists an empty list rather than removing the key, since removing
it would fall back to the default and leave `capture-env clear` unable to
clear. `capture-env show` reports "built-in default" as the source when no key
is set.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@duncankmckinnon
duncankmckinnon deleted the capture-env-default-wb branch September 12, 2026 00:22
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.

1 participant