Fix clogged up git operations.

This commit is contained in:
Greyson Parrelli
2026-08-27 13:32:47 -04:00
parent 2e3af19d00
commit d7452c2262
9 changed files with 315 additions and 51 deletions
+13 -6
View File
@@ -21,19 +21,26 @@ job, and your comments land in its queue automatically (see step 7).
```bash
BASE="$PLAYPEN_REVIEW_URL" # e.g. http://127.0.0.1:8420/t/tab3
curl -s "$BASE/api/repo"
curl -s --max-time 30 "$BASE/api/repo"
```
`$PLAYPEN_REVIEW_URL` is exported into every terminal pane and names **this
tab's** review, so there is nothing to choose and no way to leave your review on
someone else's branch.
Give every call a deadline — `--max-time 30`. The server runs `git` for some of
these, and a repository being built in another pane can make that slow; a curl
with no deadline turns that into a tool timeout that says nothing about what
went wrong. If one does trip, say so and try once more rather than treating it
as a missing review: the answer was late, not absent.
- `{"open":true,…}` with a `context` object — good, go to step 2.
- `{"open":false}` or a 409 — this tab has no review pane. Tell the user to open
one (**Ctrl+Shift+D**) and stop. Don't review a different tab.
- `$PLAYPEN_REVIEW_URL` empty, or connection refused — list the tabs with
`curl -s http://127.0.0.1:8420/api/tabs` and match a tab's `path` against
`git rev-parse --show-toplevel`. If nothing matches, stop and say so.
`curl -s --max-time 30 http://127.0.0.1:8420/api/tabs` and match a tab's
`path` against `git rev-parse --show-toplevel`. If nothing matches, stop and
say so.
## 2. Find out which diff to review
@@ -59,7 +66,7 @@ whose line numbers the pane can place a comment on.
## 3. Get the diff
```bash
curl -s "$BASE/api/diff?base=main&uncommitted=true"
curl -s --max-time 30 "$BASE/api/diff?base=main&uncommitted=true"
```
The `patch` field is the exact bytes the pane renders, and `files` is the
@@ -163,7 +170,7 @@ Three details that decide whether a comment lands where you meant:
**Don't repeat what's already been said.** Fetch the existing threads first:
```bash
curl -s "$BASE/api/comments"
curl -s --max-time 30 "$BASE/api/comments"
```
Skip anything the user already raised, and anything **you** raised on an earlier
@@ -192,7 +199,7 @@ Write each body like a comment in a thread someone has to read:
## 6. Post them
```bash
curl -s -X POST "$BASE/api/comments" -H 'Content-Type: application/json' -d '{
curl -s --max-time 30 -X POST "$BASE/api/comments" -H 'Content-Type: application/json' -d '{
"level":"line","file":"src/review/Store.zig","side":"new","line":84,"endLine":91,
"author":"claude",
"body":"Should fix: save() runs while the write lock is held, so a slow disk blocks every reader for the length of the write. Snapshot the list under the lock and write outside it."