Skip to content

feat(roadmap): enforce scoped writes and refusal budgets for catalog tools #3565

Not planned

Description

@devops-cli-service

Split from #3041.

The shell guard cannot stop a write outside the checkout. src/devops_cli/roadmap/implement_run.py states that the shell check reads the first word only and is no security boundary. uv run python can write anywhere the user can. The refusal limit also counts a refused argument of a catalog program such as find -exec. A loop of such calls can run without bound. This part needs the real sandbox of #2695 and a budget decision. It is deferred from #3041. Acceptance criteria: a test SHALL verify that a scoped-write tool cannot write outside the checkout; a test SHALL verify that the file outside the checkout is unchanged after the refused write; the refusal limit SHALL count only calls that the catalog has no entry for; a test SHALL verify that a loop of refused arguments stops at the budget.

Dependencies

Proposed design

Problem statement

The refusal limit counts a refused argument of a catalog program such as find -exec. One call can use the budget more than once. A loop of refused calls can run without bound. The change counts one unit for each refused call, whatever the number of its refused arguments, and no unit for an accepted call. A refused argument refuses the whole call. The scoped-write part waits on the runner sandbox of #2695 and is deferred.

Acceptance criteria

Requirement: One refused call uses one unit

The shell policy SHALL count one refused call against the refusal limit, whatever the number of its refused arguments.

Scenario: A refused call with two refused arguments

  • WHEN A step runs a call that the shell policy refuses and the call holds two refused arguments.
  • THEN A unit test of the shell policy asserts that the refusal count of the step increases by one.

Requirement: An accepted call uses no unit

The shell policy SHALL NOT count a call whose program and arguments the catalog admits against the refusal limit.

Scenario: An accepted call leaves the count

  • WHEN A step runs a call whose program and arguments the catalog admits.
  • THEN A unit test of the shell policy asserts that the refusal count of the step stays the same.

Requirement: A refused argument refuses the whole call

The shell policy MUST refuse the whole call when the catalog has no entry for one of its arguments, and MUST NOT run it.

Scenario: find -exec is refused

  • WHEN A step runs find with -exec.
  • THEN A unit test of the shell policy asserts that the policy returns a refusal that names -exec, runs no program, and adds one to the refusal count.

Requirement: A refused loop stops at the consecutive limit

The job MUST stop the step when the shell refuses roadmap.implement.max_consecutive_refusals calls in a row with no admitted call between them.

Scenario: A loop of refused find -exec calls stops

  • WHEN A step makes refused find -exec calls in a row up to roadmap.implement.max_consecutive_refusals, with no admitted call between them.
  • THEN A unit test of the job asserts that the step stops with the class refused_tool and the refusal stop message.

Requirement: A step stops at the total limit

The job MUST stop the step when the refused calls of the step are more than roadmap.implement.max_refusals.

Scenario: A step with interleaved refused calls stops

  • WHEN A step makes more than roadmap.implement.max_refusals refused calls, with an admitted call between them.
  • THEN A unit test of the job asserts that the step stops with the class refused_tool and the refusal stop message.

Existing Tool Considered

No alternatives check has run for this item. No open, maintained tool or library covers a refusal budget for a shell that a model drives, because the budget belongs to this project's shell policy. The change builds its own code in the shell policy. Written cost: about 2,000 tokens to build, about 400 tokens a month to keep, about 800 tokens to fix, and less than one day elapsed. The scoped-write part waits on the runner sandbox of #2695 and is deferred.

Key questions

  • What does the shell check read, and is it a security boundary?: The shell check reads the first word of a command only. It is no security boundary. The runner pod is the sandbox. [sources: CONTEXT.md, src/devops_cli/roadmap/implement/implement_run.py]
  • What do the refusal limits count today?: docs/ROADMAP_WORKFLOW.md states that a step stops when the shell refuses roadmap.implement.max_consecutive_refusals commands in a row (default 3), or more than roadmap.implement.max_refusals commands in the step (default 30). Both stops use the class refused_tool. [sources: docs/ROADMAP_WORKFLOW.md]
  • What unit does the refusal limit count?: One unit for each refused call, whatever the number of its refused arguments. An accepted call adds no unit. A refused argument refuses the whole call. (best practice) [sources: docs/ROADMAP_WORKFLOW.md, CONTEXT.md]
    • Chosen: One unit for each refused call. The documentation counts commands. One unit for each call bounds a loop of refused calls.
    • Rejected: One unit for each refused argument. One call can use the budget many times, so the count does not match the calls.
    • Rejected: No unit for a refused argument of a catalog program. A loop of find -exec calls then never reaches the limit, which is the defect.
  • Which values do the refusal limits use?: Keep roadmap.implement.max_consecutive_refusals at 3 and roadmap.implement.max_refusals at 30. The defect is the unit that counts, not the number. (best practice) [sources: docs/ROADMAP_WORKFLOW.md]
    • Chosen: Keep the current values. The item gives no evidence that the current values are wrong, and a new value needs evidence.
    • Rejected: Raise the values. A higher limit lets a longer loop run and does not bound it.
    • Rejected: Lower the values. A lower limit can stop a step that a person expects to run.
  • How does the job stop a loop of refused calls?: The step stops on its existing stop path with the class refused_tool and the refusal stop message. The refusal returns to the model as a tool result and adds no tool retry. (best practice) [sources: docs/ROADMAP_WORKFLOW.md, src/devops_cli/roadmap/implement/implement_run.py]
    • Chosen: Stop the step at the limit. The stop path exists, and the step ends with a comment that names the refusal.
    • Rejected: Refuse the call and go on. A loop of refused calls then runs without bound.
    • Rejected: Ask the model to change the call. The model can loop, and each request costs tokens.
  • Which part of the item does the proposal defer?: The scoped-write part. The shell check reads the first word of a command only and is no security boundary, so a scoped-write tool needs the runner sandbox of feat(roadmap): run the implement agent shell in a real sandbox #2695. The refusal budget remains in this item. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/implement/implement_run.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6521

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Nov 5, 2026
  2. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    ContributorAuthor

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

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It is deferred, depends on #2695 for the real sandbox, and is a split of an open umbrella item.
    • Value: High. Preventing writes outside the checkout and stopping unbounded refused-argument loops protect user data and job stability.
    • Effort: Medium. It needs new tests for scoped-write enforcement, a budget-counting fix, and integration with the #2695 sandbox.
    • Related: feat(roadmap): the implement agent can use the project's development tools #3041, which asks for a different change. Both concern the implement agent tool catalog, but #3041 adds the catalog and policies while this item enforces scoped writes and fixes the refusal budget count.
  3. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at e9bf5a9. A bot opened the item, so a review of the issue and of the proposal must approve it first. The review found the defects below. A person edits the body to answer them. The next refine round looks at the item again only after a body edit.

    • false_premise at key_questions 1: The plan says implement_run.py imports a shown helper from implement_shell_policy.py. The issue names only implement_run.py, and files holds no text of either file to support the claim. Evidence: "implement_run.py imports its shown helper and states that the shell check reads the first word of a command only"
  4. dan-petty commented on Nov 20, 2026

    @dan-petty
    Owner

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  5. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.

  6. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  7. dan-petty commented on Nov 26, 2026

    @dan-petty
    Owner

    Closed: the catalog tools no longer exist.

    Implement runs a stock harness shell since #7031. implement_shell_policy.py, the tool catalog and its refusal limit are gone. The Job container is now the boundary for writes.

  8. removed
    status/new
    on Nov 26, 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

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions