Skip to content

fix: local model switching, mid-run settings, deterministic chess endings; release 0.0.12 - #18

Merged
siarheidudko merged 2 commits into
mainfrom
claude/agents-review-improvements-2m2406
Oct 3, 2026
Merged

siarheidudko merged 2 commits into
mainfrom
claude/agents-review-improvements-2m2406

Conversation

@siarheidudko

@siarheidudko siarheidudko commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Fixes the demo problems reported after the last release.

Problem: switching local models

Report: after loading one local model, switching to another had no effect, and there was no way to load it.

Cause: useWebLLMModel kept the loaded model across modelId changes. So ready stayed true, the card said "loaded", the Load button never appeared, and the agent kept using the old model.

Fix:

  • Everything the hook reports is now about the current modelId: model, ready, loading, progress and error.
  • The previous model stays in memory (new loadedModelId), so switching back is instant.
  • Loading the new model first frees the old model's GPU memory, through the core's unloadWebLLMModel. There is also a new unload().
  • A load that another load supersedes frees its engine. Calling load() twice for the same id shares one download.

Problem: settings not applying

Report: settings didn't seem to apply.

Cause:

Fix:

  • useAgent keeps the run's status through a rebuild. The run keeps its agent, and the next run gets the new one.
  • New "No thinking" level (none) in the composer chip, the labels and the demo settings.

Chess

  • Endings come from the rules (chess.js), not the model.
    • A mate, stalemate or draw ends the game on the spot, and a mating move by White never starts the agent.
    • The result covers the board ("Checkmate — you win (1-0)" + New game) and is added to the chat.
    • When the agent's own move ends the game, make_move says the game is over.
  • A failed agent turn is reported as failed.
    • If the agent's turn ends with Black still to move (API error or spent quota, a stop, a limit), the board shows the reason with Retry and Engine move, plus a notice in the chat. The board stays locked until Black moves.
    • Before, a 429 on the executor was swallowed: the turn "succeeded" with "I will wait."

Demo model card

  • Reopens when the newly selected model needs a key or a load.
  • Names the local model still in GPU memory ("… is in GPU memory — loading this one frees it first").
  • Has an Unload button.

Version

main already published 0.0.11 (the MCP SDK autoupdate, #17), so this ships as 0.0.12. I merged main in:

  • the devDependencies take both sides: @dudko.dev/agent-web ^0.0.21 and @modelcontextprotocol/sdk ^1.32.0;
  • the lockfile is regenerated with npm;
  • CHANGELOG has a 0.0.12 entry.

The peer stays >=0.0.20.

Checks

These are after the merge.

  • typecheck, format:check, build, npm test 43/43, demo typecheck and build.
  • npm run test:e2e 15/15, with 3 new tests:
    • Scholar's mate: no agent run after the mate, the result is shown, New game resets the board.
    • A 429 on the executor: the board stays locked with the reason, and Retry plays the move.
    • A setting changed mid-run: the run keeps going, and the next run uses the new thinking level.
  • The hook, driven in Chromium with a fake WebLLM, passes 13 checks: switch, switch back, free before load, unload, a superseded load, double load. On main's hook the same harness shows the bug: after switching to B, ready: true with model A.

🤖 Generated with Claude Code

https://claude.ai/code/session_01A7jHa5Pim4ufrdgxg561G5

claude added 2 commits October 3, 2026 01:51
…ings; release 0.0.11

- useWebLLMModel tracks the current modelId: switch it and model / ready /
  loading / progress / error describe the new one (not loaded yet) instead of
  the old model, which kept `ready` true and hid the load button. The previous
  model stays in memory (loadedModelId; switching back is instant) until the
  next load frees its GPU memory first, or unload(). A load superseded by
  another one frees its engine; a second load() of the same id shares the
  download.
- useAgent: a rebuild while a run is in flight (a setting changed mid-run) no
  longer flips the status out of 'running'; the run keeps its agent, the next
  run gets the new one, and the run's end restores the build's own status.
- Thinking: a 'none' level ("No thinking") in the composer chip and labels;
  with agent-web 0.0.21 it turns a local Qwen3's thinking off.
- Demo: the model card reopens for a model that needs a key or a load, names
  the local model still in GPU memory, and can unload it. Chess outcomes come
  from the rules, not the model: a mate / stalemate / draw ends the game on
  the spot (a mating move is never answered by the agent), with the result
  over the board and in the chat; a turn the agent ends without moving (API
  error, quota, stop, limit) is reported with its reason and the board stays
  locked until it moves (Retry or the engine).
- e2e: chess endings, a failed agent turn, a mid-run settings change.
- Depends on @dudko.dev/agent-web ^0.0.21 (dev + demo); peer stays >=0.0.20.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A7jHa5Pim4ufrdgxg561G5
main already published 0.0.11 (the MCP SDK autoupdate), so these fixes go
out as 0.0.12: devDependencies take both sides (@dudko.dev/agent-web ^0.0.21,
@modelcontextprotocol/sdk ^1.32.0), the lockfile is regenerated with npm, and
CHANGELOG gets a 0.0.12 entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A7jHa5Pim4ufrdgxg561G5
@siarheidudko siarheidudko changed the title fix: local model switching, mid-run settings, deterministic chess endings; release 0.0.11 fix: local model switching, mid-run settings, deterministic chess endings; release 0.0.12 Oct 3, 2026
@siarheidudko
siarheidudko marked this pull request as ready for review October 3, 2026 01:56
@siarheidudko
siarheidudko merged commit 80edcf0 into main Oct 3, 2026
3 checks passed
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.

2 participants