Skip to content

Agent performs excessive repository inspection instead of following explicit commit-and-merge command #47854

Open

Description

@posixenjoyer

Summary

After the user explicitly instructed the coding agent to commit and merge, the agent did not execute the requested Git operation. It initiated a prolonged, self-directed inspection of the working tree, branch history, untracked files, ignored local configuration, and possible merge conflicts.

The first inspection included a broad diff of generated HTML that hit the tool's 50 KB output limit. The investigation continued through multiple additional reads and searches until the user interrupted it. The user estimated that this consumed roughly 7% of the session context.

Environment

  • Provider: openai-codex
  • Model: gpt-5.6-sol
  • Reasoning level: high
  • Harness: @earendil-works/pi-coding-agent 0.85.1
  • OS: Linux

This may be model instruction-following behavior rather than a Codex CLI-specific defect, but I am filing it here because the affected model/provider is OpenAI Codex and there is no exposed provider-feedback command in the harness.

Steps to reproduce

  1. Work in a Git repository on a feature branch with a known master base.
  2. Have modified generated portal files, an untracked JSON artifact, and ignored local configuration.
  3. Establish the branch and status earlier in the conversation.
  4. Tell the agent: commit and merge.

Actual behavior

The agent replied:

I'll inspect the pending changes and branch divergence before committing, to avoid including generated data or secrets and to choose the correct merge direction.

It then performed, without being asked:

  1. A large generated-file diff:

    git diff --stat && git diff -- portal/team-reports/index.html portal/vault/index.html

    This produced a truncated 50 KB response containing hundreds of lines of generated HTML.

  2. Enumeration of files under .claude/.

  3. Parsing of an unrelated untracked JSON artifact.

  4. Branch-divergence and commit-history inspection.

  5. Full reads of project settings, ignored local settings, and the JSON artifact.

  6. Additional diff/status inspection and repository searches.

  7. Merge-base and potential-conflict inspection.

  8. Continued planning instead of executing the explicit command.

The user had to interrupt the agent before it performed the commit and merge.

Expected behavior

The agent should execute the explicit Git workflow using state already established in the conversation. If a material ambiguity genuinely blocks execution, it should ask one concise clarification based on filenames/status already known.

It should not read file contents merely to formulate that question, and it should not dump generated files into model context. At most, bounded metadata such as git status --short --branch, git diff --stat, or git diff --name-only should be used.

Impact

  • Approximately 7% of available conversation context consumed.
  • Hundreds of lines of generated HTML inserted into context.
  • Direct user instruction delayed and effectively ignored.
  • Ignored local configuration and unrelated user-owned artifacts read without necessity.
  • Increased chance of exposing sensitive local values to model context.
  • User intervention required to stop the investigation.

No secret happened to be present in this instance; the unsafe behavior is that the agent did not know that before reading the ignored local file.

Suggested fixes

  1. Treat direct Git workflow imperatives as execution requests once branch/status state is known.
  2. Require a concrete unanswered question before each additional inspection.
  3. Default to bounded diff metadata and prevent accidental large generated-file dumps.
  4. Do not read ignored/local configuration or unrelated untracked artifacts unless directly required and authorized.
  5. If commit scope is ambiguous, ask one concise question rather than conducting a repository audit.
  6. Add a context-cost guard for tool calls likely to emit tens of kilobytes.
  7. Stop exploratory planning when it no longer changes the next action.

Acceptance criteria

  • On the same prompt, the agent either executes directly or asks one concise clarification.
  • It does not read unrelated or ignored files.
  • It does not emit full generated-file diffs.
  • Any pre-execution checks remain limited to bounded status/branch metadata.
  • The user does not need to interrupt the agent to make it follow the original command.

Activity

  1. added
    bug
    model-behavior
    on Sep 24, 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

    bugmodel-behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions