Duplicate check
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.
Duplicate check
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.