Skip to content

feat(roadmap): Allow read pipes to a table of allowed programs #3520

Description

@dan-petty

Problem or Motivation

The implement agent refuses every command that holds a pipe. The log of the refused commands shows many read pipes, such as ... | head, ... | grep and ... | wc. Issue #3271 made a refusal return a normal tool result, so a refusal costs no tool retry now. A refused read pipe still costs one model request and one tool call. The first word of 91 of the 201 refused commands in the window 2026-11-03T15:05Z to 2026-11-04T15:05Z is logged as other, so a person cannot see which program the model asked for.

Proposed Solution & Architectural Design

  1. The agent shell allows a read pipe through a table of allowed right-hand programs, such as head, grep and wc. Do not remove | from CONST_ROADMAP_IMPLEMENT_DENIED_OPERATORS (src/devops_cli/config/constants.py). That would also allow | sh, because the harness reads the first word only. The check must read each word after a | against the table. A leading cd <checkout> && is harmless. Verification lines stay a list of words with no shell (openspec/specs/roadmap-implement-step/spec.md, requirement "Verification commands run as a list of words").
  2. Extend the known-program table of logged_program (src/devops_cli/roadmap/implement_tool_log.py), or log a digest as the trace does. Never write a free first word: the module says that a first word can hold a secret. A change to that rule goes to the owner.

Target Subsystem

src/devops_cli/roadmap/implement_shell_policy.py, src/devops_cli/roadmap/implement_step.py, src/devops_cli/roadmap/implement_tool_log.py, src/devops_cli/config/constants.py

Existing Tool Considered

The harness pydantic-ai-harness shell reads the first word of a command and checks the denied operators as plain text. It has no setting for a table of right-hand programs. A parser such as bashlex or shlex can split the words of a pipe. The change must name the library and its maintenance state before it builds a parser.

Split from #3271. #3053 also names shell refusals. It is broader and stays open.

Proposed design

Problem statement

The implement agent refuses every command that holds a pipe. A refused read pipe costs one model request and one tool call, even after #3271 made a refusal a normal tool result. The change admits read pipes through a table of allowed right-hand programs and improves the refusal log without writing a free first word.

Acceptance criteria

Requirement: Allowed read pipe

The implement shell policy SHALL admit a command whose pipe stages name only programs in the read-pipe table.

Scenario: Pipes to head and wc

  • WHEN The command git status holds a pipe to head and a pipe to wc.
  • THEN The policy returns allowed and gives no pipe refusal.

Requirement: Refused pipe program

The implement shell policy SHALL refuse a pipe whose right-hand program is not in the read-pipe table.

Scenario: Pipe to sh

  • WHEN A command holds a pipe to sh.
  • THEN The policy returns refused and names sh as the refused pipe program.

Requirement: Other denied operator

The implement shell policy SHALL refuse a command that holds a denied operator other than a pipe, also when a pipe stage is allowed.

Scenario: Semicolon after an allowed pipe

  • WHEN A command holds a pipe to head and then a semicolon.
  • THEN The policy returns refused for the semicolon.

Requirement: Leading checkout prefix

The implement shell policy SHALL admit the exact prefix cd && before an allowed command.

Scenario: Checkout prefix with a pipe

  • WHEN The command starts with cd && for the step checkout and then git status holds a pipe to head.
  • THEN The policy returns allowed.

Requirement: Single table constant

The read-pipe table MUST be one constant in src/devops_cli/config/constants.py.

Scenario: Table contents

  • WHEN A test reads the constant.
  • THEN It holds head, grep and wc, and it holds no program that writes a file.

Requirement: Known program log

The logged_program function SHALL record a first word from the known-program table by its name.

Scenario: Known first word

  • WHEN The first word is head.
  • THEN The log holds head and does not hold other.

Requirement: Unknown program log

The logged_program function MUST record an unknown first word as other with a 12-character SHA-256 digest, and MUST NOT write the free word.

Scenario: Unknown first word

  • WHEN The first word is secret-tool and it is not in the known-program table.
  • THEN The log holds other and a 12-character hexadecimal digest, and it does not hold secret-tool.

Requirement: Step shell policy

The implement step SHALL call the read-pipe policy before it runs a shell command.

Scenario: Step shell call

  • WHEN A step calls its shell tool with git status followed by a pipe to head.
  • THEN The step calls the read-pipe policy and admits the command.

Existing Tool Considered

No alternatives check has run. Python's standard-library shlex module is open and maintained with CPython. It splits a command into words and pipe tokens, including quoted words and a pipe with no spaces. It lacks the read-only program table, the policy decision and the logging table. This change adds those parts and no new dependency.

