Default capture_env to WB_* instead of capturing nothing - #75
Closed
duncankmckinnon wants to merge 1 commit into
Closed
Default capture_env to WB_* instead of capturing nothing#75duncankmckinnon wants to merge 1 commit into
duncankmckinnon wants to merge 1 commit into
Conversation
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>
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
capture_envpatterns resolved to something, which required eitherTHIRDEYE_CAPTURE_ENVexported into the hook process or an explicitcapture_envinconfig.yaml. Neither is guaranteed — workbench dispatches agents from contexts that may not source an rc file, and a fresh install has nocapture_envat all. The result was a silent no-op: no tags, nowb.*attributes, and nothing to say why.WB_*is thirdeye's own vocabulary (env_to_tagalready strips the prefix when shaping tags), so it is the sensible built-in default rather than something a user has to discover and configure.capture_envkey stays authoritative even when empty — that is the opt-out — and only an absent key takes the default.write_capture_env_patternstherefore persists[]rather than removing the key, since removing it would fall back to the default and leavecapture-env clearunable to clear.capture-env shownow reportsbuilt-in defaultas 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_envdefaulting (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("WB_*",);capture_env: []→();THIRDEYE_CAPTURE_ENVstill overrides;clearpersists[]and keeps capture off; claude and codexsession_starttagWB_*with no pattern configured, and write no tags under an explicit emptycapture_envthirdeye-codex-session-startwithTHIRDEYE_CAPTURE_ENVunset and nocapture_envin config now persists the captured env and writesplan-/task-/agent-/step-tags🤖 Generated with Claude Code