Skip to content

fix(core): add fragment-aware secret redaction for streaming diagnostics #19787

Description

@NubsCarson

Problem

Shell output can arrive across multiple stdout/stderr chunks and independent poll calls. The current IAgentRuntime.redactSecrets(text): string boundary can redact a complete string, but it cannot tell a caller which source ranges were sensitive. A plugin therefore cannot safely preserve per-stream offsets while preventing reconstruction of a configured secret split across chunks or streams.

Deterministic synthetic example: configured value marigold9, stdout fragment mariX, stderr fragment gold9. Whole-string equality and per-stream projection both miss that a consumer can select mari + gold9 and reconstruct the secret. Sticky whole-session suppression is safe but destroys later useful output and breaks explicit-offset replay semantics.

This is the surviving architectural blocker from closed PR #18947. Existing PR #19565 owns tool-diagnostic persistence and PR #19730 owns authorization-pattern changes; this issue must not duplicate either lane.

Required outcome

  • Add a runtime-owned incremental/fragment redaction contract that reports non-secret taint/projection metadata without exposing configured secret values.
  • Support ordered fragments carrying source/stream identity and absolute offsets.
  • Detect configured-secret matches spanning any number of adjacent fragments and stdout/stderr boundaries.
  • Map taint back to the contributing source ranges so callers can preserve per-stream offsets and idempotent explicit reads.
  • Bound retained detection context based on runtime-known redaction requirements; do not use an arbitrary fixed lookbehind as a correctness claim.
  • Preserve raw bytes only inside the private execution boundary; public diagnostics, callbacks, histories, session DTOs, and errors receive projected values.
  • Be cycle/depth safe, non-mutating, and compatible with current pattern redaction.

Acceptance evidence

No real credentials, provider calls, production runtime, deployment, or payment mutation are required.

AI provider/model: OpenAI / gpt-5.6-sol
Client / agent tooling: Codex Desktop
Attribution status: self-reported; contribution skill package currently stale, so no signed skill receipt is claimed.
— [gauss]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions