Skip to content

agent(command): preserve backslashes inside single-quoted recovered routes #3231

Closed

Description

@EffortlessSteven

Finding

Source promotion review on rejected historical J EffortlessMetrics/ripr#1543 found a real mismatch between RIPR's advisory shell renderer and its canonical-route recovery parser.

loop_commands::shell_arg correctly documents bash single-quote semantics: \\ is literal inside single quotes. agent::command_specs::shell_words, however, handles \\ before quote-specific logic and therefore consumes a backslash even while parsing a single-quoted token.

The mechanism is present unchanged in W7 (83217e97…) and current swarm main.

Impact ruling after producer/executor audit

This parser is not dead code, but the supported W7 executable route does not expose the reviewed Windows-path shape:

  • The producer-owned agent_verify_command_spec / agent_receipt_command_spec build machine-facing args[] directly from semantic inputs. They do not recover argv from display.
  • EvidenceRecord still uses agent_command_spec_from_display, but only to recover the canonical verify route from the fixed producer constant ripr agent verify --root . --before target/ripr/pilot/repo-exposure.json --after target/ripr/pilot/after.repo-exposure.json --json; those tokens contain no backslashes.
  • Gap-record and agent-packet projection now preserve the producer's existing typed command_specs; they no longer reconstruct typed routes from arbitrary display text.
  • The explicit verification executor uses the recovery parser as a consistency check over packet display strings, then separately validates the before/after artifacts' provenance and recomputes the executable route with agent_verify_command_spec(".", declared_before, declared_after, None). It never executes the display string or invokes a shell.
  • The architecture contract in slice(#1617 PR C): project typed CommandSpec routes into CLI, packets, and standard editor actions #1906 is already stricter: legacy strings are compatibility display and consumers must not treat display parsing as argv authority.

So the parser bug can reject/corrupt a future or direct legacy canonical-display shape containing single-quoted backslashes, but no supported W7 producer/executor route has been found that supplies such a shape. The original release-check weight was too strong.

Required correction

Make the bounded recovery parser agree with the renderer: inside single quotes, backslash is literal; outside single quotes retain the intended escape/rejection behavior. Keep this helper restricted to canonical compatibility recovery—do not turn it into a general shell parser or re-establish display text as machine authority.

Also add a drift test pinning the more important architecture law: producer-owned typed routes preserve their semantic Windows-like argv without going through shell_words.

Acceptance

  • A focused test demonstrates the current/fixed single-quoted-backslash behavior through agent_command_spec_from_display.
  • A single-quoted Windows-like token round-trips byte-for-byte in the bounded recovery helper.
  • agent_verify_command_spec and agent_receipt_command_spec preserve the same semantic token directly in args[] without display parsing.
  • Backslash behavior outside single quotes retains the intended escape semantics.
  • Existing compound-command/metacharacter rejection remains fail closed.
  • Embedded single-quote rendering/recovery remains correct.
  • Verification execution continues to derive authority from validated artifacts + producer-owned CommandSpec, never from shell execution of display text.
  • Focused command-spec/execution tests and the ordinary required gate pass.

0.11.0 disposition

Rolling compatibility-parser correctness, non-blocking for qualified W7. The audited W7 machine route uses direct typed argv and the only production recovery feed is canonical/repo-relative. Do not repin W7 for this parser defect. Re-escalate only if a supported public W7 producer is shown to emit an affected display shape into an authoritative route.

Refs: #1906, EffortlessMetrics/ripr#1543, #2379.

Activity

  1. added
    release-check
    status/needs-work
    and removed
    release-check
    on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/needs-work

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions