server: drop waits after three failed task reads #107

Merged
mikluko merged 1 commit from waits-purged into main 2026-11-16 13:11:52 +00:00
Owner

After three consecutive gc bd show <id> --json failures whose standard output is a JSON object with an error field, a task leaves the session's waits, the server logs one WARN, and the session gets one gc-marked prompt saying that the task and its result cannot be read. The count is per session and task, in memory, and does not survive a server restart. Closed-task telling is unchanged.

gc's missing-bead answer is that exit-1 JSON object; an outage gives no such object. Any other failed read keeps the wait and interrupts the count. Such failures warn once per session and task, and a successful read resets both that warning state and the missing-answer count.

Checks: go test -race ./..., GOMAXPROCS=1 go test -race -count=1 ./..., make lint, and go run sarak.sh/mikluko/changelog/v2/cmd/changelog -base main all pass.

After three consecutive `gc bd show <id> --json` failures whose standard output is a JSON object with an `error` field, a task leaves the session's waits, the server logs one WARN, and the session gets one gc-marked prompt saying that the task and its result cannot be read. The count is per session and task, in memory, and does not survive a server restart. Closed-task telling is unchanged. gc's missing-bead answer is that exit-1 JSON object; an outage gives no such object. Any other failed read keeps the wait and interrupts the count. Such failures warn once per session and task, and a successful read resets both that warning state and the missing-answer count. Checks: `go test -race ./...`, `GOMAXPROCS=1 go test -race -count=1 ./...`, `make lint`, and `go run sarak.sh/mikluko/changelog/v2/cmd/changelog -base main` all pass.
server: drop waits after three failed task reads
All checks were successful
image / image (pull_request) Successful in 17s
test / changelog (pull_request) Successful in 5s
test / go (pull_request) Successful in 1m22s
281de040ad
gc gives no typed error that separates an unreadable bead from other
read failures, so every failed poll read counts toward the limit.

Assisted-By: Kimi <noreply@moonshot.ai>
Author
Owner

Review at 281de04, by the reviewing session (specs-58). It conflicts with main since #104 (CHANGELOG.md and the README's line on the tools), so it is rebased in any case; one change goes with that.

Three failed reads in thirty seconds also means "the store was away for half a minute". Every failed read counts, the poll runs every ten seconds, so any outage of that length (the city's Dolt server restarting, gc's bead store coming up after a roll, a network blip) drops every wait in the city and tells each foreman "Task … can no longer be read, so it is no longer waited for and its result cannot be read", which is then false: the task is there, the worker finishes it, and nobody is told. That is the failure the waits exist to prevent, traded for a quieter log.

The description says gc's answer has no typed distinction between an unreadable bead and other failures. It has one. Run in the city (gc at the image's revision, bd 1.3.4) for an id of no bead:

$ gc bd show sa-zzzz9 --json; echo "exit $?"
Issue sa-zzzz9 not found                          (standard error)
{
  "error": "no issues found matching the provided IDs",
  "hint": "…",
  "schema_version": 1
}                                                 (standard output)
exit 1

The store answered, with a JSON object that has an error, where an outage gives no such object at all. So:

  • A failed read whose standard output is a JSON object with an error field is the store saying there is no such task. Three of those in a row drop the wait and tell the session, as this pull request does.
  • Any other failed read (gc did not start, no JSON on standard output, a timeout) keeps the wait and does not count. To keep the log quiet, warn once for a session and task when such failures begin, and not again until a read of it has succeeded.

gcwork.Work.exec today returns only the error's text for a non-zero exit; the poll's read needs the standard output too, to decode it as JSON (with encoding/json, not by matching words).

Tests: three "not found" answers drop the wait and tell once; ten failures of the other kind keep it and log one warning; a success between failures resets both.

Small: readFailures keeps an entry for a session that ended with a failing wait; drop a session's entries when its waits are rewritten without the task.

Review at 281de04, by the reviewing session (specs-58). It conflicts with main since #104 (CHANGELOG.md and the README's line on the tools), so it is rebased in any case; one change goes with that. **Three failed reads in thirty seconds also means "the store was away for half a minute".** Every failed read counts, the poll runs every ten seconds, so any outage of that length (the city's Dolt server restarting, gc's bead store coming up after a roll, a network blip) drops every wait in the city and tells each foreman "Task … can no longer be read, so it is no longer waited for and its result cannot be read", which is then false: the task is there, the worker finishes it, and nobody is told. That is the failure the waits exist to prevent, traded for a quieter log. The description says gc's answer has no typed distinction between an unreadable bead and other failures. It has one. Run in the city (gc at the image's revision, bd 1.3.4) for an id of no bead: $ gc bd show sa-zzzz9 --json; echo "exit $?" Issue sa-zzzz9 not found (standard error) { "error": "no issues found matching the provided IDs", "hint": "…", "schema_version": 1 } (standard output) exit 1 The store answered, with a JSON object that has an `error`, where an outage gives no such object at all. So: - A failed read whose standard output is a JSON object with an `error` field is the store saying there is no such task. Three of those in a row drop the wait and tell the session, as this pull request does. - Any other failed read (gc did not start, no JSON on standard output, a timeout) keeps the wait and does not count. To keep the log quiet, warn once for a session and task when such failures begin, and not again until a read of it has succeeded. `gcwork.Work.exec` today returns only the error's text for a non-zero exit; the poll's read needs the standard output too, to decode it as JSON (with `encoding/json`, not by matching words). Tests: three "not found" answers drop the wait and tell once; ten failures of the other kind keep it and log one warning; a success between failures resets both. Small: `readFailures` keeps an entry for a session that ended with a failing wait; drop a session's entries when its waits are rewritten without the task.
mikluko force-pushed waits-purged from 281de040ad
All checks were successful
image / image (pull_request) Successful in 17s
test / changelog (pull_request) Successful in 5s
test / go (pull_request) Successful in 1m22s
to 1a7ceb9574
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 17s
test / go (pull_request) Successful in 42s
2026-11-16 13:07:22 +00:00
Compare
mikluko deleted branch waits-purged 2026-11-16 13:11:52 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/roomcity!107
No description provided.