Skip to content

Exact-read bypass: never compact read-only config-inspection command output (incl. ssh-wrapped)#202

Open
chrislro wants to merge 1 commit into
vincentkoc:mainfrom
chrislro:exact-read-bypass
Open

Exact-read bypass: never compact read-only config-inspection command output (incl. ssh-wrapped)#202
chrislro wants to merge 1 commit into
vincentkoc:mainfrom
chrislro:exact-read-bypass

Conversation

@chrislro

Copy link
Copy Markdown

Motivation

Compacting the output of a read-only configuration-inspection command is strictly worse than spending the tokens: the agent receives a config dump that looks complete but is silently missing keys, and then acts on the wrong data. We hit exactly this in production — agents read compacted plutil -p plist dumps, openclaw config get output, and ssh-wrapped file reads (ssh host 'cat file'), and made decisions based on truncated config. For these commands, exactness is the entire point of running them.

This change has been running as a local hotfix in production across several agent hosts since 2026-05-31 with no regressions.

What's detected

The existing file-content inspection bypass is extended to cover:

  • plutil plist dumpsplutil -p <file> and plutil -convert <fmt> -o - <file> (stdout output only; in-place conversions are not affected). plutil dumps are also exempted from the large-document summary so they always pass through verbatim.
  • Read-only config CLIsopenclaw config get ... (write commands like config set are not matched).
  • ssh-wrapped inspection commandsssh host '<cmd>', where the remote command is extracted (with proper handling of ssh option/value pairs like -p 2222, -i key, -o opt) and recursively checked against the same detectors (cat/sed/head/..., git show <rev>:<path>, gh api .../contents/... | base64 -d, plutil, read-only config CLIs).

Additionally, the verbatim bypass in reduceExecution now applies to every detected inspection command instead of only those that classified to generic/fallback — previously an exact read whose output happened to match a content-based reducer could still be compacted.

Fail-open design

Detection is conservative and fail-open: anything not positively identified as a read-only inspection command keeps today's compaction behavior unchanged. A missed detection means we compact (status quo); there is no path where this change compacts something that was previously passed through.

Verification

  • pnpm lint, pnpm lint:circular, pnpm typecheck — clean
  • pnpm test — 131 files / 2255 tests passing, including new unit tests for the detector (plutil, config-get, ssh-wrapped positive and negative cases) and reduce-level tests asserting verbatim passthrough (ratio === 1)
  • pnpm build — clean

🤖 Generated with Claude Code

Compacting the output of read-only configuration-inspection commands can
silently drop config keys, so agents act on truncated data without knowing
anything was removed - strictly worse than spending the tokens.

This extends the file-content inspection bypass so these outputs pass
through verbatim:

- plutil plist dumps (plutil -p, plutil -convert ... -o -)
- read-only config CLIs (openclaw config get)
- ssh-wrapped inspection commands (ssh host 'cat file'), including
  ssh option/value parsing to locate the remote command

The verbatim bypass in reduceExecution now applies to every detected
inspection command instead of only those that classified to
generic/fallback, and plutil dumps are exempted from the large-document
summary. Detection is fail-open: anything not positively identified as a
read-only inspection command keeps today's compaction behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants