Skip to content

fix(serve): a retried send waits for the server's own timeout instead of racing it - #980

Merged
leemour merged 1 commit into
mainfrom
fix/serve-wait-longer
Nov 17, 2026
Merged

leemour merged 1 commit into
mainfrom
fix/serve-wait-longer

Conversation

@leemour

@leemour leemour commented Nov 17, 2026

Copy link
Copy Markdown
Member

RISK-2320. A command and max serve both waited 30 s for MAX. When MAX answered near that limit, the command timed out on the server first and retried the send with the same cid while the server was still waiting on the first attempt: two sends with one cid in flight at once.

MAX drops a repeated cid that comes after the first (measured 2026-09-19, also across connections and up to 15 min later; docs/dev/ARCHITECTURE.md section 6). Two at once were never measured.

  • src/server/server-connection.ts: the command waits the timeout plus 5 s for the server, so the server's "MAX did not answer" arrives first and the retry is the sequential, measured case.
  • src/server/server.test.ts: a server answering 1 ms past the timeout is still heard (fake timers, no real wait). Fails without the fix, passes with it.
  • ARCHITECTURE section 6 states the rule; changelog fragment under Исправлено.

Local: the whole src/server/server.test.ts (90 passed), biome, typecheck, docs:check.

🤖 Generated with Claude Code

… of racing it

A command and max serve both waited 30 s for MAX. When MAX answered near that limit, the command
gave up on the server first and sent the same cid again while the server was still waiting on the
first, so two sends with one cid were in flight at once. MAX drops a repeated cid when it comes
after the first (measured, ARCHITECTURE section 6), but never measured concurrently.

The command now waits 5 s longer than the server, so the server's "MAX did not answer" arrives
first and the retry is the sequential, measured case. The regression test fails without the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leemour
leemour merged commit ca522f6 into main Nov 17, 2026
13 checks passed
@leemour
leemour deleted the fix/serve-wait-longer branch November 17, 2026 08:54
@leemour leemour mentioned this pull request Nov 17, 2026
leemour added a commit that referenced this pull request Nov 17, 2026
Prepares 0.118.0 so #980 reaches npm: the command waits 5 s longer than
`max serve`, so a retry never runs at the same time as the first send.

- `package.json`, `src/version.ts`: 0.118.0. `CHANGELOG.md`:
`changes/fix-serve-wait-longer.md` collected into `## 0.118.0 —
17.11.2026`, the same result as `scripts/changelog-fragments.ts`. No
fragments are left, so `bin/release` will not open its own fold pull
request.

## Conformance

- #980 passed CI on its branch. This branch changes only the version and
the changelog.
- Live check (`pnpm smoke:live`, step 3a of the release guide): **not
run.** The owner approved this release without new live checks
(NEED-2678 A, 2026-11-17). `bin/release` still runs `pnpm release:check`
before it dispatches `release.yml`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant