fix(*): a Qwen Code on an old Node.js names it, and its model fix runs /auth (#786)
## Summary
Qwen Code is a Node.js script (`#!/usr/bin/env node`), so it runs on
whichever `node` comes first on the PATH it is launched with, not the
one it was installed with. On a machine whose PATH puts an older Node.js
first (an nvm default left on 18, a Homebrew formula nobody upgraded), a
Connect or Test used to end in "Qwen Code quit as soon as it started",
with the reason folded under it as English that names no Node.js at all.
Measured on Qwen Code 0.24.4 with official Node.js builds:
| Node.js on PATH | What qwen does | What the sheet says now |
| --- | --- | --- |
| 18.20.8 | Exits 1 at import: `SyntaxError: The requested module
'node:fs' does not provide an export named 'openAsBlob'` | It needs
Node.js 22 or newer and this machine started it with 18.20.8, plus the
upgrade command when the installer is recognisable |
| 20.20.2 | Runs | Connects, as before |
| 22 | Runs | Connects, as before |
The verdict is read off facts, not off that sentence, which changes with
every release and names no version anyway:
- `raven/agent/subagent/node_runtime.py` (new): resolves the interpreter
from the agent's shebang the way `env` would, on the launch's own PATH
(the row's, else the login shell's), runs `node --version`, and reads
the floor from the agent's own `package.json` `engines.node` (`>=22.0.0`
for qwen). Any missing fact means no verdict, so Node.js is never named
on a guess. The upgrade command is given only where the installer shows
in the path: `nvm install 22 && nvm alias default 22` under
`~/.nvm/versions/node/`, `brew upgrade node` under `Cellar/node/`;
anything else (a pinned `node@18`, an installer package) gets nodejs.org
and no command.
- `presets.py`: `NODE_RUNTIME_PRESETS` holds the presets measured to die
this way, Qwen Code only.
- `probe.py`: a launch that quit is checked only for such a preset, and
only after the `--acp` check; the check runs `node --version`, so
Connect and Test reach it through `asyncio.to_thread`.
- `probe_state.py`, `rpc/models.py`, `rpc-schema/openrpc.json`:
`SubagentRemedy.kind` gains `runtime`, with optional `needs` and `found`
(both sent for `runtime`). Both generated clients were regenerated.
- ui-web: the sheet says both versions and shows the upgrade command on
its own line, or points at nodejs.org when there is none; a `runtime`
remedy that arrives without its versions reads as a launch that quit.
The card says "Qwen Code's Node.js is too old". zh/en strings in
`i18n/messages.json`. The offline fixture library keeps its Qwen Code
row on the two-step model fix, so `needs` and `found` join `UNSENT` with
the reason.
Why the stderr sentence is not the trigger: Raven keeps the last 400
characters of stderr in the error it reports, and the `SyntaxError` line
sits 642 characters from the end of qwen's output, so the Test path
never sees it.
Also in this PR: the fix for a model its provider no longer serves
(404), no credit (402) and a rate limit or spent quota (429) now says
`/auth`, not `/model`. `/model` only picks among the models already
registered in `~/.qwen/settings.json`, and qwen 0.24.4's own OpenRouter
preset registers exactly two free models, both since withdrawn from
OpenRouter's free tier (each answers 404 "unavailable for free",
measured 2026-09-24). So anyone set up the default way was sent to a
list offering only dead models. `/auth` re-runs the provider setup,
whose "Model IDs" step takes any id the provider serves; the sheet's
three sentences now say to enter a working model at that step
(`MODEL_SWITCH_HINTS` in `presets.py`, `gui.agent.fix_model` /
`fix_billing` / `fix_quota`).
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
- `python -m pytest --idle-ceiling-strict` over every test file that
touches sub-agents, the ACP client or the RPC layer: 6423 passed, 1
failed. The failure is
`tests/test_rpc_files.py::test_a_host_without_libreoffice_says_so`,
which fails the same way on `main` on this machine.
- `tests/test_subagent_node_runtime.py` (new, 13 tests): the verdict,
the installer-specific commands, the floor as declared, an absolute
shebang, every missing fact, Connect through the thread, and Test.
Removing the classification call in `probe.py` fails the three
Connect/Test tests.
- `ruff check raven tests` and `ruff format --check raven tests`: clean.
- `python scripts/coverage_gate.py --coverage-json coverage.json diff
--base-ref origin/main --threshold 90`: 100.00% (120/120 executable
changed lines).
- ui-web: `npm run type-check` clean; `npm run lint` 0 errors (4
existing warnings in files this does not touch); `npm run gen:check` in
sync; `npx vitest run` 3035 passed.
- ui-tui: `npm run lint:rpc` and `npm run lint:i18n` in sync.
- Live, real Qwen Code 0.24.4 through `ping_agent` and `run_test`, with
official Node.js 18.20.8, 20.20.2 and 22 first on the launch PATH: 18
gets `runtime` (needs 22, found 18.20.8) on both buttons within a
second; 20 and 22 connect. The 20 Qwen Code cases from #779 were re-run
and give the same results as before, except that the model and billing
cases now name `/auth`.
- The rendered sheet was checked in a browser against the offline
fixture library, zh, both with and without an upgrade command.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
No user-facing doc describes these refusal messages; the new sentences
live in `i18n/messages.json`.
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
The check runs `node --version` on the resolved interpreter, only after
a Qwen Code launch has already quit, and with a 5 s bound, off the event
loop. Nothing is read or sent beyond the agent's own `package.json`.
`runtime`, `needs` and `found` are additive. A page that predates them
drops a kind it does not know and shows its generic "could not connect"
text; a stored verdict carrying them reads back as no remedy on older
code.
Rollback: revert the squash commit; there is no migration.
## Related Issues
N/A
Co-authored-by: Claude (claude-opus-5-5) <noreply@anthropic.com>
2026-09-24 18:36:57 +08:00
|
|
|
"""Which Node.js an npm-installed agent is launched with, and whether it is new enough."""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import json
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
from raven.agent.subagent.node_runtime import NodeTooOld, _declared_floor, _short, _upgrade_command, node_too_old
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _installed(
|
|
|
|
|
tmp_path: Path,
|
|
|
|
|
node_version: str,
|
|
|
|
|
*,
|
|
|
|
|
node_dir: Path | None = None,
|
|
|
|
|
engines: object = ">=22.0.0",
|
|
|
|
|
shebang: str = "#!/usr/bin/env node",
|
|
|
|
|
) -> str:
|
|
|
|
|
"""An `npm i -g` layout -- `bin/qwen` linked to the package's entry script -- and a `node`; the PATH to both.
|
|
|
|
|
|
|
|
|
|
The `node` is a stand-in that answers `--version`, which is all the check
|
|
|
|
|
asks of it.
|
|
|
|
|
"""
|
|
|
|
|
package = tmp_path / "lib" / "node_modules" / "@qwen-code" / "qwen-code"
|
|
|
|
|
package.mkdir(parents=True)
|
|
|
|
|
manifest: dict[str, object] = {"name": "@qwen-code/qwen-code"}
|
|
|
|
|
if engines is not None:
|
|
|
|
|
manifest["engines"] = {"node": engines}
|
|
|
|
|
(package / "package.json").write_text(json.dumps(manifest), encoding="utf-8")
|
|
|
|
|
entry = package / "cli-entry.js"
|
|
|
|
|
entry.write_text(f"{shebang}\nconsole.log('hi')\n", encoding="utf-8")
|
|
|
|
|
entry.chmod(0o755)
|
|
|
|
|
bindir = tmp_path / "bin"
|
|
|
|
|
bindir.mkdir()
|
|
|
|
|
(bindir / "qwen").symlink_to(entry)
|
|
|
|
|
nodedir = node_dir or tmp_path / "node" / "bin"
|
|
|
|
|
nodedir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
node = nodedir / "node"
|
|
|
|
|
node.write_text(f"#!/bin/sh\necho v{node_version}\n", encoding="utf-8")
|
|
|
|
|
node.chmod(0o755)
|
|
|
|
|
return f"{nodedir}:{bindir}:/usr/bin:/bin"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_an_agent_launched_on_a_node_below_its_floor_is_named_with_both_versions(tmp_path: Path) -> None:
|
|
|
|
|
"""Measured on Qwen Code 0.24.4: on Node 18.20.8 it dies at import, and its package asks for >=22.
|
|
|
|
|
|
|
|
|
|
The versions are measured, not read from the crash: the crash names a
|
|
|
|
|
missing `node:fs` export, which says nothing about which Node.js ran it.
|
|
|
|
|
"""
|
|
|
|
|
path = _installed(tmp_path, "18.20.8")
|
|
|
|
|
stale = node_too_old("qwen", path)
|
|
|
|
|
assert stale == NodeTooOld(needs="22", found="18.20.8", node=str(tmp_path / "node" / "bin" / "node"), upgrade=None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_a_node_at_or_past_the_floor_is_not_named(tmp_path: Path) -> None:
|
|
|
|
|
assert node_too_old("qwen", _installed(tmp_path, "22.1.0")) is None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_the_upgrade_names_the_installer_the_node_came_from(tmp_path: Path) -> None:
|
|
|
|
|
"""nvm and Homebrew show in the path; anything else gets no command rather than a wrong one.
|
|
|
|
|
|
|
|
|
|
The nvm default is what the login shell -- which Raven launches agents
|
|
|
|
|
from -- resolves, so switching it is the fix, not only installing. Read off
|
|
|
|
|
the path alone, so no stand-in `node` is run here.
|
|
|
|
|
"""
|
|
|
|
|
nvm = tmp_path / ".nvm" / "versions" / "node" / "v18.20.8" / "bin" / "node"
|
|
|
|
|
assert _upgrade_command(str(nvm), 22) == "nvm install 22 && nvm alias default 22"
|
|
|
|
|
brew = tmp_path / "Cellar" / "node" / "18.20.8" / "bin" / "node"
|
|
|
|
|
assert _upgrade_command(str(brew), 22) == "brew upgrade node"
|
|
|
|
|
pinned = tmp_path / "Cellar" / "node@18" / "18.20.8" / "bin" / "node"
|
|
|
|
|
assert _upgrade_command(str(pinned), 22) is None, "`brew upgrade node` does not move a pinned node@18"
|
|
|
|
|
assert _upgrade_command(str(tmp_path / "usr" / "local" / "bin" / "node"), 22) is None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_the_floor_is_said_the_way_it_is_declared(tmp_path: Path) -> None:
|
|
|
|
|
assert node_too_old("qwen", _installed(tmp_path, "20.11.0", engines=">=20.19.0")).needs == "20.19"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_an_absolute_shebang_is_the_node_that_runs(tmp_path: Path) -> None:
|
|
|
|
|
"""`#!/path/to/node` bypasses PATH, so the check must too."""
|
|
|
|
|
elsewhere = tmp_path / "elsewhere"
|
|
|
|
|
elsewhere.mkdir()
|
|
|
|
|
node = elsewhere / "node"
|
|
|
|
|
node.write_text("#!/bin/sh\necho v16.20.2\n", encoding="utf-8")
|
|
|
|
|
node.chmod(0o755)
|
|
|
|
|
path = _installed(tmp_path, "22.1.0", shebang=f"#!{node}")
|
|
|
|
|
stale = node_too_old("qwen", path)
|
|
|
|
|
assert stale is not None and (stale.found, stale.node) == ("16.20.2", str(node))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_a_missing_fact_names_nothing(tmp_path: Path) -> None:
|
|
|
|
|
"""Every fact is required, so Node.js is never named on a guess."""
|
|
|
|
|
for case, kwargs in {
|
|
|
|
|
"no floor declared": {"engines": None},
|
|
|
|
|
"a floor nobody can read": {"engines": "^22"},
|
|
|
|
|
"not a Node.js script": {"shebang": "#!/bin/sh"},
|
|
|
|
|
}.items():
|
|
|
|
|
root = tmp_path / case.replace(" ", "_")
|
|
|
|
|
root.mkdir()
|
|
|
|
|
assert node_too_old("qwen", _installed(root, "18.20.8", **kwargs)) is None, case
|
|
|
|
|
|
|
|
|
|
silent = tmp_path / "silent"
|
|
|
|
|
silent.mkdir()
|
|
|
|
|
path = _installed(silent, "18.20.8")
|
|
|
|
|
(silent / "node" / "bin" / "node").write_text("#!/bin/sh\necho not-a-version\n", encoding="utf-8")
|
|
|
|
|
assert node_too_old("qwen", path) is None, "a node that does not answer with a version"
|
|
|
|
|
|
|
|
|
|
assert node_too_old("qwen", "/nonexistent") is None, "no agent on PATH"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_what_cannot_be_read_names_nothing(tmp_path: Path) -> None:
|
|
|
|
|
"""An unreadable script, a native binary, a node that will not start: each leaves Node.js unnamed."""
|
|
|
|
|
unreadable = tmp_path / "unreadable"
|
|
|
|
|
unreadable.mkdir()
|
|
|
|
|
path = _installed(unreadable, "18.20.8")
|
|
|
|
|
(unreadable / "lib" / "node_modules" / "@qwen-code" / "qwen-code" / "cli-entry.js").chmod(0o111)
|
|
|
|
|
assert node_too_old("qwen", path) is None, "a script it may run but not read"
|
|
|
|
|
|
|
|
|
|
native = tmp_path / "native"
|
|
|
|
|
native.mkdir()
|
|
|
|
|
path = _installed(native, "18.20.8")
|
|
|
|
|
(native / "lib" / "node_modules" / "@qwen-code" / "qwen-code" / "cli-entry.js").write_bytes(b"\xcf\xfa\xed\xfe")
|
|
|
|
|
assert node_too_old("qwen", path) is None, "a native binary has no interpreter to name"
|
|
|
|
|
|
|
|
|
|
gone = tmp_path / "gone"
|
|
|
|
|
gone.mkdir()
|
|
|
|
|
path = _installed(gone, "22.1.0", shebang=f"#!{gone / 'no' / 'node'}")
|
|
|
|
|
assert node_too_old("qwen", path) is None, "a shebang naming a node that is not there"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_the_floor_is_the_nearest_manifest_s_and_only_one_that_reads(tmp_path: Path) -> None:
|
|
|
|
|
package = tmp_path / "pkg"
|
|
|
|
|
(package / "dist").mkdir(parents=True)
|
|
|
|
|
(package / "package.json").write_text('{"engines": {"node": ">=20.19.1"}}', encoding="utf-8")
|
|
|
|
|
assert _declared_floor(str(package / "dist" / "cli.js")) == (20, 19, 1), "one level up from a dist/ entry"
|
|
|
|
|
assert _short((20, 19, 1)) == "20.19.1"
|
|
|
|
|
|
|
|
|
|
broken = tmp_path / "broken"
|
|
|
|
|
broken.mkdir()
|
|
|
|
|
(broken / "package.json").write_text("{not json", encoding="utf-8")
|
|
|
|
|
assert _declared_floor(str(broken / "cli.js")) is None
|
|
|
|
|
|
|
|
|
|
assert _declared_floor(str(tmp_path / "a" / "b" / "c" / "d" / "e" / "cli.js")) is None, "no manifest near it"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_a_launch_command_that_does_not_parse_names_nothing() -> None:
|
|
|
|
|
from types import SimpleNamespace
|
|
|
|
|
|
|
|
|
|
from raven.agent.subagent import probe as probe_mod
|
|
|
|
|
|
|
|
|
|
for command in ('qwen "--acp', ""):
|
|
|
|
|
assert probe_mod._stale_node(SimpleNamespace(preset="qwen_code", command=command, env={})) is None, command
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_DIED = (
|
|
|
|
|
"acp agent 'Qwen Code': connection ended (exit 1); stderr tail: SyntaxError: The requested module "
|
|
|
|
|
"'node:fs' does not provide an export named 'openAsBlob'"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _qwen(path: str, preset: str = "qwen_code") -> object:
|
|
|
|
|
from types import SimpleNamespace
|
|
|
|
|
|
|
|
|
|
return SimpleNamespace(name="Qwen Code", preset=preset, kind="acp", command="qwen --acp", env={"PATH": path})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_a_launch_that_quit_on_an_old_node_is_named_with_both_versions(tmp_path: Path) -> None:
|
|
|
|
|
"""The fix is the Node.js, so the reader is told which one ran and which one is needed.
|
|
|
|
|
|
|
|
|
|
Only for a preset measured to die this way: the same exit from an agent
|
|
|
|
|
that does not run on Node.js stays a launch that quit.
|
|
|
|
|
"""
|
|
|
|
|
from raven.acp_client.protocol import AcpConnectionError
|
|
|
|
|
from raven.agent.subagent import probe as probe_mod
|
|
|
|
|
from raven.agent.subagent.probe_state import Remedy
|
|
|
|
|
|
|
|
|
|
path = _installed(tmp_path, "18.20.8")
|
|
|
|
|
text, remedy = probe_mod._ping_refusal(_qwen(path), AcpConnectionError(_DIED))
|
|
|
|
|
assert remedy == Remedy("runtime", None, needs="22", found="18.20.8")
|
|
|
|
|
assert "it needs Node.js 22 or newer and was launched with 18.20.8" in text
|
|
|
|
|
assert text.endswith(f"It said: {_DIED}"), "the agent's own words stay in the record"
|
|
|
|
|
|
|
|
|
|
assert probe_mod._ping_refusal(_qwen(path, preset="hermes"), AcpConnectionError(_DIED))[1] == Remedy("exited")
|
fix(agent): name grok login on a credential refusal (#792)
## Summary
A Grok Build row that fails for want of a credential was told to "sign
in to it and connect again", with no command. Claude Code, Codex, Hermes
and Qwen Code already name the command read from the installed tool.
`grok login --help` on Grok Build 1.0.41 titles that command "Sign in to
Grok", so a credential refusal now says to run `grok login`.
The row launches `grok agent stdio`, a local install, so there is one
spelling and no `npx` fallback. The binary is native, so a launch that
quits is not reported as an old Node.js. A provider status (404, 402,
429) still gets the shared verdict and no in-agent command: none was
measured that fixes a missing model, a missing credit and a rate limit
together.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
- `uv run --frozen --python 3.12 --extra dev ruff check
raven/agent/subagent/presets.py tests/test_subagent_third_party.py
tests/test_subagent_node_runtime.py` and `ruff format --check` on the
same files: clean.
- `uv run --frozen --python 3.12 --extra dev pytest -q
tests/test_subagent_third_party.py::test_grok_login_is_the_one_spelling
tests/test_subagent_third_party.py::test_each_agent_s_fix_is_named_as_data_from_the_one_decision
tests/test_subagent_third_party.py::test_a_row_with_one_spelling_is_not_offered_a_second
tests/test_subagent_node_runtime.py::test_a_launch_that_quit_on_an_old_node_is_named_with_both_versions`:
4 passed.
- Reverting `raven/agent/subagent/presets.py` to `origin/main` makes
`test_grok_login_is_the_one_spelling` fail with `KeyError: 'grok'`. The
Node.js test stays green.
- `python scripts/check_source_language.py origin/main...HEAD`: exit 0.
- `git merge-tree --write-tree HEAD origin/main`: clean. `git diff
--check origin/main...HEAD`: clean.
The full suite, the type checker and a live logged-out `grok agent
stdio` were not run.
- [x] Relevant tests pass locally
- [ ] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
No user-facing doc describes this refusal sentence. The page reads the
remedy the connect path already returns.
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
Only a credential-shaped refusal on the `grok` preset gains a command. A
hand-written row that is not that preset is unchanged. Billing, quota, a
missing model and a launch that quits keep the sentences they already
had.
Rollback: revert the squash commit. There is no migration.
## Related Issues
N/A
2026-09-26 10:06:37 +08:00
|
|
|
assert probe_mod._ping_refusal(_qwen(path, preset="grok"), AcpConnectionError(_DIED))[1] == Remedy("exited")
|
fix(*): a Qwen Code on an old Node.js names it, and its model fix runs /auth (#786)
## Summary
Qwen Code is a Node.js script (`#!/usr/bin/env node`), so it runs on
whichever `node` comes first on the PATH it is launched with, not the
one it was installed with. On a machine whose PATH puts an older Node.js
first (an nvm default left on 18, a Homebrew formula nobody upgraded), a
Connect or Test used to end in "Qwen Code quit as soon as it started",
with the reason folded under it as English that names no Node.js at all.
Measured on Qwen Code 0.24.4 with official Node.js builds:
| Node.js on PATH | What qwen does | What the sheet says now |
| --- | --- | --- |
| 18.20.8 | Exits 1 at import: `SyntaxError: The requested module
'node:fs' does not provide an export named 'openAsBlob'` | It needs
Node.js 22 or newer and this machine started it with 18.20.8, plus the
upgrade command when the installer is recognisable |
| 20.20.2 | Runs | Connects, as before |
| 22 | Runs | Connects, as before |
The verdict is read off facts, not off that sentence, which changes with
every release and names no version anyway:
- `raven/agent/subagent/node_runtime.py` (new): resolves the interpreter
from the agent's shebang the way `env` would, on the launch's own PATH
(the row's, else the login shell's), runs `node --version`, and reads
the floor from the agent's own `package.json` `engines.node` (`>=22.0.0`
for qwen). Any missing fact means no verdict, so Node.js is never named
on a guess. The upgrade command is given only where the installer shows
in the path: `nvm install 22 && nvm alias default 22` under
`~/.nvm/versions/node/`, `brew upgrade node` under `Cellar/node/`;
anything else (a pinned `node@18`, an installer package) gets nodejs.org
and no command.
- `presets.py`: `NODE_RUNTIME_PRESETS` holds the presets measured to die
this way, Qwen Code only.
- `probe.py`: a launch that quit is checked only for such a preset, and
only after the `--acp` check; the check runs `node --version`, so
Connect and Test reach it through `asyncio.to_thread`.
- `probe_state.py`, `rpc/models.py`, `rpc-schema/openrpc.json`:
`SubagentRemedy.kind` gains `runtime`, with optional `needs` and `found`
(both sent for `runtime`). Both generated clients were regenerated.
- ui-web: the sheet says both versions and shows the upgrade command on
its own line, or points at nodejs.org when there is none; a `runtime`
remedy that arrives without its versions reads as a launch that quit.
The card says "Qwen Code's Node.js is too old". zh/en strings in
`i18n/messages.json`. The offline fixture library keeps its Qwen Code
row on the two-step model fix, so `needs` and `found` join `UNSENT` with
the reason.
Why the stderr sentence is not the trigger: Raven keeps the last 400
characters of stderr in the error it reports, and the `SyntaxError` line
sits 642 characters from the end of qwen's output, so the Test path
never sees it.
Also in this PR: the fix for a model its provider no longer serves
(404), no credit (402) and a rate limit or spent quota (429) now says
`/auth`, not `/model`. `/model` only picks among the models already
registered in `~/.qwen/settings.json`, and qwen 0.24.4's own OpenRouter
preset registers exactly two free models, both since withdrawn from
OpenRouter's free tier (each answers 404 "unavailable for free",
measured 2026-09-24). So anyone set up the default way was sent to a
list offering only dead models. `/auth` re-runs the provider setup,
whose "Model IDs" step takes any id the provider serves; the sheet's
three sentences now say to enter a working model at that step
(`MODEL_SWITCH_HINTS` in `presets.py`, `gui.agent.fix_model` /
`fix_billing` / `fix_quota`).
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
- `python -m pytest --idle-ceiling-strict` over every test file that
touches sub-agents, the ACP client or the RPC layer: 6423 passed, 1
failed. The failure is
`tests/test_rpc_files.py::test_a_host_without_libreoffice_says_so`,
which fails the same way on `main` on this machine.
- `tests/test_subagent_node_runtime.py` (new, 13 tests): the verdict,
the installer-specific commands, the floor as declared, an absolute
shebang, every missing fact, Connect through the thread, and Test.
Removing the classification call in `probe.py` fails the three
Connect/Test tests.
- `ruff check raven tests` and `ruff format --check raven tests`: clean.
- `python scripts/coverage_gate.py --coverage-json coverage.json diff
--base-ref origin/main --threshold 90`: 100.00% (120/120 executable
changed lines).
- ui-web: `npm run type-check` clean; `npm run lint` 0 errors (4
existing warnings in files this does not touch); `npm run gen:check` in
sync; `npx vitest run` 3035 passed.
- ui-tui: `npm run lint:rpc` and `npm run lint:i18n` in sync.
- Live, real Qwen Code 0.24.4 through `ping_agent` and `run_test`, with
official Node.js 18.20.8, 20.20.2 and 22 first on the launch PATH: 18
gets `runtime` (needs 22, found 18.20.8) on both buttons within a
second; 20 and 22 connect. The 20 Qwen Code cases from #779 were re-run
and give the same results as before, except that the model and billing
cases now name `/auth`.
- The rendered sheet was checked in a browser against the offline
fixture library, zh, both with and without an upgrade command.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
No user-facing doc describes these refusal messages; the new sentences
live in `i18n/messages.json`.
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
The check runs `node --version` on the resolved interpreter, only after
a Qwen Code launch has already quit, and with a 5 s bound, off the event
loop. Nothing is read or sent beyond the agent's own `package.json`.
`runtime`, `needs` and `found` are additive. A page that predates them
drops a kind it does not know and shows its generic "could not connect"
text; a stored verdict carrying them reads back as no remedy on older
code.
Rollback: revert the squash commit; there is no migration.
## Related Issues
N/A
Co-authored-by: Claude (claude-opus-5-5) <noreply@anthropic.com>
2026-09-24 18:36:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_a_launch_that_quit_on_a_new_enough_node_is_only_an_exit(tmp_path: Path) -> None:
|
|
|
|
|
from raven.acp_client.protocol import AcpConnectionError
|
|
|
|
|
from raven.agent.subagent import probe as probe_mod
|
|
|
|
|
from raven.agent.subagent.probe_state import Remedy
|
|
|
|
|
|
|
|
|
|
path = _installed(tmp_path, "22.1.0")
|
|
|
|
|
assert probe_mod._ping_refusal(_qwen(path), AcpConnectionError(_DIED))[1] == Remedy("exited")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def test_the_connect_names_an_old_node_off_the_event_loop(tmp_path: Path, monkeypatch) -> None:
|
|
|
|
|
"""The check runs `node --version`, so the connect reaches it through a thread."""
|
|
|
|
|
from raven.acp_client.protocol import AcpConnectionError
|
|
|
|
|
from raven.agent.subagent import probe as probe_mod
|
|
|
|
|
from raven.agent.subagent.probe_state import Remedy
|
|
|
|
|
|
|
|
|
|
def _died(*args: object, **kwargs: object) -> object:
|
|
|
|
|
raise AcpConnectionError(_DIED)
|
|
|
|
|
|
|
|
|
|
monkeypatch.setattr(probe_mod, "build_third_party_backend", _died)
|
|
|
|
|
result = await probe_mod.ping_agent(_qwen(_installed(tmp_path, "18.20.8")))
|
|
|
|
|
assert result.remedy == Remedy("runtime", None, needs="22", found="18.20.8")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def test_the_test_button_names_an_old_node_the_way_the_connect_does(tmp_path: Path, monkeypatch) -> None:
|
|
|
|
|
"""Test fails on the handshake first; that verdict is read by the same rule as the connect's."""
|
|
|
|
|
from types import SimpleNamespace
|
|
|
|
|
|
|
|
|
|
from raven.agent.subagent import probe as probe_mod
|
|
|
|
|
from raven.agent.subagent.probe_state import Remedy
|
|
|
|
|
|
|
|
|
|
async def _refused(cfg: object) -> object:
|
|
|
|
|
detail = f"handshake failed: {_DIED}; stderr: at async ModuleJob.run"
|
|
|
|
|
return SimpleNamespace(usable=False, needs_auth=False, unfetched=False, detail=detail, available_models=[])
|
|
|
|
|
|
|
|
|
|
monkeypatch.setattr(probe_mod, "record_capabilities", _refused)
|
|
|
|
|
result = await probe_mod.run_test(_qwen(_installed(tmp_path, "18.20.8")), source="config")
|
|
|
|
|
assert not result.ok
|
|
|
|
|
assert result.remedy == Remedy("runtime", None, needs="22", found="18.20.8")
|