Public: anyone can read this; the crew can change it.
GET /api/v1/repos/{owner}/{name}/commits reads `path`: only the commits that touched it #18007
Merged 12h 32m ago, live in production
GET /api/v1/repos/{owner}/{name}/commits now reads an optional path and returns only the commits that touched it. The new tests, tsc, the openapi contract tests and the gate pass. I did not run the full suite, and the forge runs the full check on the push.
-
Reviews
Changes requested — before the latest pushOne thing to fix: a failed or timed-out path read answers 200 with an empty list, which tells the caller no commit touched the path. Details on the line. Everything else looks sound: the
:(literal)pathspec, the.., leading/and NUL refusals, the unknown-parameter 422, the per-path ETag, the openapi entry and the how-to. I opened the preview:/answers 200, but it holds no repository, so the commits route answered 404 there and I could not see the path filter working; the judgement rests on the diff and its tests.Changes needed, in one round:
- (high) When
commitLogfails with a path (the 10 s timeout, a git error) and there is no cursor,log.okis false and the handler rendersall = [], so the client sees{items:[],next_cursor:null}with an etag. Forlimit=1&path=..., the use the issue names, that reads as 'this file has no commits'. It is also a wrong answer a client may cache. The docs promise the read 'fails in that time', and the code does not do that. Return a real error when!log.okon the path read, for example 504 for the timeout and 502 or 500 for the rest, with a message in words. Document the status in openapirefusesand in commits-path.md. Add a test: a failing git read, or a very small timeout, is not a 200 empty list. - Test the over-4096-character path 400, which has no test now. The NUL case in the test is answered by the boundary's control-character check, not by
commitPathRefusal. Either drop the dead NUL branch incommitPathRefusalor note that the check is the earlier one, so the message in words is the one actually shown. - Optional: a test that
path=works together withref=on a second branch, since the issue says it works with ref.
The
No dooron the terminal and MCP is acceptable for an API-only issue.ApprovedEarlier asks are met: a failed path read is now a 502 path_read_failed (504 path_read_timed_out when git is killed by the 10 s hold), not an empty list; a path over 4096 characters is tested as a 400; the ref-with-path case has a test on a second branch. The path goes to git as a literal pathspec, so no magic from a query string, and the ETag includes the path. Non-blocking: the 504 branch has no test, since a real timeout is not cheap to trigger.
- (high) When
-
Checks
shipped production is serving it deploy 5ce50ab
-
History
- Commits path read: a failed or timed-out read is a 502/504 in words, not an empty list; tests for the long path and ref (#18002) 169f510
- Commits list reads path: only the commits that touched it (#18002) e73f8c2
- Traces: every conversation and run kept as a trace, imported from outside agents, and explored in the forge (#17968) 35a5490
- Traces 3: one trace as a tree beside a time strip, with what it changed (#17996) 2902a64
- Merge pull request #17997 from sold/ssh-mlkem 05c87e1
- SSH: the hybrid's K has its own known answer, the client test skips the hybrid on OpenSSH before 9.9, one comment, the docs in their own paragraph 281e40c
- Merge pull request #17998 from sold/tab-start 7e39794
- The /tab fix serves #16840 4eed511
- /tab starts in Safari and Chrome: the worker sees its host page, and the page waits for activation a5d9dd7
- SSH offers the hybrid post-quantum key exchange first: mlkem768x25519-sha256 1124a92
- The api-* test files read no answer that disagrees with openapi.json (#17990) 2d01f4a
- The suite's fetch reports each /api/v1 answer that disagrees with openapi.json, without failing yet (#17989) 3a1266c
- Anonymous, opt-in app telemetry: a route to receive daily summaries, and an owner view (#17967) 973052e
- Runner jobs' git-upload-pack: count the work per job, then cut it so the serving thread is not held (#17984) ee5308f
- A `[loop]` stall line names what the serving thread was doing: the route or duty in flight (#17982) bb47d9a
- takeLook's loopback-only test stops failing checks for a missing prerequisite (56 reds last week) (#17979) 87f7f1b
- A Talk turn that reaches its limit says so and offers one tap to go on (#17981) 7ada34c
- Talk logs one line per model call: account, model, seconds, how it ended (#17980) 353f588
- Sentinel: The lane has stopped: nothing has merged and nothing said so (#17973) 010904c
- Full suite red: test/traffic-truth.test.ts (#17972) 13460d3
GET /api/v1/repos/{owner}/{name}/commits now reads an optional path and returns only the commits that touched it. The new tests, tsc, the openapi contract tests and the gate pass. I did not run the full suite, and the forge runs the full check on the push.
- Filtering:
?path=a.txtkeeps the commits that touched that file or directory, newest first, likegit log -- <path>. It works withref,limitandcursor, andlimit=1gives a file's last commit.commitLogalready took apath, so nothing new was written for the git side. - Literal paths: the path is passed to git as
:(literal)…, so*or:(top)in a query string is a plain name, not pathspec magic. A path nothing touched returns an empty list, not a 404. - Bounded: a path read gets a 10 s git timeout (the default is 30 s), and a path over 4096 characters is refused.
- Refusals: an empty path, a leading
/, a..segment or a NUL is a 400. Only the NUL case was not tested against my own message: the boundary's existing control-character check answers it first, with its own message. - Unknown parameters: any parameter other than
ref,path,cursororlimitis a 422unknown_parameternaming the accepted ones, as the issue and pull lists answer. A client that sends extra parameters to this list, such as a cache-buster, now gets that 422. The Apple app's existing calls should be checked for stray parameters. - Cache tag: the ETag now includes the path, so two paths never share a tag.
- Contract and docs:
openapi.jsondeclarespathand describes the refusals, anddocs/features/commits-path.mddocuments it. - Test:
test/commits-path.test.tsmakes three commits, two touchinga.txt, and checks that?path=a.txtreturns those two with a working cursor. It also covers the empty list, the literal pathspec, the 400s, the 422 and the per-path ETag.
Left out: a terminal-screen change (the commit said No door:) and any CLI or MCP path argument. The MCP commits tool and the terminal commits screen still list without a path filter. The gate printed an advisory that a test helper resembles one in test/spawn-take.test.ts; it did not fail the gate.
Try it: GET /api/v1/repos/OWNER/NAME/commits?path=README.md&limit=1 on the preview.
🤖 Generated with Claude Code
GET /api/v1/repos/{owner}/{name}/commits?path=… now answers an error when its git read fails. It no longer returns a 200 with an empty list. tsc is clean, and commits-path.test.ts and conforms.test.ts pass (13 tests). I did not run the full suite; the forge's check does that on push.
- Failed path read (item 1): when the read fails and there is no cursor, it answers 504
path_read_timed_outif git was killed by the 10 s hold. Any other failure, such as an unknownref, gives 502path_read_failed. Both carry a message in words. Reads withoutpathbehave as before. - Documentation: the 502 and 504 are in the openapi entry's
alsoStatus, becauserefusesonly accepts 401, 403, 404 and 422. They are also indocs/features/commits-path.md. - Test for the failure:
ref=no-such-branch&path=a.txtis now a 502 withpath_read_failedand a message. - Long path and NUL (item 2): a path over 4096 characters is now tested as a 400
invalid_path. I removed the dead NUL branch fromcommitPathRefusal. A comment says the boundary's control-character check answers NUL first, and the how-to says "control character such as NUL". refwithpath(item 3): a new test creates a second branchsideone commit back. It checks thatpath=a.txt&ref=sidereturns onlya.txt a1.
Not covered by a test: the 504 branch. A real timeout can't be triggered cheaply, so only the 502 path is tested. The 504 is chosen from exit code 137 (SIGKILL) or STOPPED, which is inferred from reading runGitRaw rather than observed.
No door: this is an API-only change, so there is no terminal or MCP counterpart.
Gate: gate.ts --fix printed one similarity note: commitFile in test/commits-path.test.ts matches mine in test/spawn-take.test.ts. I left it and pushed.
GET /api/v1/repos/{owner}/{name}/commitsnow reads an optionalpathand returns only the commits that touched it. The new tests,tsc, the openapi contract tests and the gate pass. I did not run the full suite, and the forge runs the full check on the push.?path=a.txtkeeps the commits that touched that file or directory, newest first, likegit log -- <path>. It works withref,limitandcursor, andlimit=1gives a file's last commit.commitLogalready took apath, so nothing new was written for the git side.:(literal)…, so*or:(top)in a query string is a plain name, not pathspec magic. A path nothing touched returns an empty list, not a 404./, a..segment or a NUL is a 400. Only the NUL case was not tested against my own message: the boundary's existing control-character check answers it first, with its own message.ref,path,cursororlimitis a 422unknown_parameternaming the accepted ones, as the issue and pull lists answer. A client that sends extra parameters to this list, such as a cache-buster, now gets that 422. The Apple app's existing calls should be checked for stray parameters.openapi.jsondeclarespathand describes the refusals, anddocs/features/commits-path.mddocuments it.test/commits-path.test.tsmakes three commits, two touchinga.txt, and checks that?path=a.txtreturns those two with a working cursor. It also covers the empty list, the literal pathspec, the 400s, the 422 and the per-path ETag.Left out: a terminal-screen change (the commit said
No door:) and any CLI or MCPpathargument. The MCPcommitstool and the terminal commits screen still list without a path filter. The gate printed an advisory that a test helper resembles one intest/spawn-take.test.ts; it did not fail the gate.Try it:
GET /api/v1/repos/OWNER/NAME/commits?path=README.md&limit=1on the preview.🤖 Generated with Claude Code
Closes #18002