Key questions

  • Which parser splits a command into pipe stages?: Use shlex.shlex from the Python standard library with posix=True, punctuation_chars='|' and commenters=''. It splits quoted words and a pipe with no spaces into tokens. (best practice) [sources: src/devops_cli/roadmap/implement_shell_policy.py]
    • Chosen: Python shlex. It is in the standard library, maintained with CPython, and it handles quotes and a pipe with no spaces.
    • Rejected: bashlex. It adds a third-party parser, and its maintenance state is not recorded for this change.
    • Rejected: Manual split on the pipe character. It breaks quoted arguments and a pipe with no spaces.
  • Which right-hand programs does the first read-pipe table allow?: The table holds head, grep and wc. Each one reads its input and writes only its result. (best practice) [sources: src/devops_cli/config/constants.py]
    • Chosen: head, grep and wc. They cover the logged read pipes and have no option that writes a file.
    • Rejected: sort, uniq, sed and awk. sort -o and uniq with an output file write, sed -i writes, and awk can run commands.
    • Rejected: Every right-hand program. A pipe to sh would run a second shell.
  • Does the pipe character stay in CONST_ROADMAP_IMPLEMENT_DENIED_OPERATORS?: Yes. The tuple keeps the pipe character. The policy skips it only when every program after a pipe is in the read-pipe table. [sources: src/devops_cli/config/constants.py, src/devops_cli/roadmap/implement_shell_policy.py]
  • Which programs join the known-program table of logged_program?: Add head, grep and wc to the known-program table. The log then names them when a command that holds one as its first word is refused. (best practice) [sources: src/devops_cli/roadmap/implement_tool_log.py, src/devops_cli/config/constants.py]
    • Chosen: Add head, grep and wc. The policy now knows these programs, so the log can name them.
    • Rejected: Add no program. A refused command with one of these first words still shows as other.
    • Rejected: Add every program on PATH. The table would grow with the host and would need constant maintenance.
  • How does the log record an unknown first word?: Record other and a 12-character SHA-256 digest of the first word. Do not record the free word. (best practice) [sources: src/devops_cli/roadmap/implement_tool_log.py, src/devops_cli/config/constants.py]
    • Chosen: Known table plus a digest for unknown. It names known programs and lets a person group unknown ones without exposing the word.
    • Rejected: Extend the known table only. An unknown program still shows as other, so the 91 unknown first words stay indistinguishable.
    • Rejected: Record the free first word. The module states that a first word can hold a secret.
  • Does a leading cd && stay allowed?: Yes. Allow only the exact prefix cd && before the first command. Refuse every other &&. (best practice) [sources: src/devops_cli/roadmap/implement_shell_policy.py, src/devops_cli/config/constants.py]
    • Chosen: Allow only the exact leading prefix. The prefix changes directory only, and it lets a read pipe run after the checkout change.
    • Rejected: Refuse every &&. A command with the common checkout prefix still fails before its allowed pipe.
    • Rejected: Allow every &&. It would admit a second command outside the read-pipe table.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 4, 2026
  2. dan-petty commented on Nov 4, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

  3. added
    priority/p2-medium
    on Nov 4, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 5, 2026
  5. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at be8d18a (see proposed design in issue body).

  6. changed the title [-]feat(roadmap): the agent shell allows a read pipe through a table of right-hand programs[/-] [+]feat(roadmap): Allow read pipes to a table of allowed programs[/+] on Nov 6, 2026
  7. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 73 characters, and the limit is 60. The type and the scope stay.

    • Before: feat(roadmap): the agent shell allows a read pipe through a table of right-hand programs
    • After: feat(roadmap): Allow read pipes to a table of allowed programs
    • Source of the summary: the background model
  8. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 6, 2026
  9. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    Answer from project standards, under the owner's instruction of 2026-11-05.

    Question: do python -c and uv run python -c also need a change in this issue?

    Answer: no. The Job log of #2116 shows uv run python -c <masked> with the outcome ok: uv is a program of SHELL_PROGRAMS, so the call runs. A bare python -c is refused with a hint to use uv run python (SHELL_REFUSALS, src/devops_cli/roadmap/implement_shell_policy.py). Both cases are already handled, so this issue widens nothing and no separate issue is needed.

    Question: how does the log record an unknown first word?

    Answer: the pull request records other: and a 12-character digest. The digest is an HMAC-SHA256 with a random key of the process, not a plain SHA-256. The log goes to GitHub comments, and a plain 12-character hash of a weak password is found by a dictionary (src/devops_cli/roadmap/implement_tool_log.py, module text: "no other word is written"). A keyed digest still groups the unknown programs of one run. A person must decide if the digest has to be the same in every run: that needs a plain hash.

  10. added
    status/in-review
    and removed
    status/in-progress
    on Nov 6, 2026
  11. removed
    status/in-review
    owner/agent
    on Nov 6, 2026
  12. added a commit that references this issue on Nov 6, 2026
  13. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-06 22:09 UTC

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

    effort/mediumpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions