Skip to content

[Feature}:Add Scoped Path Filtering to git_log Built-in Tool #623

Description

@Preciousuche

Duplicate check

  • I searched the existing open and closed issues and this is not a duplicate.

Problem

Currently, the built-in git_log tool only accepts count and workdir:

python
async def git_log(count: int = 10, workdir: str | None = None) -> str: ...
When an agent is investigating a bug, refactoring a module, or checking recent edits to a specific file or directory (e.g. src/agentos/channels/email.py or docs/), it has no way to scope the log query. It is forced to fetch the top N commits across the entire repository and hope the file was touched recently, which wastes tokens and context window space.

In contrast, git_diff already supports path: str | None = None.

Proposed behavior

1.Add an optional path: str | None = None parameter to git_log tool definition and documentation:
python
async def git_log(
count: int = 10,
path: str | None = None,
workdir: str | None = None,
) -> str:
2.Validate path using _reject_foreign_git_path(path) to maintain sandbox security boundaries.
Pass ["--", path] to git log when path is provided:
python
args = ["log", f"--max-count={count}", "--oneline", "--decorate"]
if path:
args += ["--", path]
3.Update @sandboxed argv_factory to include the path in the fingerprinted command.

Area

CLI

Alternatives considered

Agents running shell tool commands (git log -n 5 -- path/to/file): requires higher sandbox privilege grades and shell approval, whereas git_log is already safe and credential-redacted under git.read.

Activity

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

    area: toolsTool registry, execution, and built-in toolstype: enhancementNew feature or requestwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions