Repository navigation
Description
Context & Rationale
When --logfire or telemetry.logfire: true is set (commands/review.py:146-160), LogfireBridge.configure calls logfire.instrument_pydantic() and instrument_pydantic_ai() with no arguments and passes no scrubbing (telemetry/logfire.py:206-217); once a token resolves, spans go to Logfire (logfire.py:191-198). Review personas run through devops-cli's own PydanticAgent and LLMClient, not pydantic_ai.Agent, so today's leak is instrument_pydantic at its default record='all': validation spans carry the prompt and reply held in CachedLLMResponse and AgentResponse. Separately, every native ai.llm.dispatch span carries gen_ai.prompt_preview (ai/client/unified.py:372), every successful one gen_ai.response_preview (:92), exported unmasked (telemetry/tracer.py:871-888) with native export on by default (config/settings.py:263). redact_text (security/sanitizer.py:177) has no private-host pattern. vibes documents collector-side scrubbing its shipped collector config never implements.
Scope & Deliverables
- Context & Rationale*: When
--logfireortelemetry.logfire: trueis set (commands/review.py:146-160),LogfireBridge.configurecallslogfire.instrument_pydantic()andinstrument_pydantic_ai()with no arguments and passes noscrubbing(telemetry/logfire.py:206-217); once a token resolves, spans go to Logfire (logfire.py:191-198). Review personas run through devops-cli's ownPydanticAgentandLLMClient, notpydantic_ai.Agent, so today's leak isinstrument_pydanticat its defaultrecord='all': validation spans carry the prompt and reply held inCachedLLMResponseandAgentResponse. Separately, every nativeai.llm.dispatchspan carriesgen_ai.prompt_preview(ai/client/unified.py:372), every successful onegen_ai.response_preview(:92), exported unmasked (telemetry/tracer.py:871-888) with native export on by default (config/settings.py:263).redact_text(security/sanitizer.py:177) has no private-host pattern. vibes documents collector-side scrubbing its shipped collector config never implements. - Deliverable*: One PR. Add
telemetry.capture_llm_content: bool = False; while off, callinstrument_pydantic(record="failure")andinstrument_pydantic_ai(include_content=False)(the latter guards the exportedpydantic_aihelpers, which have no runtime caller yet), passscrubbing=logfire.ScrubbingOptions(extra_patterns=PRIVATE_HOST_PATTERNS)with that constant beside_SECRET_PATTERNS, and emit the twogen_ai.*_previewattributes only when capture is on. Leaveagent.prompt/agent.response: onlydevops telemetry testsets them, with fixed strings. Test: configure the bridge with a capturing processor, drivePydanticAgent+LLMClienton a stubbed driver withnode1.example.internalin the prompt, and assert the hostname is in no Logfire-captured attribute and nothing fromget_recent_spans(); a capture-on case asserts the previews return. Cross-check pattern hits withis_loopback_or_private_host(core/validation.py:81), not a new IP check. Attribute names are unchanged. - Constraint*: Logfire 5.1.0 exempts
gen_ai.input.messages,gen_ai.output.messagesandpydantic_ai.all_messagesfrom scrubbing (_internal/scrubbing.py:161-168); oncepydantic_ai.Agentgains a caller,ScrubbingOptionslooks configured while message bodies pass intact, soinclude_content=Falseis the only switch. A broad hostname regex also matches dotted code identifiers and Logfire replaces the whole value on a match, so count hits over recorded spans before choosing patterns. A collectorredactionprocessor is out of scope: traces export only to in-cluster Jaeger and logs only todebug(k8s/otel/values.yaml:91, :104), and it would never see Logfire's export. - Measured*: Scratch probe mirroring logfire.py:206-217 around
PydanticAgent+LLMClienton a stubbed driver:python realpath_probe3.py lategives 3pydantic.validate_pythonspans carrying the marker ininput_data/result;P_SCRUB=1 python realpath_probe3.py late(extra pattern) leaves 0 marker attributes;P_FAIL=1 python realpath_probe3.py late(record="failure") emits 0 spans.python scrub_probe.py default(standalonepydantic_ai.Agent, extra pattern set): marker still in 2 exempt attributes. - Source*: vibes
resources/docker-compose/README.md,resources/observability/README.md,resources/README.md,resources/observability/otel-collector-config.yaml
Update 2026-10-08: refinement
Today's leak is gone (#858; telemetry/logfire.py:214-215 calls only instrument_pydantic_ai()); drop instrument_pydantic(record="failure"). With the owner's #1001 decision, direct requests record message bodies, so include_content=False while capture is off is the main fix. Gate llm.prompt_preview and llm.response_preview (ai/client/unified.py:375, :148). After #1001 lands, the test drives TestModel offline. Whichever of this item and #1001 lands second wires include_content.
Proposed design
Problem statement
The issue addresses a security vulnerability where model prompts and replies are being exposed in telemetry data by default when Logfire is enabled. This occurs through Pydantic validation spans and native AI LLM dispatch spans that carry unmasked prompt and response preview data.
Acceptance criteria
- Criterion 1: When
--logfireortelemetry.logfire: trueis set, Pydantic spans should not include prompt and reply content by default
Verification: Configure LogfireBridge with telemetry enabled, run PydanticAgent + LLMClient on a stubbed driver with private hostnames in prompt, assert no hostname appears in Logfire-captured attributes - Criterion 2: Native AI spans should not include
gen_ai.prompt_previewandgen_ai.response_previewwhen capture is off
Verification: Run test that asserts these preview attributes are only emitted when capture is explicitly enabled - Criterion 3: The telemetry configuration should support a new
telemetry.capture_llm_content: bool = Falsesetting
Verification: Verify that the new setting properly gates content capture behavior in both Pydantic and native AI spans
Key questions
- What is the proposed solution for handling private host patterns in scrubbing?: The solution involves adding
PRIVATE_HOST_PATTERNSbeside_SECRET_PATTERNSand usingScrubbingOptions(extra_patterns=PRIVATE_HOST_PATTERNS)when capturing telemetry (proposed) - What is the expected behavior when capture_llm_content is enabled?: When
telemetry.capture_llm_content: true, Pydantic spans should record all content and native AI spans should includegen_ai.prompt_previewandgen_ai.response_previewattributes (proposed) [sources: docs/agent/tasks/task-606-model-prompt-and-reply-text-kept-out-of-telemetry-by-default.md]
Open questions
- What are the specific telemetry leak points mentioned in the issue? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 1, 2026
Moved from the shipped v0.2.23 to the backlog. It is still valid (checked 2026-10-01), and P2 items don't displace P1 work in the planned releases.
dan-petty commentedon Oct 2, 2026
More evidence for this issue from the devsecops review session
20261001-224227(2026-10-02). Each finding below was triaged againstrelease/v0.2.25(c279c18), judged real and covered by this issue, and then upheld by a second agent that tried to refute it.src/devops_cli/ai/client/unified.py:373, re-rated LOW): The prompt-preview part is real._dispatch_messagessets"llm.prompt_preview": prompt_preview, the first 200 characters of the last user message (unified.py:373-393)._set_response_span_attributessetsllm.response_preview(unified.py:127). Both are exported unmasked. Open issue feat(ai): model prompt and reply text kept out of telemetry by default #606 ('model prompt and reply text kept out of telemetry by default') names exactly these two preview attributes and gates them behindtelemetry.capture_llm_content=False. Thebackend_infopart is not sensitive. It is the stringprovider (host), and the span sets onlyserver.addressfrom …dan-petty commentedon Oct 3, 2026
Ordering and a correction from the library-first batch (2026-10-03):
_set_response_span_attributes(ai/client/unified.py:131-150). Whichever lands second keeps one span-attribute function, and the server is written only as fix(ai): replies carry their server as an httpx2 origin, so a password in an AI URL stays out of output, the spend ledger, metrics, spans and cache #1110's origin field.backend_infois sensitive. It carries the server URL, and with it any userinfo (http://user:password@host) in an AI URL setting. fix(ai): replies carry their server as an httpx2 origin, so a password in an AI URL stays out of output, the spend ledger, metrics, spans and cache #1110 replaces it with anhttpx2.URL(base).originfield.Scope and placement are unchanged.
feat(ai): model prompt and reply text kept out of telemetry by default