## Summary
rich caches a Style's rendered ANSI on the object
`Style.parse`/`Style._add` return (both `lru_cache`'d), and never
re-renders it for a different `color_system` once that happens once. The
dark accent+bold combo `test_bold_accent_renders_styled_not_bare` checks
is the same style `_ThemedConsole` and a couple of other tests in this
file print through consoles that don't pin `color_system="truecolor"`,
so whichever one hits it first under xdist's scheduling decides the ANSI
bytes for every truecolor render after it, including this test's.
`_reset_theme_cache` now clears `Style.parse` and `Style._add`'s caches
along with its existing reset, before and after each test in the file.
Added `test_bold_accent_survives_a_downgraded_render_elsewhere` right
before the assertion test: it renders the same markup through a
256-color console first, which reproduces the failure on main and passes
once the caches are cleared between tests.
## Type
- [ ] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [x] Other (test-only deflake, no production code touched)
## Verification
```
uv run --frozen --all-extras pytest -n 0 \
tests/test_cli_theme.py::test_bold_accent_survives_a_downgraded_render_elsewhere \
tests/test_cli_theme.py::test_bold_accent_renders_styled_not_bare -v
2 passed (the second one fails on main with only the fixture hunk reverted, same command)
uv run --frozen --all-extras pytest tests/test_cli_theme.py
54 passed, both under -n 0 and the default -n 4
make lint-python
clean
```
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
## Risk
- [x] Security impact considered: test-only change, no production code
touched.
- [x] Backward compatibility considered: no shipped behavior changes
either way.
- [x] Rollback path is clear for risky changes: revert restores the
status quo, including the flake.
## Related Issues
Fixes#339
## Summary
Retires the built-in `deep_research` tool: the MiroThinker HTTP tool,
its
unconfigured stand-in of the same name, the async channel manager, the
`raven deep-research` command group, `tools.deepResearch` /
`DeepResearchToolConfig`, the loop's registration / mid-session
promotion /
broker and submit wiring, the `inline_tool_stream` flag (its only
consumer
was the tool's stream callback) and the `delivered_sink` plumbing from
#705
(its only writer was that callback). The WebUI settings page loses the
row
and its MiroThinker key panel, the ACP command menu loses
`deep-research`,
and the three transcript i18n keys go (readers fall back to the raw
name).
Research keeps two surfaces: the Raven-Research agent and the
MiroThinker
sub-agent preset; neither shared code with the tool.
`TurnRequest.deliver_text`
stays as a spine contract with its own tests, although nothing in-tree
produces it any more; the comments that used deep research as its
example
now name the sub-agent relay.
Config: a load-time migration (floor 10) drops `tools.deepResearch` /
`tools.deep_research`, one notice per spelling it finds, silent and
idempotent when nothing changes (it
re-runs on every load for configs parked by the research rename, and
`load_raven_config` calls it a third time without writing the stamp). A
`deep_research` entry in `tools.disabledTools` is left as written: that
list
is the general name denylist and a plugin tool may carry the name
(plugin
tools register last so one can shadow a built-in), so dropping the entry
would put such a tool back on offer. The first revision stripped it; the
review caught that and the strip is gone.
Kept on purpose (see the grep gate below): the MiroThinker sub-agent
preset
and its fixtures, `agents/raven-research/**`, the four trajectory
cassettes
that recorded the tool's schema (the replay serves the recording's own
tool
list), `benchmarks/skill_evals/queries.jsonl`, and the frozen
vendored-fork
fixtures, and the `deep_research` deny rows in the five
`agents/*/config.json`
files (the same denylist argument as the migration; the launcher parity
tests
are unchanged).
## Type
- [ ] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [x] Refactor
- [ ] Other
## Verification
- `uv run ruff check raven/ tests/` and `uv run ruff format --check
raven/ tests/`: clean.
- `uv run pytest -q` (whole suite, with coverage, at the rebased head):
25840 passed, 109 skipped; `python scripts/coverage_gate.py ratchet
--tolerance 0.05`: line 90.10% vs baseline 87.30%, branch 83.73% vs
79.43%, passed.
- `uv run pytest tests/test_config_loader.py
tests/test_config_update_tools.py tests/test_agent_loop_run_emit.py
tests/test_cli_one_shot_spine.py tests/test_rpc_bootstrap.py
tests/test_rpc_spine.py tests/test_rpc_turn_send.py
tests/test_turn_wire_shape_conformance.py tests/test_core_cron_stack.py
tests/test_cli_gateway_commands.py tests/test_cli_smoke.py
tests/test_acp_methods.py tests/test_rpc_console.py
tests/test_tool_registry_timeout.py tests/test_question_broker.py
tests/test_provider_auth_method.py tests/test_agents_ppt_launcher.py
tests/test_agents_design_launcher.py
tests/test_agents_research_launcher.py tests/test_tool_capabilities.py
tests/test_l4_entrances.py tests/test_settings_tool_groups.py
tests/test_trajectory_regressions.py tests/test_living_docs.py
tests/test_cli_onboard_commands.py tests/test_cli_theme.py -q`: 1500
passed.
- Mutation check on the migration: with the `_migrate_config` dispatch
neutered, three of the four new `tests/test_config_loader.py` cases
fail; with the `_persist_migrations` dispatch neutered,
`test_the_deep_research_section_also_leaves_the_file_on_disk` fails;
with the pre-review stripping behaviour restored, all four fail.
Restored: 74 passed.
- `npm test --prefix ui-web` (208 files, 2884 tests), `npm run lint
--prefix ui-web`, `npm run type-check --prefix ui-web`, `npm run
gen:check --prefix ui-web`: pass.
- `npm run lint:i18n --prefix ui-tui`, `npm run type-check --prefix
ui-tui`, `npm test --prefix ui-tui` (144 files, 2106 tests): pass;
`messages.generated.ts` regenerated with `npm run gen:i18n`.
- Grep gate: `grep -rniE 'deep[ _-]?research' .` (excluding
node_modules, .venv, dist) hits only the kept surfaces listed above plus
CHANGELOG history.
- Real machine, isolated `RAVEN_HOME` whose config carried
`tools.deepResearch` and `disabledTools: ["deep_research", "exec"]` with
a version-9 stamp: `raven agent -m "..."` printed the `Config updated:`
notice for `tools.deepResearch` once, answered, and left the file
without that section, `disabledTools` unchanged (`["deep_research",
"exec"]`), stamp 10; `raven deep-research` answers `No such command`;
the served WebUI (`raven serve`) Settings > Tools page lists 36 rows
with no `deep_research` and `exec` still off, and `ext.list` carries no
`deep_research`.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] User-facing docs or screenshots are updated when needed
## Risk
- User-visible: the `deep_research` tool, the settings row and `raven
deep-research` are gone; a config that still carries the section loses
it once at load with a notice; a `deep_research` entry in
`tools.disabledTools` stays as written. Reports the tool wrote under
`<workspace>/deep_research/` stay on disk. Archived transcripts that
recorded a `deep_research` call replay with the generic icon and the raw
tool name instead of the `researched` verb.
- Coverage: the two deleted modules were well covered, but the live
totals sit several points above the committed baseline, so the ratchet
passes with room to spare (measured locally, see Verification).
- Rollback: revert the PR; the migration is additive on the stamp, so a
reverted build reads a migrated config unchanged (the section it would
have read is simply absent).
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
#156 (its deep-research half no longer applies; tracing half unaffected)
---------
Co-authored-by: Claude (claude-fable-5-1) <noreply@anthropic.com>
Eleven commits from the GitHub trunk since 377a1da14, fifteen files
conflicting. How each was resolved:
- raven/tracing/context.py, trace.py, spans.py and tests/test_tracing_api.py:
upstream retired the runtime attempt id. attempt.id is now a reserved span
attribute and attempts.json owns the grouping, so begin_attempt,
end_attempt, current_attempt and every attempt_id parameter go with it.
Nothing on this side called them outside tests. The fork's surface field
and its use() helper share those hunks and stay.
- raven/trajectory/store.py: upstream's module docstring documents
attempts.json and is a superset of ours.
- raven/cli/onboard_everos.py and tests/test_cli_onboard_commands.py:
upstream only refreshed three model ids, which this side already carries.
Kept our English-only role table (AGENTS.md 1.3).
- tests/test_everos_server.py: took upstream's inotify-gate tests and pointed
them at raven_everos.server, where this side moved the module.
- ui-tui/src/app/useMainApp.ts: copy-on-select was never wired up here;
upstream wires it.
- ui-tui/src/components/appLayout.tsx: took upstream's copy notice line only.
Its FloatingOverlays hunk would render that component twice, because this
side had already moved it into its own anchor box.
- README.md and README.zh-CN.md: upstream's wording under this side's emoji
headings. The zh benchmark table had to be rebuilt: its separator row
auto-merged with the prerequisites table's and dropped the data rows.
- tests/test_provider_rates.py and tests/test_trajectory_bundle.py: both
sides appended independent tests at the end of the file; kept both.
Co-authored-by: Claude (claude-opus-5) <noreply@anthropic.com>
## Summary
Reported as "deliver_files is broken". It is not: **the tool never ran.**
Every `deliver_files` call on one install was refused before dispatch -- five in a row in a single session -- and nothing was ever delivered:
```
Error: Invalid parameters for tool 'deliver_files': files should be array
```
What the model sent was the array, spelled as a string:
```json
{"files": "[{\"path\": \"...poster.png\", \"title\": \"...\"}]", "message": "..."}
```
`cast_params` already forgives that spelling for every scalar type -- `"3"` for an integer, `"true"` for a boolean -- and did not for arrays or objects, which are exactly the types a model is most likely to stringify.
## Type
- [x] Fix
- [ ] Feature
## The edge of the forgiving is the design
When the value is a string, try `json.loads`, and take the result **only if it is the type the schema asked for**. A string that is not JSON, or is JSON of the wrong shape, is returned unchanged so the validator still names the real problem -- the point is to widen what is accepted, not to swallow a type error.
**Nothing here can raise.** Turning "your argument has the wrong type" into a traceback would be worse than the refusal it replaces, so the parse is wrapped and failure falls through.
**A `type: "string"` field is never parsed.** JSON is ordinary text in a message body or a file's content, and replacing it would hand the tool something it never asked for. Two independent things prevent it today (the string branch returns before the parse is reached, and the parse only wins on a type match), which is why the case pinning it is a tripwire rather than a load-bearing assertion -- said so in its own docstring rather than left to look like coverage.
## Not just deliver_files
Six built-in tools declare an array or object parameter and were all exposed:
| tool | parameter |
|---|---|
| `deliver_files` | `files` |
| `ask_user` | `questions` |
| `image_generate` | `images` |
| `message` | `media` |
| `create_playbook` | `skills` |
| `video_generate` | `params` |
The same failure was already seen from the other side: `acp_client/acp_agent.py` records `update_task_state` and `operations should be array` from a real dispatch.
## Verification
```
make lint-python ruff check + ruff format --check, 1850 files
make lint-imports 9 contracts kept, 0 broken
pytest tests/ 19,699 passed, 7 failed (all pre-existing, see below)
```
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots -- no user-facing string
**End to end, through the real tool**, with the exact payload that failed five times in production:
```
files sent as: str -> [{"path": ".../poster.png", "title": "..."}]
returned: Delivered 1 file(s): poster.png (72 B).
still "should be array": False
registered in the store: True
```
Twelve cases, five mutations, each killing at least one:
| mutation | red |
|---|---|
| drop the whole branch (the old behaviour) | 3 |
| raise instead of falling through on a parse failure | 5 |
| accept the parse whatever type it yielded | 1 |
| do not re-cast the parsed value, so items are not cast | 1 |
| widen the tuple to include `string` | **survived -- unreachable** |
The last is worth stating rather than hiding: that mutation cannot change behaviour, because the `type == "string"` branch returns earlier and the type check would refuse the result anyway. I also tried moving the new block above that branch, alone and combined with widening the tuple, and neither reddens anything either. The invariant holds by construction; the case that documents it says so.
**Pre-existing failures, checked against the base.** 7 failed in the full run, all in `tests/test_security_network.py` (`test_a_redirect_to_a_dangerous_address_is_refused` and siblings). Running that file alone on this same tree gives 4 -- the count is order-dependent -- and the change touches only `raven/agent/tools/params.py` plus a new test file, neither of which `raven/security/network.py` imports. The failures are the box's resolver: it returns poisoned answers roughly half the time, which I measured separately (`en.wikipedia.org` came back as `2001::1` on 3 of 6 lookups). Not introduced here, and worth someone's attention on its own.
## Risk
- [x] Security impact considered -- widens what reaches a tool's own validation, not what bypasses it. A parsed value is still validated against the same schema, and a parse that yields the wrong type is refused exactly as before
- [x] Backward compatibility considered -- a call that worked before takes the identical path; the new branch is reached only by a `str` where an array or object is declared, which previously always failed
- [x] Rollback path is clear -- single-commit revert
## Related Issues
N/A
## Swept
`mr-review-patterns` pre-submit sweep, over `git diff origin/main...HEAD`.
- **1 (a write location moved)** -- nothing moved; a branch was added to an existing dispatch on `target_type`. Grepped every caller of `cast_params`: the registry is the only one, and it runs `validate_params` right after, which is the reader this affects.
- **2 (a value with several entry points)** -- the cast is the single funnel every tool argument passes through, which is why the fix belongs here and not in `deliver_files`.
- **3 (a guard)** -- checked both directions: what it wrongly lets through (JSON of the wrong type, non-JSON text -- both refused, with cases) and what it wrongly refuses (a real list, unaffected, with a case).
- **4 (tests)** -- five mutations above, one honestly reported as unreachable. Failing-ID sets diffed against the base rather than counts.
- **6 (stale text)** -- the module docstring enumerated what is coerced ("a string that should be an integer"); it now names arrays and objects too. Grepped the tracked tree for other statements of the rule: none.
- **9 (error handling)** -- the new path adds one way to end and it is caught: `json.loads` raises `ValueError` on bad text and `TypeError` on a non-string, and both fall through to the untouched value.
- **11** -- `git ls-files | grep -c node_modules` is 0; the commit-message gate was run, not eyeballed.
Not applicable, with reasons: **3b, 3c, 3d, 3e** (no tool schema produced, no state moved, one lane, no assertion lost its symbol); **4b, 4c, 4d** (no platform branch, no shell, no rendered number); **5, 5b** (no dependency; `json` is stdlib and already imported across this package); **6b, 6c** (no backup, no generated artifact); **7, 7b** (nothing on disk); **8** (no asset, no secret); **10** (no prompt text).
## Deliberately not fixed
The error text still ends with `[Analyze the error above and try a different approach.]`, and the model plainly did not -- it sent the same shape five times. A message naming the expected spelling (`files must be a JSON array, not a string containing one`) would give it something to act on. That is a change to the registry's error surface, affects every tool, and deserves its own argument.
## Moved from !594
Opened on a compliant source branch. AGENTS.md 2.1 asks for a 3-5 word snake_case description and the previous branch had seven; GitLab cannot change an existing merge request's source branch, so the change moves rather than the name.
Same commits, rebased onto `c2a9768f`. Both code findings from the review on !594 are already in them -- `RecursionError` caught with its regression case, and the implementation comment reduced to the two non-obvious reasons. Nothing else changed, so that review carries.
## Summary
Overhaul the interactive `raven trajectory` browser end to end, fixing
every
issue from real-terminal testing:
- Navigation: every screen opens with a help area under its title (page
purpose plus "[Key] function" hotkey hints, rendered in a new readable
help color). Esc walks one level up (action -> attempt -> session); on
the
top-level session screen Esc stays put and quitting is Ctrl+C only,
which
prints a single exit notice. Esc inside a running action cancels just
that
action through a dedicated exception at the action boundary, so the back
sentinel can never reach a conversion or the data layer; a cancelled
report keeps its pre-confirm bundle-and-pin side effects (the existing
declined-report contract). Back/Exit menu entries are gone; answered
prompts erase themselves and navigation is echoed as breadcrumb lines
with markup-escaped untrusted text.
- Tables: the session list is TITLE | ATTEMPTS | LAST ACTIVITY and the
attempt list is # | STARTED | TURNS | SPANS | VERDICT | PIN | MERGED |
PREVIEW with green check cells. Time cells keep the year. The layout is
budgeted per screen build from the live terminal width (row indent, a
safety margin, and inter-column gaps are all part of the math); PREVIEW
drops as a whole column when it no longer fits, and below the dynamic
minimum width the tightest layout is kept while the renderer clips
overlong lines at the terminal edge. Every dynamic cell passes a
single-line sanitization gate before width math (verdict sidecars only
guarantee a non-empty string), cells are measured and truncated by
terminal display width (CJK is 2 cells), and fixed column widths always
fit their headers.
- Space preview: Space on an attempt row prints that attempt's per-turn
input/output previews, collected in the same snapshot scan and sorted by
a fully-stringified key so ordering never follows log source order (the
table PREVIEW cell derives from the same sorted collection). Any key,
arrow keys included, returns with the cursor kept on the row; the waiter
passes the terminal's CPR reply through to the renderer instead of
treating it as a keypress, and Ctrl+C keeps the browser-wide cancel.
- Merge hotkey: with two or more attempts, m/M opens the multi-select
merge
(advertised in the help line; the old "Merge attempts" menu entry is
gone). The checkbox screen carries its own help line for toggle,
confirm,
and cancel. A single attempt neither binds nor advertises the key.
- Theme and feel: new success (green check) and help (readable hint
text)
colors in both palettes, all WCAG AA on their backgrounds; a lone ESC is
flushed after 50ms instead of prompt_toolkit's 0.5s default, removing
the
laggy Esc feel.
The data layer is untouched: changes are confined to
raven/cli/trajectory_browse.py, raven/cli/_theme.py, and their tests.
The
id-taking subcommands (raven trajectory save/list/...) behave as before.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
- `COLORTERM=truecolor uv run pytest tests/test_cli_theme.py
tests/test_cli_trajectory_browse.py
tests/test_cli_trajectory_commands.py -q` -> 220 passed
- `COLORTERM=truecolor uv run pytest tests/ --ignore=tests/integration
-q` -> 6917 passed; the 10 failed + 20 errors are the pre-existing
environment-dependent set, identical file-by-file on a clean main
checkout (cron, everos server, config loader, tracing viewer)
- `uv run ruff check` and `uv run ruff format --check` on the four
touched files -> clean
- PTY smoke on a CPR-answering pseudo terminal at 100 and 58 columns:
full flow (preview, merge cancel, action screen, staged Esc backout,
Ctrl+C quit) and the narrow-width degradation contract
- New coverage includes real pipe-input key-binding tests (Esc on all
four prompt kinds, Space/m/M hits, waiter key paths with CPR
pass-through), table budget/clipping boundaries at the computed minimum
width, and corrupt verdict/timestamp corpora
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] User-facing docs or screenshots are updated when needed
## Risk
- The interactive browser's look and key protocol change wholesale (that
is
the point of this PR): Esc no longer quits from the top level (Ctrl+C
does), Back/Exit entries are gone, and lists render as tables. The
machine-facing subcommands and the trajectory data layer are untouched.
- Rollback: revert the squash commit; the browser returns to the
previous
interaction wholesale, no data migration involved.
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
N/A
---------
Co-authored-by: 江国庆 <guoqingjiang@deepglint.com>
Co-authored-by: Claude (claude-fable-5) <noreply@anthropic.com>
## What
Adds a `RAVEN_WHEEL_SLIM=1` build switch to `hatch_build.py`: when set, the wheel build skips the vendored sub-agent tree and the prebuilt TUI/web bundle inclusion. Default builds are byte-identical to before.
## Why
The release wheel is ~106 MiB compressed; ~94% is the `subagents/` snapshots (raven-ppt alone carries 74 MiB of `.pptx` templates and fonts) plus UI bundles. A cloud provisioner that only ever runs `raven acp` inside a sandbox uploads all of that per instance for assets nothing there opens. The slim wheel is ~3.0 MiB with the full python package intact, cutting sandbox provisioning upload from 15-23s to under a second.
## Behavior on slim installs
- Sub-agents: absent by design; onboarding step 5 reports no tree (headless installs never reach it). Their own distribution channel is future work.
- `raven tui` / `raven serve`: fall back to the source-checkout resolvers exactly as a dev build without prebuilt bundles does today; headless installs never call them.
## Verified
- `RAVEN_WHEEL_SLIM=1 uv build --wheel` -> 3.0 MiB wheel, 734 files, `raven/acp` complete, no `raven/subagents` or UI dist entries.
- The slim wheel provisioned a real E2B-compatible sandbox and served a full `raven acp` session end to end (delegated task with shell execution, ask_user elicitation round trip, multi-turn session continuity).
- Default build without the variable is unchanged.
## What
Adds a `RAVEN_WHEEL_SLIM=1` build switch to `hatch_build.py`: when set, the wheel build skips the vendored sub-agent tree and the prebuilt TUI/web bundle inclusion. Default builds are byte-identical to before.
## Why
The release wheel is ~106 MiB compressed; ~94% is the `subagents/` snapshots (raven-ppt alone carries 74 MiB of `.pptx` templates and fonts) plus UI bundles. A cloud provisioner that only ever runs `raven acp` inside a sandbox uploads all of that per instance for assets nothing there opens. The slim wheel is ~3.0 MiB with the full python package intact, cutting sandbox provisioning upload from 15-23s to under a second.
## Behavior on slim installs
- Sub-agents: absent by design; onboarding step 5 reports no tree (headless installs never reach it). Their own distribution channel is future work.
- `raven tui` / `raven serve`: fall back to the source-checkout resolvers exactly as a dev build without prebuilt bundles does today; headless installs never call them.
## Verified
- `RAVEN_WHEEL_SLIM=1 uv build --wheel` -> 3.0 MiB wheel, 734 files, `raven/acp` complete, no `raven/subagents` or UI dist entries.
- The slim wheel provisioned a real E2B-compatible sandbox and served a full `raven acp` session end to end (delegated task with shell execution, ask_user elicitation round trip, multi-turn session continuity).
- Default build without the variable is unchanged.
Three folds the audit caught as cargo still deriving in entrance hands.
The provider pool expression was byte-identical at all four
build_runtime call sites and moves into the door as its default. The
gateway hand-built the deliverable store with the exact expression the
door already defaults, solely to keep a handle for the web surface --
it now takes the handle back through RavenRuntime.deliverables, the
parity LEDGER entry that declared the asymmetry retires, and the
shared-core floor recalibrates to the nine kwargs genuinely left in
entrance hands. A dead twelve-channel constant goes too.
`raven channels login` was the one spec.factory call site handing the
adapter a raw socket instead of the dispensed view, so declared
defaults never materialized on the login path; it now walks the same
admission door as the gateway and onboarding.
The onboarding wizard's four modules formed the repo's only genuine
module-level sibling import cycle, held together by the partial-import
fallback: channels/everos/web reached back into onboard_commands for
the shared kit. The kit -- console, language state, prompt chrome and
primitives -- moves to _onboard_shared, the satellites import
downward, and onboard_commands re-exports the names its tests and
callers already use (language now updates through set_lang, since a
re-imported string binding would freeze). The shape-coupled tests
retarget the definition site; the upgrade command gains the module
docstring it was missing.
Co-authored-by: Claude (claude-fable-5) <noreply@anthropic.com>
## Summary
Found while investigating the first row of Dizhan's `子智能体功能与显示问题` doc (*回注内容过程中未正常显示,刷新后才会正常显示*). This is not that bug's fix, but it is a real defect on the same wire, and it is the one that explains why "前后端接线没有约定好" was a fair thing to say.
**`turn.started` is not in the `TurnEvent` union — on either side.** It has a schema component, it has a Pydantic model, and neither is reachable from the union that `tests/test_rpc_schema_match.py` walks. The 290-test contract guard has never looked at this event.
So it drifted the first time anyone touched it. `05957452` (judge a dag node) taught `announce_dag_exception` to emit:
```python
mark = {"kind": "dag", "label": run_id, "status": "exception", "run_id": run_id, "node_id": node_id}
```
while `TurnStartedEvent.payload.delegated` still declared `status: enum ["ok","error"]` with `additionalProperties: false`, and `TurnStartedPayload` had **no `delegated` field at all** under `extra="forbid"`. Verified with `jsonschema` against the published contract before changing anything:
```
Additional properties are not allowed ('node_id' was unexpected)
```
That commit did carry `exception` into `TranscriptDelegated` and `SubagentDeliveredEvent` — two of the three places this status lives. The third is the one no test covers.
**It does not crash today**, and I want to be exact about that: `SubscriptionEmitter.emit` pushes a raw dict with no validation, and the page reads only the fields it knows. But the contract test's own docstring says what the cost is — *"both sides declare `additionalProperties: false` / `extra="forbid"`, so a consumer validating against the schema rejects the whole event, not just the unknown field"*. Losing this event loses the boundary that advances the workspace turn counter and draws the delegated row.
## What this does
- `TurnStartedEvent` joins the `TurnEvent` union, in `openrpc.json` and in `raven/rpc/models.py`, so the existing sweep covers it from now on.
- The schema's `delegated.status` gains `exception`; `node_id` is declared.
- `TurnStartedPayload` gains `delegated` as a typed model (`TurnStartedDelegated`), three-valued status included.
- Both generated TypeScript clients regenerated.
- A new test drives **the exact marker `manager.py` builds** through both validators, so the next status or field fails here instead of in a client nobody is watching.
## One thing the union surfaced
`ui-tui` never handled `turn.started`. Its exhaustiveness check said so the moment the variant existed. It draws the delegated row from `subagent.delivered`, which the page deliberately ignores in favour of this event — the two mark different moments: **submitted** versus **started**.
Left as it is, with an explicit `case 'turn.started'` saying why. Moving that surface onto the truer moment changes when the TUI draws the row, which is a product change, not a contract fix.
## Verification
- New test red before the fix, by construction: adding the variant to the union alone reds `test_schema_match_turn_event_discriminated_union` and `..._payload_fields` (schema/pydantic drift), which is how the gap was proved.
- Mutation checks, each reverting one thing:
| reverted | reds |
|---|---|
| `exception` out of the schema enum | 1 |
| `node_id` out of the schema | 1 |
| `delegated` off the Pydantic payload | 2 |
- `uv run pytest -q` — **12900 passed**, 50 skipped, 5 failed; the same five pre-existing on `origin/main` (four `test_security_network.py` NAT64 cases, one `test_doctor_answers_where_the_memories_are`), reproduced on an untouched merge-base worktree.
- `uv run ruff check` / `ruff format --check` on `raven tests scripts` — both clean (both halves of `make lint-python`).
- `ui`: `gen:check` 147 methods, `type-check` clean, `npx vitest run` 89 files / **1225 passed**.
- `ui-tui`: `type-check` clean, `lint:rpc` in sync, `lint:i18n` up to date, `npm test` 138 files / **1990 passed**.
- Worth recording: with `ui-tui/node_modules` symlinked from another checkout the suite reports 82 failed / 59 failed — and reports **the same numbers on an untouched `origin/main`**. It is the symlink, not the branch. Ran `npm ci` in the worktree to get a trustworthy number.
- `scripts/commit_lint` — no errors.
- `git ls-files | grep -c node_modules` — 0.
## Type
- [x] Fix
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear
Widening a contract to match what the runtime already emits: every payload valid before is valid now. No emit site changes, no behaviour changes. The one code change outside the schema and the models is an explicit no-op branch in `ui-tui`. Rollback is a revert.
## Summary
Unit tests were leaking tracing spans into the real `~/.raven/traces`
store. Tracing is on by default and `trace.span()` calls are embedded in
library code (agent loop, subagents, TUI RPC), so any test exercising
those paths emitted spans with fabricated session keys (`session-a`,
`weixin:c`, `tui:default`, ...). Those spans then surfaced as phantom
sessions in `raven trajectory`, while the TUI `/sessions` list (which
reads the real session store) stayed clean.
This PR adds an autouse fixture in `tests/conftest.py` that:
- redirects `RAVEN_TRACING_DIR` to a per-test tmp directory, and
- resets the lazy module-level `TraceStore` cache
(`raven.tracing.spans._store`) around each test, since it pins the
directory resolved at first emit.
Key decisions:
- Only the directory is redirected, not the enabled switch, so the suite
keeps exercising the real emission path with zero behavior change; leaks
land in tmp instead.
- This centralizes the setenv-plus-cache-reset pattern that 8
tracing/trajectory test files already perform manually. Those tests keep
working: their own `monkeypatch.setenv` runs after the fixture and wins,
and they already reset the cache themselves.
- Existing phantom sessions come from archived span logs written before
this fix; the fixture only prevents new leaks. One archive file mixes a
real session with test keys, so cleanup needs line-level filtering and
is left out of scope.
## Type
- [ ] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [x] Other
Test-suite hygiene (`test` commit type).
## Verification
- `uv run pytest tests/test_tracing_api.py
tests/test_trajectory_store.py tests/test_trajectory_bundle.py
tests/test_trajectory_replay.py tests/test_trajectory_redact.py
tests/test_cli_tracing_commands.py tests/test_cli_trajectory_commands.py
tests/test_cli_trajectory_browse.py -q`: 308 passed, 1 failed
(`test_viewer_health_true_for_our_viewer`, fails identically on
unmodified `main`, environment-specific)
- `uv run pytest tests/test_agent_loop_run_emit.py
tests/test_subagent_manager.py tests/test_tui_rpc_turn_send.py
tests/test_deep_research_tool.py tests/test_agent_loop_approval.py -q`:
109 passed; the real `~/.raven/traces` log did not grow during the run
- Positive check: running `tests/test_agent_loop_run_emit.py` with
`--basetemp` shows the previously leaked session keys (`cli:c`, `tg:c`,
`weixin:c`) now land in per-test tmp dirs
- `uv run pytest tests/ --ignore=tests/integration -q`: 6837 passed, 11
failed, 20 errors; the same failure set reproduces on unmodified `main`
(environment-specific: cron/tz, everos server, theme, config loader,
viewer health), zero regressions from this change
- `uv run ruff check tests/conftest.py` and `uv run ruff format --check
tests/conftest.py`: both pass
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
Docs box left blank: test-only change, no user-facing docs affected.
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
Test-only change; no production code touched. One known interaction:
`RAVEN_TRACING_DIR` takes precedence over `RAVEN_HOME`, so a future test
that fakes `RAVEN_HOME` and expects traces under it must also set
`RAVEN_TRACING_DIR` itself. Rollback: revert the single commit.
## Related Issues
N/A
Co-authored-by: 江国庆 <guoqingjiang@deepglint.com>
Co-authored-by: Claude (claude-fable-5) <noreply@anthropic.com>
## Summary
A delivered artifact could not be opened from the page: the file viewer answered
403 and the transcript drew "Raven is confined to the workspace, so this file
cannot be opened here" over a delivery card it had just rendered.
The viewer's state-directory fence exempts the workspace subtree, on the stated
grounds that the default workspace lives inside raven's home and denying it
would refuse every file the agent itself wrote. Since agent home and the working
directory were split apart, a turn no longer writes there: it writes in
`~/.raven/tmp/<channel>`, a sibling of the workspace, inside the same state root
and outside the carve-out. So the fence denied exactly what the carve-out exists
to allow, one directory over, for every artifact produced since that split.
This exempts the working-directory root alongside the workspace, using the same
containment test in the same direction, so a working-directory root that happens
to sit above raven's home earns no exemption. `config.json`, `oauth/` and
`serve.json` are siblings of both and stay refused, which is what the fence is
for.
Worth noting for a reviewer: the bytes were already reachable. `/files/download`
serves a delivered file by token with no path fence, so this was never a
security boundary for deliveries -- only a viewer that refused to render what
the same page could already download.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
- `uv run pytest tests/test_rpc_transport.py tests/test_rpc_files.py tests/test_rpc_knowledge.py tests/test_rpc_console.py -q` -> 123 passed
- `uv run ruff check` and `uv run ruff format --check` on both changed files -> clean
- Both new assertions were mutation-checked, each against its own mutation:
- narrowing the carve-out back to the workspace alone reds
`test_the_turn_working_directory_is_exempt_from_the_state_dir_fence` only (1 failed, 3 passed)
- dropping the containment-direction guard reds
`test_a_working_directory_root_that_contains_the_state_root_earns_no_exemption`
and the pre-existing state-dir test (2 failed, 2 passed)
- Against the real reporting case: the two files that were answering 403
(`~/.raven/tmp/tui/*.md`, `*.pptx`) now resolve, while `~/.raven/config.json`
and `~/.raven/serve.json` still raise PermissionError.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
## Risk
- Widens what the file viewer will render by exactly one subtree: the directory
turns work in. Everything the fence was written to protect (provider keys in
`config.json`, the OAuth token store, `serve.json`) sits beside that subtree,
not inside it, and stays refused -- pinned by the tests above.
- `fs.list` / `fs.reveal` share the function but pass the session's working
directory as the root, which their own containment check already bounds, so
their behaviour is unchanged.
- Rollback is a one-line revert of the exemption tuple.
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
N/A
## Summary
PR #360 reports every copy-on-select write as a permanent transcript
line, so a
reading session that drags through the transcript piles up "copied N
characters" rows under the conversation. The confirmation splits by what
the
line is for: the unbounded terse repeats become a transient notice
rendered
above the input box -- one line that replaces itself on every new copy
and
clears after 3 seconds -- while the first copy of a session keeps its
path
caveat in the transcript. The caveat is the answer a user comes looking
for
after a paste comes up empty minutes later, and it cannot pile up
because it
is once per session by construction.
The reporter still owns the per-session caveat tally and now returns
`{ text, firstOfSession }` so the caller can route the caveat to the
transcript and the repeats to the notice. A new `copyNoticeStore` holds
the
single notice; `showCopyNotice` keeps one dismiss timer, clearing any
pending
one before arming the next, so an earlier deadline can never clear a
newer
notice. `/copy` is deliberately untouched: an explicit command's answer
still
belongs in the transcript, and it cannot stack on its own.
## Type
- [x] Fix
## Verification
Run from `ui-tui/` at branch head, in a fresh worktree of `github/main`.
Dependencies came from `npm ci` in `ui-tui/` and in the hermes package;
the
hermes package's own `node_modules` holds only esbuild, so the ink
render
tests run against one react copy (two copies break every hook call).
```
npx vitest run --no-file-parallelism
Test Files 93 passed (93)
Tests 1084 passed | 13 skipped (1097)
npm run type-check
clean, exit 0
npm run lint
22 problems (0 errors, 22 warnings)
npx prettier --check src/app/copyNoticeStore.ts src/__tests__/copyNotice.test.tsx
src/__tests__/clipboard.test.ts src/app/useMainApp.ts
src/components/appLayout.tsx src/lib/clipboard.ts
All matched files use Prettier code style!
python3 -m scripts.check_commit_messages github/main..HEAD
exit 0
```
The 22 lint warnings are the baseline, not new: 22 before the branch and
22
after, none in a file this branch touches. The suite is run with
`--no-file-parallelism` deliberately: the ink render tests fail under
default
worker parallelism at this suite size, and no CI job runs them.
Suites that exercise the changed code directly:
`src/__tests__/copyNotice.test.tsx`
(7 cases), `src/__tests__/clipboard.test.ts` (30 cases, the 3 reporter
cases
updated to the new return shape).
New tests were proved load-bearing rather than assumed:
- Removing the notice render line in `appLayout.tsx` makes the render
test
fail (content and placement above the input box).
- Removing the pending-timer clear in `showCopyNotice` makes the
re-shown-notice test fail: the earlier 3s deadline then clears the newer
notice.
- The dismissed-notice case now shows a notice first, and removing
`dismissCopyNotice`'s atom clear turns it red (review fix).
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
No doc change. `ui-tui/CONTEXT.md` has no clipboard or selection entry,
and
"copy notice" continues the existing "notice" vocabulary of
`copyResultNotice`
/ `copyOnSelectNotice`, so nothing new is coined.
## Risk
Behaviour change: the per-drag copy confirmation is now transient and
above
the input box instead of a permanent transcript line, and the first copy
of a
session lands one transcript line, exactly as on `main`. Reverting the
branch
restores the #360 behaviour; no data or on-disk format is involved.
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
N/A
---------
Co-authored-by: Claude (deepseek-v4-pro) <noreply@anthropic.com>
Absorbs the GitHub release into the downstream trunk. A merge rather than a
rebase so v0.1.13 becomes a real ancestor: the next sync starts from v0.1.13
instead of v0.1.12, and the eventual contribution back to GitHub can still tell
our commits from the upstream ones it already has.
Cost this round: 51 conflict hunks over 27 files, against 54 over 31 for
v0.1.12. The hunks were the cheap half. Upstream's #284 moves the model and
provider from process-wide state to a per-session binding, and the trunk had 230
commits standing on the old shape.
What git reported as a clean merge and was not
---------------------------------------------
Fourteen upstream-changed paths do not exist here, because we renamed or moved
them since v0.1.12. Rename detection found none of them, so their changes were
merged into paths nothing reads, silently:
* raven/tui_rpc/* -> raven/rpc/* (renamed in ce526ad5). Nine files, including
question_broker.py, whose whole #354 rewrite was lost, and methods/config.py,
methods/model.py, methods/session.py, models.py and errors.py. Each was
replayed by three-way merge against dd82f52c. The three test modules were
rebased function by function onto upstream's version instead, after a
three-way merge spliced assertions into the wrong tests.
* raven/agent/tools/mcp.py -> raven/mcp/client.py. Carried the release-blocking
fix, and is handled in the commit that follows this one.
* ui-tui/rpc-schema/openrpc.json -> rpc-schema/openrpc.json.
Decisions
---------
Follow upstream wherever the two disagree about provider and model:
* providers/pin.py is gone, so a bare model id is refused instead of derived.
A model id does not name whose credential serves it, and the derivation
walked a list -- with two vendors configured, which one pays came down to
their order in it. rpc/methods/config.py now requires the provider.
* ModelSwitchInTurnError (-32009) is gone with it. A session switch lands on
that session's next turn, so there is nothing to refuse mid-turn.
* AgentLoop.refresh_context_window and the LazyProvider on_built wiring are
gone: the window rides on the binding now.
* The skill gate no longer forwards an unpaired pin.
Keep ours where the trunk is ahead, and graft upstream's behaviour into it:
* raven/agent/subagent/backends/raven_loop.py is the live sub-agent path, so
manager.py's inline loop stays retired and the web_search gate from #312
applies there.
* skill_hub/client.py keeps the public zip limits the skillhub RPC path imports,
and takes upstream's query-string cap.
* ask_user keeps our JSON-string normalizers and feeds them into upstream's
batch contract, so a batch validated by _prepare is one _normalize_questions
has already coerced.
* The chat view composes both filters: hideIntroAfterFirstTurn drops the cover,
visibleRows still hands the view to a direct chat.
Tests removed, not repaired
---------------------------
Eight tests covered mechanisms this merge deletes, and one of them hung rather
than failed:
* seven in test_agent_loop_model_switch.py over AgentLoop._pending_provider,
the switch-parking mechanism #284 replaced with per-session bindings. Its
replacement arrives with upstream as test_agent_loop_session_model.py.
* test_a_refusal_during_a_turn_keeps_its_own_code in test_acp_methods.py, whose
error class no longer exists.
Baseline: the pipeline for 01d39e58, this merge's base, is green, so nothing
here can be charged to a pre-existing failure.
Co-authored-by: Claude (claude-opus-5) <noreply@anthropic.com>
## Summary
A WeChat user asked for a recommendation and the bot answered "the web
search
tool is not configured here". That sentence was not the model's own
phrasing --
it was the tool's error text, relayed outward. `web_search` needs a
Serper key
and that deployment has never had one, but the tool was registered
unconditionally, so on every search-shaped question the model saw it,
reached
for it, and passed the setup error on to whoever was in the chat.
Withholding the tool fixes that and creates a second problem: an
unregistered
tool is invisible. Nothing in a running Raven then says the capability
exists at
all -- the model is never offered it, no document lists it, and `raven
doctor`
reports on providers and memory but has never mentioned tools. The only
way to
learn that web search is one account and one edit away was to read the
source.
This does both halves, because either alone leaves a real gap: the
deployer is
told what this install can and cannot do, and the model is still not
offered a
tool it cannot run.
### Withholding the unusable tool
`web_search` is gated on a resolved key, in the main loop and in the
sub-agent
surface (`subagent/manager.py`) -- a sub-agent that reaches for a search
it
cannot run reports the failure to its caller, and that text lands in the
parent
turn, the same leak one level down.
The gate asks the tool, not the config. `WebSearchTool.api_key` resolves
at call
time from the constructor value *or* `SERPER_API_KEY`, so reading
`tools.web.search.apiKey` alone would withdraw a working tool from any
deploy
that exports the variable and configures nothing.
The tool's error message also hard-coded `~/.raven/config.json` while
the
gateway runs with `--config` elsewhere, so following it meant editing a
file the
process never reads. It names the path actually in force now. That text
is
reachable only if the key disappears after registration, which is
exactly why it
should be right: it is the message for the case the gate cannot cover.
### Three rules, and nowhere to read them
Registration is decided per family, each a different shape:
| family | rule |
|---|---|
| `web_search` | a resolved key, asked of the built tool |
| `web_fetch` | nothing -- always registered, a key only improves
extraction |
| media x3 | an `api_key` *or* a `model`, either counting as configured
|
For media those are two questions, not one. A section naming only a
model is
registered, because a model alone counts as asking for the tool, and
then every
call returns a missing-key error. Whether a capability is *offered* and
whether
it *works* come apart there, and a report treating them as one fact
ticks a
capability that cannot run.
Each rule is defensible where it sits. What is missing is anywhere to
read them.
Providers had the same sprawl once and answered it with
`providers.auth`: a
declarative table plus `credential_status` as the single authority, with
an AST
invariant enforcing that authority, because six surfaces had answered
the same
question six ways and each looked reasonable alone. Tools never got the
equivalent.
### What this adds
**Each tool answers for itself,** twice where the questions differ.
`WebSearchTool.is_configured` reads the config value *or*
`SERPER_API_KEY`,
because those are two sources and only the tool consults both. The media
base
answers `is_configured` on a model *or* a key -- which is what stops an
OpenRouter credential set for chat from silently switching on three
tools that
bill per call -- and answers `has_key` separately on the chain it
actually
resolves at call time: its own section, the borrowed provider key, then
`OPENROUTER_API_KEY`. Both rules live with the credential they read.
**`capabilities.py` describes the five** for a human deciding what to
set up:
what each does in one line, how much work it is (nothing / reuse a
credential
you already have / obtain an account), where the key goes, where to get
one, and
what it costs. It rules on nothing -- `is_configured` and
`has_credential` both
ask the tools -- so it cannot become a second opinion.
**`raven doctor` grows a section**, listing every capability configured
or not,
ordered by how much the deployer has to do:
```
(markers render as a green check and a yellow bang; spelled [ok] and [!] here to
keep this description ASCII, since it becomes the squash commit body)
Tool capabilities
web_fetch: [ok] Read a web page the agent already has the URL for
image_generate: [ok] Generate an image (borrowed: providers.openrouter.apiKey)
text_to_speech: [!] Generate speech from text
no key resolves; calls will fail
set: tools.media.speech.apiKey
or env: OPENROUTER_API_KEY
video_generate: - Generate a video
switch on: tools.media.video.model
key: reusing providers.openrouter.apiKey
Billed per call; needs prepaid OpenRouter credit.
web_search: - Search the web
set: tools.web.search.apiKey
or env: SERPER_API_KEY
key from: https://serper.dev
2 capability(s) available but not set up; the agent is not offered them.
```
Three deliberate details.
Naming the credential is load-bearing in both directions. A row that
cannot
distinguish a reused credential from a missing one sends someone to
create an
account they already have -- and a row that claims a reuse with nothing
to reuse
is worse, because acting on it means setting a model, getting a
registered tool,
and watching every call fail on a credential they were told they had. So
the
reuse line prints only when a key is genuinely there to pick up, and a
capability already in that broken state says so outright instead of
showing a
satisfied tick.
The credential is named at the path that holds it. For the media family
`config_path` names the *model*, so reusing it as the key source pointed
the
deployer at a line with no credential in it.
And each fact is on its own line rather than in a sentence, because the
terminal
wraps a long line mid-path and a config key broken across two rows
cannot be
copied, which is the only thing that row is for.
Nothing here moves the exit code, including the warned row. An install
without
image generation is a choice, not a fault, and a doctor that fails on it
teaches
people to ignore doctor. The half-finished one is arguable -- the memory
section
does exit non-zero for a role the user configured that the server could
not
build -- but that failure is silent where it happens, recall just
returning
nothing, whereas this one returns an error string to the model on every
call.
Say the word and it becomes an exit code instead.
### Not in this change
Registration still lives in `AgentLoop`. Having it read the table is the
point
of this shape and removes the last duplicate reader, but it edits
`agent/loop/main.py`, which is under active change, and it is worth
doing on its
own once that settles. Until then the table is a description, and the
tests
below are what keep it honest.
`deep_research` is deliberately absent: it is moving to the sub-agent
surface
and its tool is going away.
## Type
- [ ] Fix
- [x] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
Mixed on purpose: the first commit is a fix and the rest are the feature
it
made necessary. Splitting them would land a change that hides a
capability
without landing the one that makes it discoverable.
## Verification
```
make lint exit 0
make build exit 0
npm run test --prefix ui-tui 969 passed, 13 skipped
uv run --all-extras pytest -q 6186 passed, 35 skipped, 1 failed
uv run pytest tests/test_tool_capabilities.py \
tests/test_cli_doctor_commands.py \
tests/test_agent_loop_web_tools.py 64 passed
uv run --extra dev ruff check raven tests scripts All checks passed
uv run --extra dev ruff format --check 828 files already formatted
npx commitlint --from origin/main --to HEAD exit 0
scripts/check_commit_messages.py origin/main..HEAD exit 0
```
The one failure is
`test_read_file_image.py::test_an_attachment_that_cannot_be_
read_costs_a_note_not_the_turn`, and it is not from this branch: it
fails the
same way on `main` at `1cb604a` with these commits absent. The case
makes a file
unreadable with `chmod 000`, which does not block a root user, so it
fails for
anyone running the suite as root and passes in CI. This branch does not
touch
that file or the code under it.
The capability tests drive a real `AgentLoop` and compare what it
registered
against what the table predicts, rather than asserting the table against
itself.
The gated set is derived -- tools present once credentials are supplied,
absent
without -- so a sixth gated tool whose author forgets the table fails
here rather
than going unnoticed.
That last claim was false when first written, and the last commit is
what makes
it true. The fixture listing the media tools by hand never switched a
fourth one
on, so a new one never joined the gated set and the assertion held over
an
already-incomplete table. #305, which adds a MiniMax voice-clone tool,
is that
case: merged against this branch the assertion passed. Read from
`MediaGenConfig` instead, it fails and names the tool -- `gated but
undeclared:
['voice_clone']`.
Which means whichever of the two lands second turns this red,
deliberately. The
fix is one table entry, and it needs the rule that PR settles:
`voice_clone`
counts as configured on `api_key or api_base or model` in
`effective_media_config` while registration still gates on `api_key or
model`,
so an `apiBase`-only install with no MiniMax key is configured by one
rule and
withheld by the other. That is the divergence this table exists to make
visible,
and it is worth resolving there rather than papering over here.
Fifteen mutations, each caught:
```
the web_search gate removed from the main loop 3 failed
the same gate removed from the sub-agent surface 1 failed
media rule reads only the key 7 failed
web_search rule reads only the config 1 failed
a tool removed from the table 6 failed
the doctor section not rendered 6 failed
doctor lists only configured tools 4 failed
unconfigured treated as a failure 17 failed
the reuse line is printed unconditionally 1 failed
the key source falls back to the model path 3 failed
a keyless registered capability is not flagged 1 failed
has_key always answers yes 1 failed
has_credential collapses into is_configured 1 failed
the credential chain drops OPENROUTER_API_KEY 3 failed
the reuse check ignores the environment 3 failed
```
Four of those tests exist only because a mutation pass found the earlier
versions insufficient, and the last rounds are why the shape changed. A
media
case that sets both a model and an OpenRouter key proves nothing about
the "or
model" half: the borrow fills the key in, so a rule reading only the key
still
answers correctly. The case that pins it has nothing to borrow.
The sub-agent case is the same argument applied to the second call site:
with
the gate present only in the main loop, every test above still passes,
because
nothing was watching what the sub-agent surface registers.
More usefully, mutating `has_key` to always answer yes changed no test
at all in
the first version, which said the ruling was not load-bearing: the
doctor was
inferring "no credential" from an *empty source string* rather than from
the
tool's answer, so a fourth credential source would have been reported as
a
missing one. `has_credential` is now its own fact, asked of the tools,
and that
mutation fails.
Separately, autouse fixtures clear `SERPER_API_KEY` and
`OPENROUTER_API_KEY`,
without which several of these pass for the wrong reason on any machine
where a
developer exported one.
Rendering was checked against a real config in six states -- nothing
set, a
provider key present, a model with nothing to borrow, a tool with its
own key, a
model plus a borrowable key, and an exported variable as the only source
--
rather than only asserted on.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
## Risk
One behaviour change: `web_search` is no longer offered to the model
when no key
resolves. That is the fix. A deployment that has a key, in config or in
the
environment, is unaffected; one that has none was getting an error
string in
place of an answer.
The rest is additive. No other registration logic changed, so which
tools an
agent is offered is otherwise exactly what it was; `is_configured` moved
the
existing predicates onto the tools without altering them, and the
mutation
results above are what pins that. `has_key` and `_resolve_key` are new
names for
the chain `api_key` already resolved -- the property calls the extracted
one, so
callers see the same answers.
`raven doctor` gains a section and no new exit code. Its zero-network
guarantee
holds: the table reads config and environment only.
Two allowlist entries were added to
`test_only_the_auth_module_decides_configuredness_from_a_key`, argued in
place:
`subagent/manager.py`, which asks the built tool whether a key resolved
so an
unusable search is withheld, and `capabilities.py`, which reads keys to
*report*
-- which source supplied one, and whether one is there to reuse. Both
ruling
halves are delegated to the tools, whose files were already listed.
Rollback is a revert. Nothing is written and no configuration is read
differently.
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
N/A
---------
Co-authored-by: Claude (claude-opus-5) <noreply@anthropic.com>
## Summary
- Declare the existing Raven application logo as the served page favicon.
- Copy the logo into the packaged page assets so installed builds render the same branding.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
- `npm test --prefix ui` - 32 test files and 528 tests passed.
- `npm run type-check --prefix ui` - passed.
- `npm run build --prefix ui` - passed.
- `python3 ui/build.py` - built the page and copied the Raven logo asset.
- `node ui/scripts/check-page.mjs` - passed.
- `make check-large-files` - passed.
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
Low risk. The change only adds favicon metadata and packages an existing application asset. Reverting the two source changes restores the prior browser-default icon.
## Related Issues
N/A
## Summary
An identity EverOS cannot accept becomes a directory segment on its
write path, so `EverosBackend.start()` rejects it. The rejection carried
the one message a user can act on -- it names the key and the accepted
pattern -- and no surface delivered it as one. Three of the four call
sites fold the raise into `logger.exception`; under the TUI loguru is
file-only, so there an invalid identity turned memory off with nothing
on screen. The fourth, in `import_commands._build_and_run`, is not
wrapped at all, so the `ValueError` escaped as a bare traceback. Where
it was visible it was a traceback, which is not a thing a user reads as
"edit this key".
The state machine then told the user the opposite of the truth.
`start()` died before assigning a state, so `_state` stayed `UNKNOWN`,
which is not in `_NEVER_HAD_MEMORY`; every `store()` after it counted a
dropped write, and the session ended with:
```
1 turn(s) were not written to long-term memory because the memory service was
unavailable.
```
The service was fine. That sends the user to debug a server that never
broke.
**The change.** Catch the `ValueError` in `start()`, give it a
`BAD_IDENTITY` state, and file that state with the other two the user
must fix themselves:
- terminal, so a stray probe cannot promote it to `READY`;
- never-had-memory, so no dropped-write count and no outage wording;
- the message goes to stderr, matching what the unconfigured-LLM and
missing-binary paths beside it already do.
Two things came out of running it rather than reading it:
1. **The message needs escaping.** It quotes the accepted-character
class, and rich reads `[a-zA-Z0-9_.@+-]` as a markup tag and eats it,
leaving the user the pattern `^+$` to match their id against. The test
now pins the full class.
2. **`raven import` had the same defect on its own gate.** It kept the
outage wording and pointed at the server log, which holds nothing about
a config error. It now names the config keys instead.
Before / after, same config (`memory.userId: "bad/id"`), same command:
```
- 1 turn(s) were not written to long-term memory because the memory service was
- unavailable.
+ Long-term memory is off: memory.userId='bad/id' is not accepted by EverOS: it
+ becomes a directory segment on the write path, so it must match
+ ^[a-zA-Z0-9_.@+-]+$ and must not be '.' or '..'.
+ Fix memory.userId / memory.agentId in your config.json, then start a new session.
```
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
Re-run after rebasing onto `d35e398c`, the current `main`.
```
uv run pytest tests/test_everos_backend.py tests/test_cli_import_commands.py \
tests/test_everos_plugin_discovery.py -q
162 passed
uv run pytest -q
1 failed, 6478 passed, 43 skipped, 13 deselected
uv run ruff check <the four touched files> All checks passed
uv run ruff format --check <the four touched files> 4 files already formatted
```
The one failure is
`tests/test_cli_theme.py::test_bold_accent_renders_styled_not_bare`. It
is pre-existing on this base: checked out `d35e398c` in a clean worktree
and ran `uv run pytest tests/test_cli_theme.py` there, same failure, 1
failed / 44 passed. It passes in isolation and fails when the file runs
as a whole, so it is order-dependent, and it is unrelated to anything
here. That file is untouched by this change.
Manual check, sandbox `RAVEN_HOME`, `memory.userId: "bad/id"`, `raven
agent -m "hi"`: prints the block quoted above, and the session no longer
ends with the dropped-write line.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
## Risk
Terminal-only wording plus one new enum member. No config, schema, or
protocol change; an identity that was accepted before is accepted now,
on the same code path. The only behaviour change for a valid setup is
none.
For an invalid identity the turn behaves as it did -- memory off, turn
completes -- and only what the user is told changes. Rollback is
reverting the single commit.
`ServiceState.BAD_IDENTITY` is new. Every consumer was checked:
`raven/cli/import_commands.py` (handled here) and
`tests/test_everos_plugin_discovery.py` (reads `READY` only).
`_may_spawn` allowlists `UNKNOWN` via `_SPAWNABLE_STATES`, so a new
member is non-spawnable without a change.
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
Fixes#271
Co-authored-by: zhanghui <23442919+gloryfromca@users.noreply.github.com>
Co-authored-by: Claude (claude-opus-5[1m]) <noreply@anthropic.com>
## Summary
The session rail (left sidebar) becomes a React island: `ui/src/features/rail/` with types, a plain external store (draw/skeleton/markNew/remove/rename, fold state on the `raven.gui.grpfold` localStorage key), the Row/Group/RailApp components with classes and DOM shape copied byte-for-byte from the legacy renderer, and 13 tests.
Key decisions:
- `SESS`/`cur` stay shared page globals: ten demo/live files write them (including whole-array rebinds), so the island owns no rows. It reads through `DS.sessions.snapshot()`, a closure over the rebindable bindings, re-read on every `drawList()`.
- Island actions go out through 9 new optional bridge verbs (`drawList, setCur, openSession, removeSession, renameTitle, dropDraft, pinPersist, openCron, navState`), each one a guarded one-liner in 155-bridge.js and late-bound so live rebinds keep winning.
- `plainTitle` moved into the bundle and is republished as `window.plainTitle` for its 6 legacy callers (same pattern as `cronExprHuman`).
- Shrink: demo/050-rail.js 222 -> 16 lines; live/010-boot-guard.js raw-DOM skeleton painter became one `RavenIslands.rail.skeleton()` call; live/030-sessions.js untouched (already renderer-free, its helpers are read by other domains).
- Pre-existing bug left as-is: live/080-overrides' rename persist wrapper queries `#title input` after the h1 swap and throws today; the island reproduces the demo DOM dance exactly rather than patching another domain in this MR.
Ratchet: 57 -> 57 (the strands touching this domain remain demo-declared/live-assigned by design; nothing new added).
Note: pipelines are currently red project-wide with `ci_quota_exceeded` (shared-runner minutes exhausted). Local gates below are the same commands CI runs; the pipeline should be retried once quota recovers.
Review round: the fake shell handed `markNew` an empty nav and a folded More group, so both of its branches were dead in every test -- exactly the part of the port that changed shape (`Object.keys(NAV_OF)` to `nav.pages`, `$('#' + p)` to `getElementById`, `MORE_ROWS[i][0]` to `nav.morePages[i]`). Two cases added with the real nav: a module page up marks its own rail button over the new-task row, and an open More group puts the mark on the row whose page is up while the parent gives it up and takes it back when folded. Both fail against a wrong port.
## Type
- [x] Refactor
## Verification
- `npm run --prefix ui type-check` clean
- `npm test --prefix ui` 49/49 (13 new rail tests)
- `npm run --prefix ui build` (223.95 kB IIFE) and `python3 ui/build.py` (1,094,616 bytes)
- `node ui/scripts/check-page.mjs` OK; `node ui/scripts/count-shared-globals.mjs` 57/57
- `uv run pytest tests/test_ui_language_repaint.py` 9/9
- Stub browser pass (`?stub=1`): DOM byte-compared to legacy (.grp/.sess shapes, aria-current moves, fold persistence, search, pin+persist, delete+undo toast, rename via top bar, running mark lifecycle, More flyout marks, zh/en repaint)
- Live pass against a throwaway gateway (temp RAVEN_HOME, dummy keys, nonce auth): boot shows exactly 6 skeleton rows with the legacy width formula while `data-counts="pending"` holds, then the real list swaps in; draft's first send creates a real session; two-session switching moves a single mark; second boot renders with no mock flash
- Not exercised live: a successful provider turn and parked done/err badges (needs a real key); covered by unit tests and the stub replay
## Risk
User-visible behavior is intended to be identical; the rail DOM shape and class names are unchanged. Rollback is reverting the single commit.
## Related Issues
N/A
## Summary
Three follow-ups from #341, which fixed a retired `contextWindowTokens:
65536` capping every upgraded install at 64k. Two are its loose ends;
the third is the reason it happened at all.
**The notice no longer prints on stdout.** #341 drains config-migration
notices in the `run()` wrapper so every command tells the user, which
caught the two whose stdout is a machine-readable document: `raven
doctor --json` and `raven import --json`, both advertised for
automation. Reproduced -- a config still carrying the retired pin makes
`doctor --json` emit JSON with a sentence after it, and `jq` refuses the
result. Moved to stderr, where the rest of this class of message already
goes (the `ConfigReadError` branch a few lines up in the same wrapper,
and the loader's malformed-config warning). That fixes any future
`--json` command without it having to know this exists, which
allow-listing the two would not. The window is narrow -- the migration
fires once per install -- but the run it can spoil is a first run after
upgrading, and a CI job is exactly the caller not watching.
**`raven doctor` gains a Config section and a `--fix`.** The premise
changed while building it: the migrations run at load, so by the time
this command looks, nothing is pending -- they already happened,
silently, one launch ago. What is left for a person to ask about is what
Raven deliberately will not decide for them. So it reports a
`contextWindowTokens` pinned below what the configured model holds, and
names what rides on it: the per-turn history budget, when the Curator
starts paying for a slow path, and when memory consolidation archives.
`--fix` removes the pin.
Reported without `--fix`, never written: that pin is a real
configuration for a local model or an endpoint served smaller than the
catalogue thinks, and the flag is the user saying which case theirs is.
The write carries the file mode across (config.json holds
`providers.*.apiKey`) and uses a per-PID temp name -- the same rules the
loader's migration writer follows.
One check rather than two. A config naming no provider is the other
thing worth asking about, but it reads differently on either side of the
explicit-provider rule in #284, so it belongs to that change; a model
that routes to nothing is already reported above it.
**The bootstrap stops writing every default into the user's config.**
This is the cause of the bug #341 cured. `save_config` dumped the whole
`Config()`, so a new install started life with eight kilobytes of
settings its owner had never heard of and, worse, with that day's
defaults frozen into their file -- after which a default we improve
never reaches anyone who already has one. `contextWindowTokens: 65536`
got onto disk exactly this way.
It now writes only what differs from the defaults. Lossless on reload,
since a value equal to its default reloads as that default. A fresh
config drops from 7,985 bytes to 2, and to 634 once the extension blocks
are seeded -- what is left is the handful of lines someone actually
chose, which is also a config they can read.
That third one is the only change here with a broad blast radius, and it
has one visible consequence, which is an improvement: the onboarding
picker used to lead with the schema's default model, because the
bootstrap had written it into the config and the wizard read it back as
"the current model" -- a value nobody had chosen, offered as though
somebody had. With nothing written, the wizard leads with the provider's
own recommendation instead. The test that pinned the old list now pins
the new one and says why.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
```
pytest tests/ 6650 passed, 1 failed, 33 skipped
(tests/test_cli_theme.py::test_bold_accent_renders_styled_not_bare,
which fails identically on github/main when its file runs
together and passes alone on both)
ruff check raven/ tests/ All checks passed
ruff format clean
```
Driven by hand as well as by tests, each against a throwaway home:
```
doctor --json on a fossil config stdout parses as JSON again; the notice is on stderr
doctor (pin 65536, model 1M) reports the pin and what is sized against it
doctor --fix pin removed, file still 0600, a second run reports nothing
save_config on a fresh Config() 2 bytes; 634 after the extension blocks are seeded
```
New cases cover the stderr split, both doctor paths including the mode
preservation, and the save round-trip keeping every value the user
chose.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
## Risk
The bootstrap change alters what every new install's config file looks
like: nearly empty instead of a full dump. Existing configs are
untouched -- nothing rewrites them -- and both shapes load identically,
so the risk is confined to anyone reading `config.json` as documentation
of what can be set. `raven doctor` and the schema remain the answer to
that question.
The onboarding picker's default moves from the schema default to the
provider's recommendation, as described above.
`doctor --fix` writes only when asked, and only removes a key.
Everything else here is output routing.
Rollback: revert the commits. Nothing persists a new format, so a
reverted build reads every config written under this one.
## Related Issues
N/A
---------
Co-authored-by: arelchan <204152633+arelchan@users.noreply.github.com>
Co-authored-by: Claude (claude-opus-5) <noreply@anthropic.com>
Three more commits landed on the trunk during the review round, so the branch
stopped fast-forwarding again. Merged rather than rebased for the same reason as
before: a rebase flattens the v0.1.12 merge commit and costs the ancestry this
whole branch exists to establish.
One conflict, additive: tests/test_cli_gateway_commands.py had a _risk_banner
group added on this branch and a gateway-shutdown ordering test added on the
trunk. Both kept.
ui-tui/src/rpc/generated.ts merged automatically. Since it is a generated file,
its result was checked rather than assumed: `npm run lint:rpc` reports it in sync
with rpc-schema/openrpc.json, which merged alongside it.
Verification:
uv run pytest 9018 passed, 33 skipped, 13 deselected
uv run ruff check all checks passed
uv run ruff format --check 1022 files already formatted
npx vitest run 99 files, 1265 tests passed
npx tsc --noEmit clean
npm run lint:rpc schema and codegen in sync
Co-authored-by: Claude (claude-opus-5) <noreply@anthropic.com>
## Summary
Installing one of the sub-agents that ship under `subagents/` required a running
raven: each folder's `install.py` registered its entry through
`PUT /raven/subagents`, so both the web service and the gateway had to be up. On a
machine that has just cloned the repository, neither is.
The installer now writes `subagents.thirdParty` in the host raven's config
directly, through `raven.config.update_subagents` - the supported write path,
which validates the entry against the schema, replaces the entry sharing its name,
refuses a list that would hold duplicates, and replaces the file atomically. Hand-editing the JSON gets none of that, and a
half-written config is one raven will not start on. That module is importable only
from the host raven's environment, which is rarely the interpreter running the
installer, so it is reached in a subprocess resolved from the shebang of `raven`
on `PATH` (or `RAVEN_PYTHON`, or `--raven-python`). The installer therefore stays
standard-library only and runs under a bare `python3`.
What the file write costs is hot-apply: a running raven holds the roster it read
at startup, so the installer prints a restart instruction and the guide says the
same. `--endpoint` is gone; `--config` and `--raven-python` are new.
Two additions on top:
- `subagents/install.sh` does the whole install for every folder, or the ones
named: builds each checkout's venv, scaffolds `.env` from its template, then
registers. It refuses to register a folder whose api key is still blank, so a
half-configured agent never reaches the roster, and exits non-zero while
anything still needs attention. It discovers the checkout by its lone
`pyproject.toml` and derives the key prefix from the folder name, so a new
folder needs no edit in the script.
- `subagents/README.md` is the directory-level guide: what a folder is made of,
the install steps, what the installer does and does not do, how to remove an
agent, what a new folder has to satisfy, and what never gets committed.
`subagents/*` stays excluded by default. Only the folders that were already
tracked are whitelisted, plus those two new files by name; a folder holding a
docker image tar or a private checkout is unaffected. The change also drops a
sentence that pointed a published README at an unpublished sibling folder.
The pre-install backup is written before the config is touched, holds the list as
it sits on disk rather than a schema round-trip of it (loading coerces an `openai`
entry's `readsLocalFiles` away, so a validated copy would restore something the
user never wrote), and is at mode 600 because another entry among the others can
carry its own api key. A backup that cannot be written stops the install with the
config untouched, rather than going missing after a config that already changed.
`install.sh` reads the api key the way the launcher does, first non-empty match
wins, so the two cannot disagree about a `.env` that sets it twice. It expands its
argument array through `${args[@]+...}`, since an empty array under `set -u` is an
unbound-variable error before bash 4.4 - the stock `/bin/bash` on macOS. A relative
`--config` is made absolute at parse time, because `install.py` runs with each
folder as its cwd and would otherwise resolve the path once per folder.
## Type
- [ ] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [x] Refactor
- [ ] Other
## Verification
The branch touches 12 files: `.gitignore` and 11 under `subagents/`. Nothing under
`raven/` or `tests/`, and `testpaths = ["tests"]`, so no unit test collects any of
it.
```
uv run pytest -q 8237 passed, 46 skipped, 13 deselected in 170s
uv run ruff check --no-force-exclude subagents/raven-code/install.py All checks passed
uv run ruff format --check --no-force-exclude subagents/raven-code/install.py 1 file already formatted
bash -n subagents/install.sh clean
python3 scripts/check_commit_messages.py origin/main..HEAD exit 0
python3 scripts/check_large_files.py origin/main..HEAD exit 0
```
`subagents/` is excluded in `[tool.ruff] extend-exclude`, so the two ruff commands
above need `--no-force-exclude` to reach the file at all.
End-to-end on a freshly provisioned host with no `raven`, no `uv`, and Python 3.10:
cloned the repository, installed `uv`, built the venvs, ran the installer twice and
spawned one agent for real.
- Installer on a clean clone with no keys: three checkout venvs built, three `.env`
files scaffolded at mode 600, stopped at the key gate for all three, exit 1. The
host config's mtime was unchanged and no backup file was written, so nothing
half-configured reached the roster.
- Same host with keys filled in: all three entries `replaced` in a config that
already held 8 third-party sub-agents, and all 8 survived. Each backup was mode
600 and held the full 8-entry list. `load_config()` then listed all 8, so the
written entry is valid to the runtime and not only to the writer.
- The resolved `command` of each entry pointed at the clone's own path, confirming
the placeholders resolve against the installer's location rather than the machine
that built the folder.
- One real spawn answered correctly in 22s.
- Before that, on a machine with no `raven` on `PATH`, the installer reported
`no raven on PATH; pass --raven-python ...` and recorded the folder as failed.
Probes for the fixed defects: a config seeded with `readsLocalFiles: true`
on disk produced a backup recording `false` before the fix and `true` after; a
`.env` setting the key twice with an empty second line made the shell installer
refuse an agent the launcher would run, and both now agree; an interpreter stub
printing non-JSON now yields `cannot read the writer's output` instead of a
traceback; a `--config` whose parent is a regular file makes the config write fail
with the backup already on disk, which is what shows the backup precedes it; and a
run with no flags at all registers against a scratch `HOME`, which is the path the
empty-array expansion used to break on bash before 4.4.
Proving the backup ordering took two attempts. Making the folder unwritable with
`chmod 555` proved nothing, because this runs as root and root ignores mode bits -
a trap the repository's own skipped test records. The failing-config probe above is
the one that holds.
- [ ] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] User-facing docs or screenshots are updated when needed
The first box is deliberately unchecked: there is no unit test covering this tree,
because pytest does not collect it. The end-to-end run above is the evidence
offered in its place. The unit suite was run anyway, on the rebased tree, and
reported no failures at all - so there are no failing ids to diff against the
target branch.
## Risk
**Behaviour change.** An install no longer takes effect immediately. Anyone
following the old flow will see the agent appear only after raven or the gateway
restarts; the installer's last line and the guide both say so. `--endpoint` no
longer exists, so a caller passing it gets an argparse error rather than a silent
fallback.
**Not reproduced, environment-dependent.** On the test host, the provider's model
listing answered 200 while inference answered
`403 This model is not available in your region.`, which the launcher reports as a
run that exits 0 having committed no answer - it reads like a launcher bug and is
not one. Exporting the site proxy fixed it, and the guide now records both that and
the fact that a missing EverOS degrades rather than fails.
**Security.** The pre-write backup can contain another entry's api key, so it is
written at mode 600 and is covered by the existing ignore rules. Keys stay in each
folder's `.env` at mode 600; the tracked `config.json` files hold none. The
installer no longer sends the entry list over a loopback HTTP service.
**Rollback.** Revert the commit: the previous installer talked to the RPC and needs
nothing else restored. Entries already written stay valid either way, since the
schema did not change.
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
N/A
Absorbs the GitHub release into the downstream trunk. A merge rather than a
rebase so v0.1.12 becomes a real ancestor: the next sync starts from v0.1.12
instead of v0.1.11, and the eventual contribution back to GitHub can still tell
our commits from the upstream ones it already has.
Cost this round: 54 conflict hunks over 31 files, against 19 over 14 for
v0.1.11. The growth is ours, not upstream's -- 33 commits landed on the trunk in
the six days since the last sync, and they concentrate in the three files the
sync notes already name as hot (agent/loop/main.py, cli/tui_commands.py,
config/schema.py).
Notable conflict resolutions:
* agent/loop/streaming.py keeps our extracted stream_llm_call and grafts
upstream's one real addition into it: the truncation verdict
(upstream_finish_reason, flag_truncation, and the two LLMResponse fields).
Comparing function bodies against the merge base was what showed aclosing()
and the structured error classification were already there, not new.
* agent/loop/main.py splits an 87-line block that upstream left empty: two
helpers moved into upstream's new loop/failure_streak.py and had to go, four
with live call sites outside the block had to stay. Taking the block whole in
either direction was wrong.
* _dispatch_backend_store takes upstream's detached-task architecture and keeps
our memory-failure tracking inside the task body. The shared tail after the
hunk reads `e`, which upstream's `except Exception:` does not bind, and
drain_backend_stores already had three merged-in callers.
* context_engine/segments/render.py merges two dimensions into identity_text:
our work_dir split and upstream's routed model id. The shared body already
reads names from both sides.
* agent/tools/registry.py keeps both unparseable-argument mechanisms. They sit
at different layers on purpose -- RunMeta comes from a provider on the
non-streaming path, RAW_ARGUMENTS_KEY from the loop on the streaming one.
Nine breakages git merged cleanly and never flagged. This is the shape the
change fails in, and it is worth recording in full:
* The three vendored builds under subagents/ carry a copy of the pre-rename
raven/tui_rpc/ tree, so rename detection sent upstream's 50 lines of
tui_rpc changes into a dead copy instead of raven/rpc/. Only one of the four
files conflicted; the other three were silent.
* subagent/backends/raven_loop.py holds the tool loop we extracted from the
subagent manager, so upstream's run_meta argument never reached it.
* AgentDefaults.max_tokens: upstream dropped it for a dynamic
send_max_tokens(). Both make_provider sites merged onto the new scheme;
providers/resolving_provider.py did not, because upstream has no such file.
* ResolvingProvider never forwarded wire_model_id. Only upstream's own
invariant test catches that class, and the cost is a silently mis-sized
request (16384 against 4096 for one gpt-4o).
* CronService.add_job kept our body but took upstream's signature, losing
`deliver` from both the parameter list and CronPayload while two RPC methods
still pass it, and leaving a call to the _arm_timer scheme upstream replaced
with a wake Event.
* rpc/bootstrap.py still called make_on_cron_job positionally after the
signature narrowed.
* update_everos lost _EVEROS_CONFIG for a root-lookup family, and gained an
ownership gate over its write primitives.
* SessionInitInfo never declared config_notices, in the model or the schema,
while methods/session.py returns it and our own TUI already reads it through
a hand-written type intersection. Both are strict, so a config migration
would have made session.create fail validation in production.
* tests/test_skill_hub_tools.py keyed a fixture under the "local" router
namespace rather than a real registry layer, which upstream's new assertion
exists to refuse.
Also fixed while here: the rich Style cache poisoning that the ci branch
documents as a known crutch (one pinned color_system), and the coverage
baseline's 29 stale raven/tui_rpc/ paths. The baseline totals are still
upstream's own numbers and should be regenerated separately.
Verification, on macOS with a non-root runner:
uv run pytest 8888 passed, 33 skipped, 13 deselected
uv run ruff check all checks passed
uv run ruff format --check 1017 files already formatted
npx vitest run 99 files, 1265 tests passed
npx tsc --noEmit clean, TurnEvent exhaustiveness included
npm run lint:rpc schema and codegen in sync
make check-large-files exit 0
rpc-schema/openrpc.json is the source of truth here, so ui-tui/src/rpc/
generated.ts was regenerated rather than hand-resolved. Nothing under
subagents/ changed.
Co-authored-by: Claude (claude-opus-5) <noreply@anthropic.com>
## Summary
Three test-only defects of one shape: the result depended on the environment the
suite ran in, not on the code under test.
- `test_cli_serve_commands`: two tests drove `_web()` without the `opened`
fixture, so every run opened two real browser tabs at a port nothing was
listening on. The suite stayed green, which is why this went unnoticed. A
third test named for refusing to open never asserted that it did not.
- `test_cli_theme`: an `auto` color_system Console resolves against
COLORTERM/TERM, and Rich pins a composed style's ANSI codes on first render
and reuses them across consoles, so the bold-accent assertion passed or failed
according to the terminal running pytest. That console is now pinned to
truecolor.
- `test_default_context_engine`: concurrency was asserted through a wall-clock
total, which races whatever else the machine is doing. Replaced with a
rendezvous, verified by mutating the `gather` to run serially and confirming
the test goes red.
`conftest` gains a `_no_real_browser` autouse guard beside the existing
no-network and no-credential ones, so a test that forgets to stub the opener
fails loudly instead of hijacking the screen.
Production behaviour is unchanged: `raven web`, `raven serve` and the OAuth
flows still open a browser as before. Only files under `tests/` are touched.
## Type
- [ ] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [x] Other
Commit type is `test`; the template has no Test box.
## Verification
uv run --all-extras pytest -q # 8474 passed, 33 skipped, 13 deselected
make lint-python # ruff check + ruff format, both clean
make check-commits # commitlint + check_commit_messages.py
make check-large-files # clean
Before the fix the same suite reported 1 failed and opened two browser tabs per
run; both are gone. The theme test was re-run under three terminal environments
(no variables, `COLORTERM=truecolor`, `TERM=xterm-256color`) and passes in all
three.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
Tests only; no production code path is changed. Rollback is a single revert.
## Related Issues
N/A
## Summary
`raven onboard` was unreadable on light-background terminals: the
palette was
hardcoded for a dark background and the CLI had no light/dark detection,
so
near-white / bright-yellow text vanished on white (issue #169,
reproduced on a
released build).
This adds `raven/cli/_theme.py`: light/dark detection (env `RAVEN_THEME`
/
`RAVEN_TERM_BACKGROUND` hint / OSC 11 background probe / `COLORFGBG`,
falling
back to dark) plus a scheme-aware palette, wired into the onboarding
wizard and
the shared questionary style.
- Dark rendering is byte-for-byte unchanged (dark token values are the
current
literals; verified by a rendering diff and a parity test).
- Light values clear WCAG AA 4.5:1 on white; most mirror
`ui-tui/src/theme.ts`.
- Detection runs on first themed render, never at import, so plain
`raven ...`
commands do not probe the terminal.
- Also drops two hardcoded `white` table columns (`skill` / `cron`) that
were
invisible on light backgrounds.
Scope is deliberately limited to what fails on light: named ANSI colors
(`red`/`green`/`cyan`...) elsewhere are terminal-adaptive and were left
as-is.
## Type
- [x] Fix
## Verification
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
```
uv run pytest tests/test_cli_theme.py # 44 passed (new)
uv run pytest tests/test_cli_onboard_commands.py # 64 passed
uv run pytest tests/test_cli_deep_research_commands.py \
tests/test_cli_skill_commands.py tests/test_cli_cron_commands.py \
tests/test_cli_smoke.py # 142 passed
uv run ruff check / ruff format --check # clean
```
Note for reviewers: the OSC 11 terminal probe can only be exercised on a
real
TTY (not in CI). Please confirm on a light-background terminal that
`raven onboard` is now legible, and on a dark terminal that it is
unchanged
(`RAVEN_THEME=dark` / `RAVEN_THEME=light` force a scheme).
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
Dark output is unchanged; the new env vars are additive; rollback is a
single
commit revert.
## Related Issues
Closes#169
---------
Co-authored-by: Claude (claude-opus-4-8) <noreply@anthropic.com>