Files
z1gonandhemingzhe 92dcf00f83 fix(plugins): share capture filtering across adapters (#5359)
* fix(pi): honor conversation capture filters in faithful mode

Apply the shared turn filter before capture decisions so configured rules cannot be bypassed by takeover or attached tool parts, while preserving tool values and behavior without applicable rules.

(cherry picked from commit e8fb6c9476)
Signed-off-by: Hao Zhe <haozhe4547@gmail.com>

* fix(opencode): wire captureFilters through config and the capture path

captureFilters (sed-style redaction rules, e.g. s/sk-.../[REDACTED-SK]/g)
was defined in the shared capture-utils library but never reached the
OpenCode capture path: lib/config.mjs had no mapping for the key and
memory-session's buildCapturePayload applied no filtering, so secrets
typed into OpenCode sessions were captured verbatim. The Codex plugin
applies the identical library correctly (issue #4984).

- map captureFilters in config (file key, OPENVIKING_CAPTURE_FILTERS env
  override as JSON, non-string entries dropped)
- apply filterCaptureParts() to extracted parts in buildCapturePayload,
  mirroring the Codex reference flow (role-level drops skip the turn;
  an empty filtered result gates capture)
- cover config mapping, env override and validation in tests

(cherry picked from commit b5bd21930d)
Signed-off-by: Hao Zhe <haozhe4547@gmail.com>

* refactor(capture): share sanitized filter path across adapters

* test(capture): preserve mixed tool messages and cover OpenCode v2

* fix(capture): cap mixed text and preserve dated logs

* fix(capture): use shared shaping in Claude Code hooks

* fix(capture): sanitize fallback text once

---------

Signed-off-by: Hao Zhe <haozhe4547@gmail.com>
Co-authored-by: hemingzhe <hehesmilett@163.com>
2026-09-24 22:46:20 +08:00
..