-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Description
What version of Codex is running?
codex 0.63.0
What subscription do you have?
Open-source Codex CLI usage (no subscription required)
Which model were you using?
N/A - issue is in codex-rs recent_commits logic, unrelated to model selection
What platform is your computer?
Darwin 25.0.0 arm64 arm
What issue are you seeing?
Calling recent_commits(..., 0) returns 1 commit due to limit.max(1) being applied.
This makes limit == 0 behave the same as limit == 1, which is inconsistent with the expectation that requesting 0 commits should return an empty list.
This affects downstream consumers that rely on limit == 0 to detect absence of history (e.g., determining whether a repository has any relevant commit history before performing actions).
What steps can reproduce the bug?
-
Create or use any git repo with at least one commit
-
Call:
let commits = recent_commits(Path::new("."), 0).await;
-
Observe that commits.len() == 1
What is the expected behavior?
recent_commits(path, 0) -> []
Additional information
I have a small PR ready that:
- returns an empty Vec when limit == 0
- adds a test that fails before the change and passes afterwards
Happy to adjust if the current behavior is intentional.