Repository navigation
Description
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
- The agent shell allows a read pipe through a table of allowed right-hand programs, such as
head,grepandwc. Do not remove|fromCONST_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 leadingcd <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"). - 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
dan-petty commentedon Nov 4, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.devops-cli-service commentedon Nov 5, 2026
Status set to Ready at be8d18a (see proposed design in issue body).
[-]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[/+]dan-petty commentedon Nov 6, 2026
The job shortened the title of this item. The summary had 73 characters, and the limit is 60. The type and the scope stay.
feat(roadmap): the agent shell allows a read pipe through a table of right-hand programsfeat(roadmap): Allow read pipes to a table of allowed programsdan-petty commentedon Nov 6, 2026
Answer from project standards, under the owner's instruction of 2026-11-05.
Question: do
python -canduv run python -calso need a change in this issue?Answer: no. The Job log of #2116 shows
uv run python -c <masked>with the outcomeok:uvis a program ofSHELL_PROGRAMS, so the call runs. A barepython -cis refused with a hint to useuv 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.chore(main): release 0.73.0 (#3842)
devops-cli-service commentedon Nov 6, 2026
Released in v0.73.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.73.0
devops-cli-service commentedon Nov 6, 2026
Live since 2026-11-06 22:09 UTC