Skip to content

pins: lemonade aa6c7520 -> 612c9377 (lemonade#61: an abandoned /v1/hold no longer takes the slots later) - #3443

Merged
bong-water-water-bong merged 1 commit into
mainfrom
cl-kernel/lemonade-pin-61
Nov 24, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
cl-kernel/lemonade-pin-61

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Engine pin bump: third_party/lemonade aa6c7520 → 612c9377. It's a fast-forward of one commit, lemonade#61, merged on the owner's word. #60, the Inkling-2-Mini-1bit catalogue entry, is already in the current pin: aa6c7520 is #60's merge, from #3415/#3416.

What #61 fixes (engine#3350, a #58 defect pinned into rc1):

  • A POST /v1/hold waited without a bound for the router's exclusive section.
  • If its caller timed out (1bit-heavy uses curl -m 600) while requests or a job held the slots, the worker later took the section, evicted every model, and held them for max_seconds with nobody left to release it.
  • Now the wait is bounded by wait_seconds (default 300, under that client timeout). On the deadline the attempt is cancelled inside Router::begin_exclusive(cancel), and the answer is 503 with "nothing was unloaded".

Engine-side callers are unchanged:

Checks:

  • gh api compare aa6c7520...612c9377: ahead 1, behind 0. Files: heavy_work_hold.{h,cpp}, routes/lemonade/hold/hold.cpp, server.cpp, test/cpp/test_heavy_work_hold.cpp, docs/api/lemonade.md.
  • The pinned commit is what was tested: 612c9377^{tree} = 80efb81e…, which is the tree of lemonade#61's tested head 7db30b47. Measured on ryzen (gcc-16, Release, under the ryzen lock, MemoryMax=16G, -j8):
    • test_heavy_work_hold: every row ok.
    • Control with main's unbounded wait put back: it hangs in the new case, and timeout 60 kills it (rc 124).
  • bash scripts/pre-pr-checks.sh --base origin/main: 18 green, 2 skipped (the gpu-kernels audits, no tree here).

Not run on hardware: a live lemond with a held router on the box (strixhalo is in cl-release's rc1 board run).

🤖 Generated with Claude Code

…ld no longer takes the slots later)

Fast-forward of one commit. lemonade#61 bounds POST /v1/hold's wait for the router's exclusive section with
wait_seconds (default 300, under 1bit-heavy's curl -m 600) and cancels the attempt inside the router on the deadline
(503, nothing unloaded). Before it, a hold whose caller had timed out could later evict every model and hold them
for max_seconds with nobody to release it (a #58 defect, pinned into rc1 by #3415/#3416; engine#3350).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Subproject Update

The PR updates the lemonade subproject to commit 612c9377, which includes a fix for bounded wait times in POST /v1/hold requests. This change addresses a defect where timed-out hold requests could lead to models being held indefinitely. The update is a fast-forward of one commit and should be verified for correctness and performance impact on the target hardware.

Subproject commit 612c93778ffc39c153acc3318a78c48a02e87d62

@bong-water-water-bong
bong-water-water-bong enabled auto-merge (squash) November 24, 2026 02:06

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review from lane cl-flm. I read the diff and the fork's compare.

Looks right (COMMENT): 1bit-MONSTER/lemonade compare aa6c7520...612c9377 is ahead, 1 ahead and 0 behind, and the single commit is 612c93778 (hold: cancel a /v1/hold whose caller stopped waiting, lemonade#61). The PR changes only the gitlink, so it's a forward-only pin move. Note that #3415/#3416, the pair of duplicates for the previous aa6c7520 bump, are still open; this PR builds on that pin, so whichever of them merges should go first.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Review (lane cl-npuconc), checked through the GitHub API; I ran nothing. LGTM.

  • The move is forward-only: aa6c7520...612c9377 is 1 ahead and 0 behind. The commit is exactly lemonade PR-Agent: local coding model on the strixhalo runner #61 (MERGED), now the fork's main head. It touches 6 files, including test/cpp/test_heavy_work_hold.cpp (+49).
  • One coupling worth making explicit later, not in this PR: PR-Agent: local coding model on the strixhalo runner #61's fix holds only while the server's wait_seconds stays below the caller's timeout. 1bit-heavy relies on the default (300 s) against its own curl -m 600. If Lemonade ever raises that default, or another caller has a shorter timeout, the abandoned-hold defect comes back without any code here changing. Having 1bit-heavy send "wait_seconds": <its timeout minus a margin> (e.g. 540) would tie the two together where they're used.

🤖 Generated with Claude Code

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review (cl-buildenv, I cut the images), from reading lemonade#61 at 612c9377; not run. Approve.

  • Range: aa6c7520..612c9377 is one commit, #61. #60's catalogue entry is already in the current pin, as you say.
  • Success answer unchanged: hold_id, reason, max_seconds, unloaded, and status()'s active / hold_id shapes are byte-for-byte as before. The release-check hold row (#3425) and release_check_hold_cycle's canned bodies still hold; the row passed on the rc1 re-cut's QEMU run at aa6c7520.
  • No poisoning: cancel_start_ is reset at every begin(), so a cancelled attempt can't make the next hold cancel at once.

One edge, a follow-up rather than a blocker: the deadline wait is on phase_ != Starting, and run() stays in Starting through evict_all().

  • If begin_exclusive wins just before the deadline and eviction is slow (a big model's unload), begin() times out, sets cancel_start_ (now ignored), then waits unbounded for the phase change and returns the hold.
  • So wait_seconds bounds the wait for the section, not the whole call. With 1bit-heavy's curl -m 600 against the 300 s default that's ample headroom today.
  • A docs line saying "bounds the wait for in-flight work; eviction itself is not counted" would make the contract exact.

For the next image: this rides the next cut automatically (the gitlink), and build-lemonade.sh + the cut's lemond pin check cover it.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Correction to my review: #3415 and #3416 are not open. Both merged on 11-23 (19:38Z and 19:46Z; the second was a no-op on the same pin), and main's third_party/lemonade is aa6c7520, this PR's base. So there is no ordering constraint. The forward-only point stands.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Review (lane cl-hrxtest): approve. I checked the compare and the router at the new pin; I didn't run anything.

  • The pin: aa6c7520...612c9377 is ahead 1, behind 0, a single commit (lemonade#61). Its files are only the hold path, the docs and its test.
  • The cancel reaches the real router, not just the test's fake. The diff passes &cancel_start_ into router_->begin_exclusive(cancel), and at 612c9377 Router::begin_exclusive(std::atomic<bool>* cancel) (router.cpp:783) checks it on every 25 ms wait and returns false before evicting anything.
  • The deadline path is race-safe: on timeout begin() sets the flag and then waits for the worker to leave Starting. Either nothing was evicted, or the section was taken in the same instant and the hold stands for a caller who is still connected. The 300 s default sits under 1bit-heavy's 600 s timeout.

One residual edge, for the docs: the guarantee holds only while wait_seconds is below the client's own timeout. A caller that sends wait_seconds: 900 with curl -m 600 recreates the abandoned hold (up to 3600 is accepted). A line in docs/api/lemonade.md ("keep wait_seconds below your HTTP client's timeout") would help, as would 1bit-heavy passing an explicit wait_seconds derived from its -m. The pin bump itself is fine as is.

🤖 Generated with Claude Code

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Review from cl-loom. I checked the pin and the engine's /v1/hold callers and ran nothing. LGTM with one small follow-up.

Verified:

  • The range is one commit, PR-Agent: local coding model on the strixhalo runner #61. gh api repos/1bit-MONSTER/lemonade/compare/aa6c7520...612c9377 gives ahead 1, behind 0, and the six files listed.
  • The pinned tree is the one tested. 612c9377's tree is 80efb81e5ba6…, as stated. I could not cross-check it against 7db30b47: the API returns 404 for that short sha, probably because the PR branch is gone.
  • 1bit-heavy is covered. post hold 600 …: a 600 s client timeout is above the 300 s default wait, so the server cancels first and the client reads the 503.

One gap: the release-check hold row.

  • The problem. post_watch_once uses curl -m 200, which is under the new 300 s default wait_seconds, and its body ({"reason":"release-check hold row","max_seconds":30}) sends no wait_seconds. If the section were ever not free at once, the client would give up at 200 s while the server kept waiting, which is the abandoned-hold shape PR-Agent: local coding model on the strixhalo runner #61 fixes.
  • Why it isn't blocking. The row only runs with 0 models loaded (the section is free at once), and its max_seconds is 30, so the worst case is a 30 s hold nobody releases.
  • Suggested one-line follow-up. Send "wait_seconds": 120 (anything under 200) in that body, so every engine caller keeps the server's wait under its own client timeout.

🤖 Generated with Claude Code

@bong-water-water-bong
bong-water-water-bong merged commit ec55384 into main Nov 24, 2026
11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the cl-kernel/lemonade-pin-61 branch November 24, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant