## Summary
Saving cron.defaultTimezone did not affect new schedules, and writing a
snake_case config grew a second key. Preserve the written key and
previous value, and have runtime assembly supply CronService with the
named cron_default_timezone live reader.
The setting applies once it is written. Without it, a new
cron-expression job stores no zone and fires on the host's local time,
as it did before this change: the schema default is now unset rather
than Asia/Shanghai, because `save_config` drops every value equal to its
default, and a written Asia/Shanghai would otherwise read as unset after
the next save. The reader admits a schema-valid IANA zone under either
spelling and retains the last valid zone through malformed or invalid
configuration; removing the setting, or writing null, returns new jobs
to local time. New cron-expression jobs store the resolved zone;
explicit zones win. Existing jobs keep their zone when edited, including
legacy local-time jobs and topic-based updates. At/every schedules
retain their behavior.
Configs onboarded up to 0.1.12 carry `cron.defaultTimezone:
"Asia/Shanghai"` that the owner never chose: those releases saved every
default, and nothing read the field. A run-once migration behind its own
config version floor (13, gated like the 65536 context-window one)
removes that exact value in either spelling and tells the user once; a
zone written after it stands. On an upgraded install, new jobs therefore
keep firing on local time, as on main, until the owner writes a zone.
The self-configuration catalog now exposes the setting through its
existing settings writer, which also accepts null, and records the
live-reader evidence; `raven cron config get` shows `local` while the
setting is unset. The raven_config regression drives the real writer and
running service, including rejected values and a missing writer.
Scheduling code does not import config.
The cron tool's reply names the zone a new cron job keeps (`, fires on
Asia/Tokyo`, or `, fires on this machine's local time`), and its `tz`
description says what an omitted zone resolves to. A naive `at` stays on
the machine's clock, which is the clock the agent's current time shows,
so a relative reminder is not moved by a configured zone.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
Native Windows follow-up (build 10.0.26300, Python 3.13.12,
`PYTHONUTF8=1`), after synchronizing with the current target:
- The two new loader migration tests initially could not collect: an
inherited decorator called unavailable `os.geteuid()`. Guard Windows
first, and keep the read-only directory test for non-root POSIX. A
subsequent run exposed the neighboring owner-only POSIX mode assertion;
that test is now explicitly POSIX-only too. No runtime code changed in
this follow-up.
- `uv sync --frozen --python 3.13 --extra dev --dev`: passed.
- `uv run --frozen --no-sync pytest tests/test_config_loader.py
tests/test_core_cron_stack.py tests/test_config_live.py
tests/test_cron_service_validation.py tests/test_cron_tool.py
tests/test_config_self_surface.py tests/test_raven_config_tool.py -n 0
-x --tb=short`: 507 passed, 2 skipped. The skips are the two POSIX
permission tests; both new migration regressions ran and passed.
- `uv run --frozen --no-sync pytest
tests/test_rpc_settings.py::TestTheCronTimezoneControl
tests/test_cli_cron_commands.py::test_config_get_all_shows_defaults
tests/test_cli_cron_commands.py::test_config_get_single_flag
tests/test_cli_cron_commands.py::test_add_uses_the_configured_default_timezone
tests/test_config_update.py::test_update_cron_config_keeps_the_written_key
-n 0 -x --tb=short`: 13 passed.
- Full Python-target Ruff check/format, all 10 import contracts,
changed-production type checks, complete-PR pre-commit, commitlint, and
repository commit/asset/source-language gates passed. The six existing
patches replayed without patch changes.
The broader final runs above emitted no idle-ceiling warnings. An
earlier two-case migration run passed with one non-failing idle warning.
No full repository suite, fresh POSIX run, scheduler delivery, OS
timezone change or Windows ACL audit was performed in this follow-up.
The skipped checks do not establish equivalent Windows permission
enforcement.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
Earlier Linux verification before the Windows test-portability
follow-up, Python 3.12:
- `uv run --frozen --python 3.12 --all-extras pytest -q` with the proxy
variables unset: 3 failed, 29699 passed, 158 skipped. The same 3 fail on
main at the merge base on this machine (an npm on PATH, a root-only
permission check, a LibreOffice conversion); 0 introduced.
- The nine test files in the command below, plus
tests/test_config_loader.py: 754 passed.
- With `TZ=America/New_York` and no setting written, a new `0 9 * * *`
job stores no zone and next fires at 09:00 local time, as on main; with
`Asia/Shanghai` written it stores that zone and next fires at 21:00
local time, 09:00 in Shanghai.
- With `TZ=America/New_York`, a config as a 0.1.12 bootstrap wrote it
(`{"cron": {"defaultTimezone": "Asia/Shanghai", "notifyMissed":
true}}`), loaded as the gateway and `raven cron add` load it, and a new
`0 9 * * *` with no zone: main and this head store no zone and fire at
09:00 local time; the previous head stored Asia/Shanghai and fired at
21:00. A config stamped past the migration keeps a written Asia/Shanghai
and fires at 21:00, 09:00 in Shanghai.
- Disabling the migration turns 3 tests red; dropping the reply's zone
note turns 3 red.
- Restoring Asia/Shanghai as the schema default, treating null as an
invalid edit, refusing null in `settings.set`, and falling back to
Asia/Shanghai in the reader each turn tests red (4, 6, 2 and 13).
- `ruff check`, `ruff format --check`, `lint-imports`, `ty check` and
`deptry` over the Makefile targets, `commitlint`, the three repository
gate scripts and `pre-commit run --from-ref origin/main --to-ref HEAD`:
passed.
The runs below were measured before the unset default changed; they
cover the reader, writer and catalog paths this revision keeps.
Linux, Python 3.12, in the uv container with the reviewed checkout
mounted at /work and the environment at /venv:
```text
uv sync --locked --all-extras --dev
uv run --frozen --all-extras pytest -o addopts= tests/test_cli_cron_commands.py tests/test_config_update.py tests/test_core_cron_stack.py tests/test_cron_service_validation.py tests/test_cron_tool.py tests/test_rpc_settings.py tests/test_config_live.py tests/test_config_self_surface.py tests/test_raven_config_tool.py -q --tb=short --show-capture=no
```
661 passed. Two cache-write warnings came from the read-only checkout.
This Linux run did not enable the strict idle ceiling; it reported one
idle warning in an existing channel-field test.
Native Windows with PYTHONUTF8=1, the shared Python 3.12 environment
selected by UV_PROJECT_ENVIRONMENT, and PYTHONPATH pointing at the
checkout:
```text
uv run --no-sync pytest -o addopts= tests/test_core_cron_stack.py tests/test_config_live.py -q --tb=short --show-capture=no
uv run --no-sync pytest -o addopts= tests/test_raven_config_tool.py tests/test_config_self_surface.py -q --tb=short --show-capture=no
```
144 passed and 241 passed. Before the reader change, both real-service
invalid-edit regressions failed with ValidationError. Before the catalog
change, all five new tool cases failed at the inert entry. The existing
inert-setting test now uses another setting that is still inert,
preserving that coverage. Earlier broader Windows runs retained POSIX
permission/path and terminal-wrapping failures; those platform issues
are not claimed fixed.
Whole-branch gates on native Windows:
```powershell
$changed = @(git diff --name-only origin/main...HEAD -- '*.py')
$production = @($changed | Where-Object { $_ -like 'raven/*' })
uv run --no-sync ruff check @changed
uv run --no-sync ruff format --check @changed
uv run --no-sync ty check @production
uv run --no-sync lint-imports
uv run --no-sync pre-commit run --from-ref origin/main --to-ref HEAD
uv run --no-sync python scripts/check_commit_messages.py origin/main..HEAD
uv run --no-sync python scripts/check_source_language.py origin/main...HEAD
uv run --no-sync python scripts/check_large_files.py origin/main...HEAD
git diff --check origin/main...HEAD
```
All listed gates passed. The full diff was checked for caller coverage,
ownership, admission and failure behavior, compatibility, regression
strength and architecture. The full repository suite and native macOS
were not run locally. No screenshot change applies; affected code
documentation is updated.
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
New cron jobs without explicit zones use the configured default once one
is written, and the host's local time while none is, as before. Invalid
edits retain the last admitted zone, or local time if none was admitted.
Removing the setting, or writing null, returns new jobs to local time.
Changing the default does not retime existing jobs. The agent can
configure this preference through the same validated `settings.set`
writer.
An install onboarded up to 0.1.12 loses its planted
`cron.defaultTimezone: "Asia/Shanghai"` once, with a notice saying how
to put it back. So does an Asia/Shanghai written on purpose before this
release; it never changed a schedule. While a blocked research rename
holds the migration stamp at 6, every later floor re-runs on each load,
so in that state a restored Asia/Shanghai is removed again until the
rename completes. The cron tool's add reply gains a zone suffix.
Rollback: revert the squash commit. Zones already stored on jobs remain
explicit in the existing tz field and can be edited normally.
## Related Issues
#506
## Summary
A direct chat runs on an instance lane, while permission modes and
session grants belong to its parent conversation. Looking up the lane
lost the conversation's settings; splitting at the first `#` instead
merged distinct separator-named conversations. Carry the original parent
key across the request and use it at each permission entrance.
- `PermissionTurn.session` supplies the conversation for both mode
lookup and session-grant reads/writes. Ordinary conversation IDs remain
verbatim.
- Normal sends, injected direct turns, and instance-addressed cron wakes
carry `TurnRequest.parent_session`. `session_key_for` is the shared
resolver used by RPC, Gateway, and one-shot CLI permission bindings.
- Older internal requests without the new field remove their known
complete target suffix, preserving `#` in both the parent and handle. A
declared parent remains authoritative.
- The real direct-chat execution path uses the same parent for instance,
record, and working-directory lookup. Registered RPC direct-chat events
preserve that parent when routing; completion and error events use the
target captured before lane cleanup.
- Record the conversation-wide mode/grant contract in `CONTEXT.md`. A
grant in a direct chat covers its parent and sibling instances in that
conversation, without covering another conversation that shares a
textual prefix.
The a2a entrance constructs no direct request and keeps its ordinary
conversation identity. The main-agent-only configuration tool continues
to read the main conversation directly. Approval questions retain their
lane identity for correlation; the permission policy reads the original
session separately.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] User-facing docs or screenshots are updated when needed
Linux, Python 3.12:
```text
uv run --frozen --all-extras pytest tests/test_permissions_*.py tests/test_spine_*.py tests/test_rpc_spine.py tests/test_rpc_turn_send.py tests/test_core_cron_stack.py tests/test_gateway_spine.py tests/test_cli_one_shot_spine.py tests/test_agent_loop_session_model.py tests/test_agent_loop_run_emit.py tests/test_agent_playbook_delegate.py tests/test_subagent_direct_chat.py -q -x --tb=short
```
933 passed. Native Windows, Python 3.12:
```text
uv run --frozen pytest tests/test_permissions_gate.py tests/test_spine_turn.py tests/test_rpc_turn_send.py tests/test_rpc_spine.py tests/test_gateway_spine.py tests/test_cli_one_shot_spine.py tests/test_core_cron_stack.py tests/test_subagent_direct_chat.py -n 0 -q -x --tb=short
```
631 passed before the final ordinary-session cases; the final six-case
ordinary/direct entrance matrix passed on Windows and Linux. After the
final entrance/comment cleanup, the following selection passed 5 cases
on each platform (with `--all-extras` on Linux):
```text
uv run --frozen pytest tests/test_rpc_turn_send.py tests/test_core_cron_stack.py -k "separator_named_permission or wake_naming" -n 0 -q -x --tb=short
```
Before the fix, the real `turn.send` request passed through each of the
three runners ignored the parent's `ask` mode and returned `Allow` from
the default. The regressions now verify that mode, grant inheritance,
and isolation from a sibling separator-named session. Producer tests pin
the carried parent on ordinary sends, injects, and cron wakes. The real
AgentLoop direct branch and final RPC events retain the full parent too.
Fourteen isolated mutations were caught: three additional cases split
ordinary session IDs at the entrances, plus each permission entrance
reverting to the first separator, each of the three producers dropping
the parent, ignoring the declared parent, truncating the legacy
fallback, using a truncated key for the direct-chat record, and losing
the captured target separately at completion and error. Sources were
restored and compared with the committed blobs.
Whole-branch pre-commit, type checks on every changed Raven Python
module, import-linter (10 contracts kept), commitlint, the Python
commit-message checker, source-language and large-file gates, and `git
diff --check origin/main...HEAD` passed. The full repository suite and
native macOS were not rerun. Runtime contracts are updated; there is no
visual UI change requiring screenshots.
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
Direct chats intentionally inherit their conversation's permission mode
and session grants. This also means an approval granted in one instance
is shared with other turns of that same conversation. Separator-named
conversations retain distinct scopes. The new request field is internal;
no RPC schema, persisted format, or lane spelling changes. Legacy
unannotated string-only routing outside these request paths is not
redesigned.
Rollback: revert the squash commit.
## Related Issues
Fixes#905
## Summary
A Cron reminder could reply through Spine delivery and then enqueue a
completion event that made Heartbeat send the reminder again. Use
`TurnOutcome.explicit_reply` to skip that redundant event and wake,
including replies without captured readback text.
Successful runs clear their pending failure event; explicit replies also
clear earlier silent completion events for the same job. Silent
completions, failures, missed reminders, and automatic disabling retain
their notification paths. Add a regression using the real Scheduler,
DeliveryHub, event queue, and HeartbeatService, plus event cleanup tests
and updated English/Chinese documentation.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] User-facing docs or screenshots are updated when needed
The delivery regression failed for both readback variants before the
fix. After rebasing onto latest official main, 167 focused tests passed
with 94.90% combined line/branch coverage for `cron_stack.py`; changed
executable lines have 100% coverage.
```powershell
$env:PYTHONUTF8 = '1'
$env:COVERAGE_FILE = Join-Path $env:TEMP 'raven_issue164_coverage'
uv run --frozen --no-sync pytest tests/test_core_cron_stack.py tests/test_core_cron_stack_ledger.py tests/test_event_wake.py tests/test_gateway_spine.py tests/test_spine_delivery.py tests/test_living_docs.py tests/test_docs_site.py -q --cov=raven.core.cron_stack --cov-branch --cov-report=term-missing
uv run --frozen --no-sync python scripts/coverage_gate.py --coverage-json $ravenCoveragePosixJson diff --base-ref FETCH_HEAD --threshold 90
```
`$ravenCoveragePosixJson` is the generated coverage JSON with Windows
path separators normalized for the diff checker.
Broader Cron service/tool/CLI/TUI coverage passed 336 tests after
excluding two failures reproduced on clean official main: Windows
timestamp resolution in
`test_reload_detects_rewrite_within_float_mtime_collision` and terminal
wrapping in `test_run_test_fire_on_recurring_job`.
```powershell
$ravenCronTestFiles = @((rg --files tests) | Where-Object { $_ -match '^tests[\\/]test_cron_service_.*[.]py$' })
uv run --frozen --no-sync pytest tests/test_core_cron_stack.py tests/test_core_cron_stack_ledger.py tests/test_event_wake.py tests/test_gateway_spine.py tests/test_spine_delivery.py @ravenCronTestFiles tests/test_cron_tool.py tests/test_cron_wake_grant.py tests/test_cli_cron_commands.py tests/test_tui_cron_tool_wired.py tests/test_tui_cron_delivered_event.py tests/test_living_docs.py tests/test_docs_site.py -q -k 'not test_reload_detects_rewrite_within_float_mtime_collision and not test_run_test_fire_on_recurring_job'
```
The following passed: Ruff over the full Python tree, all 10 import
contracts, type checking of the changed module, diff whitespace, asset
limits, and source language checks.
```powershell
uv run --frozen --no-sync ruff check raven evolver agents plugins-dist tests scripts docs-site
uv run --frozen --no-sync ruff format --check raven evolver agents plugins-dist tests scripts docs-site
uv run --frozen --no-sync lint-imports
uv run --frozen --no-sync ty check raven/core/cron_stack.py
git diff --check FETCH_HEAD...HEAD
uv run --frozen --no-sync python scripts/check_large_files.py FETCH_HEAD..HEAD
uv run --frozen --no-sync python scripts/check_source_language.py FETCH_HEAD..HEAD
```
`make ci` could not run because this Windows environment has no `make`.
Full-suite collection and wheel smoke testing also encounter existing
Unix-only assumptions (`os.geteuid` and `venv/bin/python`); full
dependency/type checks require platform-excluded `nio`/`boxlite`
packages. Full Linux CI remains to be checked on the PR.
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
Explicit Cron replies no longer trigger Heartbeat completion follow-ups.
Existing Spine/DeliveryHub delivery and retry handling remains
responsible for those replies; this change adds no transport
acknowledgement or exactly-once guarantee. No schema, permission, or
dependency changes. Revert this PR to restore the previous event
behavior.
## Related Issues
Fixes#164
Co-authored-by: Codex <noreply@openai.com>
## 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>
## Summary
A failed turn's own wording never reached the cron job record. The lane
in `raven/spine/scheduler.py` emitted
`TurnFailed(error=describe_failure(exc))` to the sink and then returned
`None`, so `TurnHandle.result()` gave a submitter the same value for a
failed and a cancelled turn, and `raven/core/cron_stack.py` had to
invent `turn was cancelled or failed before it completed`, which
CronService stored as the job's `last_error` and which `cron get`, the
cron page and the heartbeat event all showed. `cron.runs` in
`raven/rpc/methods/console.py` also counted the failed turn's marker
text as an answer, drew the run as ok, and appended the job's error as a
second, phantom run.
The lane now returns the `TurnFailed` it emitted, so a handle resolves
three ways: a `TurnOutcome` when the turn answered, a `TurnFailed` when
it ended with a named failure, `None` when it was cancelled or never ran
(documented on `TurnHandle.result()` and in the CONTEXT.md Spine entry).
Both cron submit sites raise the turn's own sentence and put it in the
system event without an exception-class prefix, and a cancel keeps a
sentence of its own. `cron.runs` reads the `turn_ended` marker before
the text: the run is not ok and previews the reason, and with the run
correctly not ok the existing `last_error` arm no longer inserts a
second row.
In-tree only cron reads the handle's value; every other caller awaits
and discards it. A merged inject still resolves as `None` on both
non-answers.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
```
uv run pytest tests/test_spine_scheduler.py tests/test_spine_scheduler_lane.py tests/test_core_cron_stack.py \
tests/test_rpc_console.py tests/test_cron_service_wake.py tests/test_rpc_contract_shapes.py -q
uv run ruff check . && uv run ruff format --check .
```
Live check with an isolated agent home whose model endpoint answers
every chat completion with HTTP 429, `raven serve`, and `raven cron add
--every 15s --channel tui`. Before the change `raven cron get` showed
`last_error: turn was cancelled or failed before it completed`; after it
shows `Error calling LLM (rate_limit@openrouter): RateLimitError:
OpenrouterException - Rate limit reached for e2e-model: please retry
after 20s`, and `jobs.json` holds the same sentence.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
(CONTEXT.md gains the one-line result trichotomy; no user-facing doc
describes cron errors)
## Risk
- `jobs.json`, `cron get`, the web cron page and the cron heartbeat
event now carry the failed turn's own wording (the vendor's message
today; a length bound at the source is a follow-up) instead of one fixed
sentence.
- `TurnHandle.result()` resolves with a `TurnFailed` for a named
failure. Any out-of-tree submitter that read `outcome is None` as "did
not succeed" now takes the success branch for a failed turn; in-tree
only cron reads the value.
- Cron run history draws a failed or cancelled run as failed instead of
ok, and the phantom error row is gone.
- Rollback: revert the three commits; no persisted shape changes.
- [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-fable-5-1) <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>
## Summary
The three DAG control tools -- `cancel_dag`, `dag_status`, `resolve_dag_node` -- are
withheld from the provider schema on purpose, so the per-turn tool list carries nothing a
conversation that never starts a graph has any use for. The consequence is that the only
thing a model ever reads about them is another tool's result text, and that text retold
their arguments by hand in three separate places. The retellings had drifted: the
exception report spelled `decision`, the foreground report named no arguments at all, and
the orchestration guide gave a third wording. A model working from a JSON example in prose
rather than from a declared field reached for `action` instead of `decision` three runs in
a row and lost a call each time.
Each advertisement now carries the tool's own definition, generated from the registry, in
the same shape a visible tool gets. Three decisions worth naming:
- `ToolRegistry.hidden_definition` follows the same snapshot-or-live rule `get_definitions`
already uses, and refuses a tool that is *not* hidden -- a visible tool is already in the
array, so re-advertising it is the duplication this exists to end, and that is now
structurally impossible rather than a convention.
- `resolve_dag_node` authors `to_schema` to declare its shape dynamic. Its node schema
carries a `subagent` enum built from the hot-appliable agent table, so the snapshot taken
at wiring time would advertise the roster as it stood when the loop was built.
- The replan field's node shape is referenced, not inlined. `run_subagent_dag` is not
schema-hidden, so pointing at that shape costs 455 tokens where inlining it cost 1251.
The pointer names both routes rather than asserting residency: the tool list, or
`tool_search` for the graph tool when the list does not carry it, because
`DEFAULT_ALWAYS_VISIBLE` deliberately omits `run_subagent_dag` and above the compaction
threshold it is cataloged rather than offered. It travels in `description` rather than
`$comment`, which JSON Schema defines as a note to developers that implementations must
not present -- a normalizing provider would be entitled to drop it and leave the field
an empty object. A test pins both the route and the key.
The orchestration guide keeps what the three decisions mean and drops how to spell them, so
the field names now live only where they are generated. That guide's body reaches the model
only when it calls `read_skill`, while the report always arrives, so the authoritative copy
moved from the on-demand surface to the unconditional one.
The three tools remain absent from the provider schema. Nothing about the per-turn tool
list changes, and a conversation that never starts a graph pays nothing.
Deliberately not changed, having been considered:
- The two one-field tools are advertised in full even though the prose above them already
spells their only argument, which makes their 211 tokens largely redundant. Left for a
follow-up rather than special-cased here.
- The exception report keeps its two hand-written invocations beside the generated schema.
The foreground path wrapped that report and appended the definition a second time; it no
longer does, and a test pins the count at one.
They carry the concrete run and node ids and the judgement about when replanning is the
right answer, which a schema cannot express. A test reads the field names back out of
those invocations and requires each to be one the tool still declares, so the two halves
cannot drift apart silently.
- The CLI playbook path builds a graph tool without a renderer, matching its existing
omission of the reachability predicate: there is no model on that path to advertise to.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
- `pytest` over the dag, registry, tool-search, wiring, subagent, playbook and skill
selection: 3282 passed, 5 skipped. The five skips are pre-existing and environmental
(they document that an effective uid overriding the write bit is answered yes).
- Six mutants, each killed by the test written for it:
`hidden_definition` returning nothing kills 3; removing the node-shape reference kills 2;
dropping the `to_schema` declaration kills 1; silencing the graph tool's accessor kills
2; stopping the report from appending the schema kills 1; flipping the node-shape
pointer to `$comment` kills 1.
- `lint-imports`: 8 contracts kept, 0 broken. The GitLab pipeline does not run this.
- `ruff check` and `ruff format --check` over every changed Python file: clean.
- `scripts/check_commit_messages.py`, `scripts/check_source_language.py` and
`scripts/check_large_files.py` over the branch range: all pass. The pipeline runs none of
these three.
- Rendered the finished text at each of the three code sites and read it as the model
receives it. That is what caught two defects the diff did not show: a missing separator
that ran a JSON object straight into the next sentence, and the `$comment` field above.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] User-facing docs or screenshots are updated when needed
## Risk
Model-facing text changes on three paths, and the orchestration guide loses its copy of the
argument shapes. A model that had learned the old prose still finds every field name, since
the generated schema names them all. No wire shape, no stored payload and no provider tool
list changes, so there is nothing for an existing client to renegotiate.
`hidden_definition` exposes only tools their owner hid from the schema, and only to the text
that already names them. It refuses everything else, so it cannot be used to read out a
schema the caller was not already entitled to call.
Rollback is a revert: the advertisement is additive text plus one new module, and the paths
that consume it degrade to their previous wording when the renderer is absent -- which is
the state a tool built without a loop is already in, and is covered by tests.
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
N/A
## Summary
The three DAG control tools -- `cancel_dag`, `dag_status`, `resolve_dag_node` -- are
withheld from the provider schema on purpose, so the per-turn tool list carries nothing a
conversation that never starts a graph has any use for. The consequence is that the only
thing a model ever reads about them is another tool's result text, and that text retold
their arguments by hand in three separate places. The retellings had drifted: the
exception report spelled `decision`, the foreground report named no arguments at all, and
the orchestration guide gave a third wording. A model working from a JSON example in prose
rather than from a declared field reached for `action` instead of `decision` three runs in
a row and lost a call each time.
Each advertisement now carries the tool's own definition, generated from the registry, in
the same shape a visible tool gets. Three decisions worth naming:
- `ToolRegistry.hidden_definition` follows the same snapshot-or-live rule `get_definitions`
already uses, and refuses a tool that is *not* hidden -- a visible tool is already in the
array, so re-advertising it is the duplication this exists to end, and that is now
structurally impossible rather than a convention.
- `resolve_dag_node` authors `to_schema` to declare its shape dynamic. Its node schema
carries a `subagent` enum built from the hot-appliable agent table, so the snapshot taken
at wiring time would advertise the roster as it stood when the loop was built.
- The replan field's node shape is referenced, not inlined. `run_subagent_dag` is not
schema-hidden, so pointing at that shape costs 455 tokens where inlining it cost 1251.
The pointer names both routes rather than asserting residency: the tool list, or
`tool_search` for the graph tool when the list does not carry it, because
`DEFAULT_ALWAYS_VISIBLE` deliberately omits `run_subagent_dag` and above the compaction
threshold it is cataloged rather than offered. It travels in `description` rather than
`$comment`, which JSON Schema defines as a note to developers that implementations must
not present -- a normalizing provider would be entitled to drop it and leave the field
an empty object. A test pins both the route and the key.
The orchestration guide keeps what the three decisions mean and drops how to spell them, so
the field names now live only where they are generated. That guide's body reaches the model
only when it calls `read_skill`, while the report always arrives, so the authoritative copy
moved from the on-demand surface to the unconditional one.
The three tools remain absent from the provider schema. Nothing about the per-turn tool
list changes, and a conversation that never starts a graph pays nothing.
Deliberately not changed, having been considered:
- The two one-field tools are advertised in full even though the prose above them already
spells their only argument, which makes their 211 tokens largely redundant. Left for a
follow-up rather than special-cased here.
- The exception report keeps its two hand-written invocations beside the generated schema.
The foreground path wrapped that report and appended the definition a second time; it no
longer does, and a test pins the count at one.
They carry the concrete run and node ids and the judgement about when replanning is the
right answer, which a schema cannot express. A test reads the field names back out of
those invocations and requires each to be one the tool still declares, so the two halves
cannot drift apart silently.
- The CLI playbook path builds a graph tool without a renderer, matching its existing
omission of the reachability predicate: there is no model on that path to advertise to.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
- `pytest` over the dag, registry, tool-search, wiring, subagent, playbook and skill
selection: 3282 passed, 5 skipped. The five skips are pre-existing and environmental
(they document that an effective uid overriding the write bit is answered yes).
- Six mutants, each killed by the test written for it:
`hidden_definition` returning nothing kills 3; removing the node-shape reference kills 2;
dropping the `to_schema` declaration kills 1; silencing the graph tool's accessor kills
2; stopping the report from appending the schema kills 1; flipping the node-shape
pointer to `$comment` kills 1.
- `lint-imports`: 8 contracts kept, 0 broken. The GitLab pipeline does not run this.
- `ruff check` and `ruff format --check` over every changed Python file: clean.
- `scripts/check_commit_messages.py`, `scripts/check_source_language.py` and
`scripts/check_large_files.py` over the branch range: all pass. The pipeline runs none of
these three.
- Rendered the finished text at each of the three code sites and read it as the model
receives it. That is what caught two defects the diff did not show: a missing separator
that ran a JSON object straight into the next sentence, and the `$comment` field above.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] User-facing docs or screenshots are updated when needed
## Risk
Model-facing text changes on three paths, and the orchestration guide loses its copy of the
argument shapes. A model that had learned the old prose still finds every field name, since
the generated schema names them all. No wire shape, no stored payload and no provider tool
list changes, so there is nothing for an existing client to renegotiate.
`hidden_definition` exposes only tools their owner hid from the schema, and only to the text
that already names them. It refuses everything else, so it cannot be used to read out a
schema the caller was not already entitled to call.
Rollback is a revert: the advertisement is additive text plus one new module, and the paths
that consume it degrade to their previous wording when the renderer is absent -- which is
the state a tool built without a loop is already in, and is covered by tests.
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
N/A
## Summary
`exec` gains two lanes, and the on-call plugin's own exec retires onto them.
- `machine=<registered id>` runs a short look on a registered machine through the connection registry (capped at 60 s, killed on both ends; longer work is a job). Looked up through the registry's `load()`; the refusal for an unknown id lists the machines the way `shown()` renders them, no address.
- `run_in_background` runs long mechanical work on this computer under a managed log. The two lanes never combine, which closes the accounting bypass where jobs were driven over raw ssh past the ledger.
- The local machine-lane command runs in its own session and the cap kills the whole group (TERM, grace, KILL); platform-aware, with `taskkill /T /F` where `os.killpg` does not exist.
- `raven connection add` keeps an ssh alias so transfers need no address in prompts.
- `ops_exec` retires onto trunk exec; a cap kill routes by the command's shape (transfers to the background lane, jobs to `ops_submit`).
Stacked on `fix/oncall-flow-submit-and-launcher`: until that merges, this MR shows its six commits too; after it merges the diff reduces to the seven commits of this branch.
## Type
- [x] Feature
## Verification
```
uv run ruff check raven tests agents && uv run ruff format --check raven tests agents # clean
uv run pytest tests/test_shell_*.py tests/test_cli_ops_connection_commands.py tests/test_agents_oncall_flow_case_dict_tools.py tests/test_agents_oncall_flow_hooks.py tests/test_agents_oncall_flow_tools.py tests/test_agents_oncall_flow_watcher.py tests/test_agents_oncall_launcher.py tests/test_agent_loop_token_budget.py -q # 386 passed
uv run python scripts/check_commit_messages.py origin/main..HEAD # clean
```
Field check: four launcher shapes run on the GPU machine's real shell on 2026-09-03 (self-detaching command refused, non-zero rc recorded, group kill leaves nothing behind).
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] 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
`exec` accepts two new optional parameters; `ops_exec` is gone from the on-call tool set (the model-facing text no longer names it). The machine lane hands the model no address or credential. Rollback is a revert of the squash commit.
## Related Issues
Split from !476 (closed), retargeted at main. Merge after `fix/oncall-flow-submit-and-launcher`.
## Summary
`exec` gains two lanes, and the on-call plugin's own exec retires onto them.
- `machine=<registered id>` runs a short look on a registered machine through the connection registry (capped at 60 s, killed on both ends; longer work is a job). Looked up through the registry's `load()`; the refusal for an unknown id lists the machines the way `shown()` renders them, no address.
- `run_in_background` runs long mechanical work on this computer under a managed log. The two lanes never combine, which closes the accounting bypass where jobs were driven over raw ssh past the ledger.
- The local machine-lane command runs in its own session and the cap kills the whole group (TERM, grace, KILL); platform-aware, with `taskkill /T /F` where `os.killpg` does not exist.
- `raven connection add` keeps an ssh alias so transfers need no address in prompts.
- `ops_exec` retires onto trunk exec; a cap kill routes by the command's shape (transfers to the background lane, jobs to `ops_submit`).
Stacked on `fix/oncall-flow-submit-and-launcher`: until that merges, this MR shows its six commits too; after it merges the diff reduces to the seven commits of this branch.
## Type
- [x] Feature
## Verification
```
uv run ruff check raven tests agents && uv run ruff format --check raven tests agents # clean
uv run pytest tests/test_shell_*.py tests/test_cli_ops_connection_commands.py tests/test_agents_oncall_flow_case_dict_tools.py tests/test_agents_oncall_flow_hooks.py tests/test_agents_oncall_flow_tools.py tests/test_agents_oncall_flow_watcher.py tests/test_agents_oncall_launcher.py tests/test_agent_loop_token_budget.py -q # 386 passed
uv run python scripts/check_commit_messages.py origin/main..HEAD # clean
```
Field check: four launcher shapes run on the GPU machine's real shell on 2026-09-03 (self-detaching command refused, non-zero rc recorded, group kill leaves nothing behind).
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] 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
`exec` accepts two new optional parameters; `ops_exec` is gone from the on-call tool set (the model-facing text no longer names it). The machine lane hands the model no address or credential. Rollback is a revert of the squash commit.
## Related Issues
Split from !476 (closed), retargeted at main. Merge after `fix/oncall-flow-submit-and-launcher`.
## Summary
Two things a reader reported about the floating panel: dragging it sometimes fought the page behind, and it could not be pushed to the top of the window. Measured on the running page, that is three causes.
**The handle is mostly buttons.** It carries the tab strip, and the drag refused to start on a button -- so of its 298px, **182 could not be grabbed**, and the rest was broken into 3px slivers between the tabs. Worse, refusing meant the press fell through untouched and the browser began selecting text across the page: what reads as the panel's drag fighting the page is the panel not dragging at all.
A press now begins a gesture wherever it lands, and the gesture decides: past `DESK_DRAG_THRESHOLD` it is a drag, under it the tab keeps its click. A drag that ends on a tab swallows the click it would otherwise have fired, so one gesture does one thing.
**The magnet ran on every move.** It belongs on the release. Running it during the drag froze the panel in a band around the anchor -- and the anchor is at the top of the window, which is why the panel would not go there.
**The press climbed.** `resize`, directly below, has always stopped propagation, and so does the scrollbar thumb in `shell/scrollbars.ts`. This handler did not, so a React ancestor acting on the same gesture -- a pane raising itself on `onPointerDown`, a pane header that is a drag handle of its own -- got it too.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Measured before and after, same probe, real browser
```
grabbing a tab and dragging
before 1288,54 -> 1288,54 did not move
after 1288,54 -> 520,575 moved, and the tab did not switch
pushing up (mouse y -> panel top, * = snapped to the anchor)
before 200->175 150->125 120->95 100->54* 90->54* 80->54* 60->54* 40->15 20->8
|___ four consecutive moves frozen ___|
after 200->175 150->125 120->95 100->75 90->65 80->55 60->35 40->15 20->8
tracks the hand the whole way
```
## What `stopPropagation` actually buys, since I first assumed more
React dispatches from the root, so `stopPropagation` in a synthetic handler stops **React** ancestors and cannot take the event back from a native listener further up -- nor from a document-level capture listener, which ran before the target at all. My first test asserted a native ancestor listener would not fire and failed, which is how I found out. The case now pins the half that is in reach, and says why in as many words.
## Verification
```
make lint-ui gen:check 162 methods, type-check
make lint-tui lint, lint:rpc, lint:i18n, type-check
make test-ui 1384 tests passed
```
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed -- no docs surface; the before/after measurement above is the record
Six cases, each with a killing mutation: the button early-return restored, the click not swallowed after a drag, the threshold removed, and this handler's `stopPropagation` dropped.
**Two mutations survived my first pass and both were my harness, not the code.** One replaced the first of two identical `stopPropagation` lines and so hit `resize` instead of `drag`. The other removed the threshold against a case that pressed and released without a single `pointermove`, so the comparison was never reached -- that case now moves one pixel, which is the only shape that can tell a threshold from no threshold.
## Risk
- [x] Security impact considered -- no new data, no new network or storage surface; the change is which element a pointer gesture reaches
- [x] Backward compatibility considered -- `deskGeometry` exports one new constant and no existing signature changed; the magnet still runs, on release instead of every frame, so a released panel lands where it did before
- [x] Rollback path is clear for risky changes -- a two-commit revert restores the button early-return and the per-move magnet; nothing persists across it
## Related Issues
N/A
## The geometry claims are not in the unit suite
happy-dom lays nothing out, so `clampGeometry` collapses every position to the gutter and the anchor cannot be computed: "follows the hand through the anchor" and "goes home when released nearby" would both have passed either way. I wrote them, watched them pass for the wrong reason, and moved them to the browser measurement above. What the unit cases hold is what the DOM can answer without a layout -- which element the press reaches, whether the panel detached, whether the tab's click survived.
## Swept
`mr-review-patterns` pre-submit sweep, over the branch diff.
- **1 (a write location moved)** -- the magnet's call site moved from `move` to `finish`, which is the fix. `clampGeometry` takes its place during the drag, so the position is still clamped on every frame.
- **2 (a value with several entry points)** -- `geom` has three writers: this drag, `resize`, and the window-resize clamp. Only the drag changed; `resize` already stopped propagation and is untouched.
- **3d (several lanes through one sink)** -- one handle, one gesture, one decision point.
- **4** -- failing test IDs diffed against the base, not counts: 0 introduced.
- **9 (error handling)** -- `finish` still runs on `pointerup`, `pointercancel` and `lostpointercapture`, and now also settles the magnet there, so a cancelled gesture leaves a clamped position rather than a half-snapped one.
- **11** -- `npm ci` in both `ui-web` and `ui-tui`; this worktree was fresh, and `make lint-tui` failed on a missing eslint until it was installed.
Not applicable: 3, 3b, 3c, 3e, 4b-4d, 5, 5b, 6, 6b, 6c, 7, 7b, 8, 10.
## Summary
Two things a reader reported about the floating panel: dragging it sometimes fought the page behind, and it could not be pushed to the top of the window. Measured on the running page, that is three causes.
**The handle is mostly buttons.** It carries the tab strip, and the drag refused to start on a button -- so of its 298px, **182 could not be grabbed**, and the rest was broken into 3px slivers between the tabs. Worse, refusing meant the press fell through untouched and the browser began selecting text across the page: what reads as the panel's drag fighting the page is the panel not dragging at all.
A press now begins a gesture wherever it lands, and the gesture decides: past `DESK_DRAG_THRESHOLD` it is a drag, under it the tab keeps its click. A drag that ends on a tab swallows the click it would otherwise have fired, so one gesture does one thing.
**The magnet ran on every move.** It belongs on the release. Running it during the drag froze the panel in a band around the anchor -- and the anchor is at the top of the window, which is why the panel would not go there.
**The press climbed.** `resize`, directly below, has always stopped propagation, and so does the scrollbar thumb in `shell/scrollbars.ts`. This handler did not, so a React ancestor acting on the same gesture -- a pane raising itself on `onPointerDown`, a pane header that is a drag handle of its own -- got it too.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Measured before and after, same probe, real browser
```
grabbing a tab and dragging
before 1288,54 -> 1288,54 did not move
after 1288,54 -> 520,575 moved, and the tab did not switch
pushing up (mouse y -> panel top, * = snapped to the anchor)
before 200->175 150->125 120->95 100->54* 90->54* 80->54* 60->54* 40->15 20->8
|___ four consecutive moves frozen ___|
after 200->175 150->125 120->95 100->75 90->65 80->55 60->35 40->15 20->8
tracks the hand the whole way
```
## What `stopPropagation` actually buys, since I first assumed more
React dispatches from the root, so `stopPropagation` in a synthetic handler stops **React** ancestors and cannot take the event back from a native listener further up -- nor from a document-level capture listener, which ran before the target at all. My first test asserted a native ancestor listener would not fire and failed, which is how I found out. The case now pins the half that is in reach, and says why in as many words.
## Verification
```
make lint-ui gen:check 162 methods, type-check
make lint-tui lint, lint:rpc, lint:i18n, type-check
make test-ui 1384 tests passed
```
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed -- no docs surface; the before/after measurement above is the record
Six cases, each with a killing mutation: the button early-return restored, the click not swallowed after a drag, the threshold removed, and this handler's `stopPropagation` dropped.
**Two mutations survived my first pass and both were my harness, not the code.** One replaced the first of two identical `stopPropagation` lines and so hit `resize` instead of `drag`. The other removed the threshold against a case that pressed and released without a single `pointermove`, so the comparison was never reached -- that case now moves one pixel, which is the only shape that can tell a threshold from no threshold.
## Risk
- [x] Security impact considered -- no new data, no new network or storage surface; the change is which element a pointer gesture reaches
- [x] Backward compatibility considered -- `deskGeometry` exports one new constant and no existing signature changed; the magnet still runs, on release instead of every frame, so a released panel lands where it did before
- [x] Rollback path is clear for risky changes -- a two-commit revert restores the button early-return and the per-move magnet; nothing persists across it
## Related Issues
N/A
## The geometry claims are not in the unit suite
happy-dom lays nothing out, so `clampGeometry` collapses every position to the gutter and the anchor cannot be computed: "follows the hand through the anchor" and "goes home when released nearby" would both have passed either way. I wrote them, watched them pass for the wrong reason, and moved them to the browser measurement above. What the unit cases hold is what the DOM can answer without a layout -- which element the press reaches, whether the panel detached, whether the tab's click survived.
## Swept
`mr-review-patterns` pre-submit sweep, over the branch diff.
- **1 (a write location moved)** -- the magnet's call site moved from `move` to `finish`, which is the fix. `clampGeometry` takes its place during the drag, so the position is still clamped on every frame.
- **2 (a value with several entry points)** -- `geom` has three writers: this drag, `resize`, and the window-resize clamp. Only the drag changed; `resize` already stopped propagation and is untouched.
- **3d (several lanes through one sink)** -- one handle, one gesture, one decision point.
- **4** -- failing test IDs diffed against the base, not counts: 0 introduced.
- **9 (error handling)** -- `finish` still runs on `pointerup`, `pointercancel` and `lostpointercapture`, and now also settles the magnet there, so a cancelled gesture leaves a clamped position rather than a half-snapped one.
- **11** -- `npm ci` in both `ui-web` and `ui-tui`; this worktree was fresh, and `make lint-tui` failed on a missing eslint until it was installed.
Not applicable: 3, 3b, 3c, 3e, 4b-4d, 5, 5b, 6, 6b, 6c, 7, 7b, 8, 10.
## Summary
The raven-research deep-research agent's three modes were three sizes of one budget: high and max differed only in knobs with a trigger (an evidence round waiting on a reviewer rejection, a saturation ladder waiting on a dry search streak), and on a five-question batch neither trigger arrived, so the two modes ran one flow under two labels and their paired cost differences came out inverted. Each mode now changes which gate ends the turn.
- medium keeps the sufficiency release and gains plainFirst: the first model call of a turn has the web tools withheld and a `request_research` tool added; a plain draft goes to an independent judge (settled-knowledge and soundness in one call, low reasoning effort), and a judged unsourced draft skips the evidence reviewer. On a FreshQA / CHARM set the frame produced no false plain answer over 55 research-required questions and answered 9 of 10 settled ones without a research round (7 to 67 s, 4 to 5k tokens).
- high drops the release door and terminates on the reviewer: three revisions, final-draft review, evidence round.
- max adds an evidence floor: a draft resting on fewer than 18 readable pages from 8 distinct sites is bounced back to research with a note naming the shortfall, at most twice, then released to the reviewer with `unmet` recorded. The floor is the only knob between high and max that is consulted on every draft.
- the reviewer asks for its verdict as a forced tool call (text kept as fallback), runs one uninterrupted attempt (300 s in medium, 360 s in high and max) with 16384 tokens, and records why it failed open (`timeout`, `truncated`, `no_content`, `unparsed`, `call_failed`). On the first hard batch it failed open 13/18 times from sliced retries that cancelled calls about to finish, 8192-token truncation and verdicts without a `pass` field.
- the sufficiency judge no longer passes a transport `timeout` the trunk provider rejects (every call raised TypeError and failed open in a millisecond, so medium's release door had never worked on this side); a listing stage (`sufficiency.judgeListing`) can release before any page is opened.
- the product label moves to `dr@3.7-filetools-askuser-derive-numeric-cite-rank-tiers-plain`; the retired labels resolve to it.
Product-only surface, none of it in the vendored fork: `evidenceFloor`, `plainFirst`, `sufficiency.judgeListing`. The parity tests (`test_agents_research_launcher.py`, `test_agents_research_flow_parity.py`) declare each with a reason and hold the twin's remaining fields equal to the fork's.
Review findings folded in before submission: the sufficiency record keeps a per-stage outcome and a sticky `fired` flag; the evidence floor reads the trail's thin-page bar rather than a second copy of the constant; `plainFirst` refuses to load without the conversation frame that marks a first turn; the first-reply note is registered with the strict echo recogniser; the verdict tests bind their provider stub to the trunk `chat_with_retry` signature.
Deliberately not done here, for a follow-up: `_first_json_object` in `plain_first.py` duplicates the extraction ladder in `support/_verdict.py`; the interpolated escalate and floor notes are not in the echo recogniser; the reviewer's binary verdict sends wording problems into a research round (a two-tier verdict, contradicted vs unsupported, is the next step, and is what would make a faster reviewer model usable); the 18-page floor was derived from a five-question high distribution and should be re-derived on a larger batch.
## Type
- [ ] Fix
- [x] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
Commands run at the branch head, in this worktree:
```
uv run --frozen pytest tests/test_agents_research_flow_plain_first.py tests/test_agents_research_flow_verify_verdict.py \
tests/test_agents_research_flow_verify_effort.py tests/test_agents_research_flow_sufficiency.py \
tests/test_agents_research_flow_evidence_floor.py tests/test_agents_research_harness_text.py \
tests/test_agents_research_launcher.py tests/test_agents_research_flow_parity.py \
tests/test_agents_research_mode_tiers.py tests/test_agents_research_flow_finalize.py
# 194 passed
uv run --frozen pytest tests --ignore=tests/integration -k "research or dr_flow or harness_text or loop_hooks or process_appendix or final_shape or fetch_gate"
# 911 passed, 8 skipped (missing channel SDKs and the render extra)
uv run --frozen pytest tests --ignore=tests/integration
# 7 failed, 19368 passed, 151 skipped. The same run over a `git archive origin/main` tree
# through the same interpreter: 12 failed, 19289 passed. Failing-ID diff: 0 introduced by
# this branch. The 7 shared failures are pre-existing on main in this sandbox (doctor's
# memory path, NAT64 IPv6 cases, and friends); the 5 extra on the archive side are
# git-dependent tests that cannot run outside a checkout.
uv run --frozen ruff check agents/raven-research tests/test_agents_research_* # All checks passed
uv run --frozen ruff format --check agents/raven-research tests/test_agents_research_* # 68 files already formatted
make check-vendored-subagents check-vendored-invariants # exit 0
uv run --frozen python scripts/check_source_language.py origin/main..HEAD # exit 0
GITHUB_PR_BASE_SHA=$(git rev-parse origin/main) uv run --frozen python scripts/check_large_files.py # exit 0
make check-commits # commitlint + scripts/check_commit_messages.py, exit 0
```
Measured behaviour (deepseek-v4-flash-0731 via openrouter, Tavily pages, 2026-09-07):
- Plain-first classification, FreshQA (never / slow / fast-changing, false premise) plus CHARM memorization, 80 offline questions and 30 live medium turns: 0 false plain answers over the research-required questions (45 offline, 10 live); settled questions answered without a research round 29/35 offline and 9/10 live at low judge effort (7 to 67 s, 4 to 5k tokens per turn). False-premise questions the judge accepted (6/10) were all correct: the draft rejected the premise.
- Six multi-source hard queries, high and max run twice each with the fixed reviewer: the reviewer delivered a verdict in 22 of 23 reviews (13 of 18 failed open before the fix); the one fail-open is a 16384-token truncation on the longest draft and is named as such in the ledger. Rejections 3 (two high, one max), each buying an evidence round. Paired on the same query and pass, max exceeded high on readable pages 9/11, fetches 10/11, tokens 9/11, wall time 6/11. Means: high 15.3 pages / 27.5 min / 477k tokens, max 19.3 pages / 26.4 min / 625k tokens. One high run was cancelled at the driver's 75-minute timeout after a runaway 101k-token generation and is excluded. The floor released one draft unmet after two bounces (a thin corpus), the designed degrade-to-high path.
- Earlier six-query batch, all three modes, key-fact rubric: medium 30.5, high 32.5, max 31.0; blind five-dimension judge ranked max first on 7/11 with completeness and sourcing above high and correctness below it. Read: the floor buys coverage, not correctness; the quality lever is the reviewer, which is why it was fixed here and why the two-tier verdict is the named follow-up.
Not verified: quality re-grading of the rerun's drafts; behaviour under a provider other than openrouter/deepseek (the reviewer's forced tool call is in the trunk `LLMProvider.chat_with_retry` protocol, and the verdict tests bind their stub to that signature).
Rollback budget: max's worst case is exactly the loop's cap of 8 hook rollbacks per turn (spin break 1, salvage nudge 1, report-shape bounce 1, revisions 3, floor bounces 2), pinned by a test; a new bouncing gate has to take room from another.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] User-facing docs or screenshots are updated when needed (CHANGELOG; the mode picker blurb)
## Risk
- [x] Security impact considered: no new network surface, no credentials; the new `request_research` tool is model-facing only and executes nothing.
- [x] Backward compatibility considered: configs stamped with a retired label are refused with the successor named, as before; `verify.attemptHttpTimeoutSeconds` is kept for twin parity and logged as not honoured; every other new knob defaults off.
- [x] Rollback path is clear: revert the commit. Mode files and the flow config are the only runtime inputs that changed.
User-visible behaviour: medium may answer a settled general-knowledge question without sources and says so; high and max take longer than before on hard questions (measured means in Verification). max's floor can add one bounce per turn; past two bounces it degrades to high.
## Related Issues
N/A
## Summary
The raven-research deep-research agent's three modes were three sizes of one budget: high and max differed only in knobs with a trigger (an evidence round waiting on a reviewer rejection, a saturation ladder waiting on a dry search streak), and on a five-question batch neither trigger arrived, so the two modes ran one flow under two labels and their paired cost differences came out inverted. Each mode now changes which gate ends the turn.
- medium keeps the sufficiency release and gains plainFirst: the first model call of a turn has the web tools withheld and a `request_research` tool added; a plain draft goes to an independent judge (settled-knowledge and soundness in one call, low reasoning effort), and a judged unsourced draft skips the evidence reviewer. On a FreshQA / CHARM set the frame produced no false plain answer over 55 research-required questions and answered 9 of 10 settled ones without a research round (7 to 67 s, 4 to 5k tokens).
- high drops the release door and terminates on the reviewer: three revisions, final-draft review, evidence round.
- max adds an evidence floor: a draft resting on fewer than 18 readable pages from 8 distinct sites is bounced back to research with a note naming the shortfall, at most twice, then released to the reviewer with `unmet` recorded. The floor is the only knob between high and max that is consulted on every draft.
- the reviewer asks for its verdict as a forced tool call (text kept as fallback), runs one uninterrupted attempt (300 s in medium, 360 s in high and max) with 16384 tokens, and records why it failed open (`timeout`, `truncated`, `no_content`, `unparsed`, `call_failed`). On the first hard batch it failed open 13/18 times from sliced retries that cancelled calls about to finish, 8192-token truncation and verdicts without a `pass` field.
- the sufficiency judge no longer passes a transport `timeout` the trunk provider rejects (every call raised TypeError and failed open in a millisecond, so medium's release door had never worked on this side); a listing stage (`sufficiency.judgeListing`) can release before any page is opened.
- the product label moves to `dr@3.7-filetools-askuser-derive-numeric-cite-rank-tiers-plain`; the retired labels resolve to it.
Product-only surface, none of it in the vendored fork: `evidenceFloor`, `plainFirst`, `sufficiency.judgeListing`. The parity tests (`test_agents_research_launcher.py`, `test_agents_research_flow_parity.py`) declare each with a reason and hold the twin's remaining fields equal to the fork's.
Review findings folded in before submission: the sufficiency record keeps a per-stage outcome and a sticky `fired` flag; the evidence floor reads the trail's thin-page bar rather than a second copy of the constant; `plainFirst` refuses to load without the conversation frame that marks a first turn; the first-reply note is registered with the strict echo recogniser; the verdict tests bind their provider stub to the trunk `chat_with_retry` signature.
Deliberately not done here, for a follow-up: `_first_json_object` in `plain_first.py` duplicates the extraction ladder in `support/_verdict.py`; the interpolated escalate and floor notes are not in the echo recogniser; the reviewer's binary verdict sends wording problems into a research round (a two-tier verdict, contradicted vs unsupported, is the next step, and is what would make a faster reviewer model usable); the 18-page floor was derived from a five-question high distribution and should be re-derived on a larger batch.
## Type
- [ ] Fix
- [x] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
Commands run at the branch head, in this worktree:
```
uv run --frozen pytest tests/test_agents_research_flow_plain_first.py tests/test_agents_research_flow_verify_verdict.py \
tests/test_agents_research_flow_verify_effort.py tests/test_agents_research_flow_sufficiency.py \
tests/test_agents_research_flow_evidence_floor.py tests/test_agents_research_harness_text.py \
tests/test_agents_research_launcher.py tests/test_agents_research_flow_parity.py \
tests/test_agents_research_mode_tiers.py tests/test_agents_research_flow_finalize.py
# 194 passed
uv run --frozen pytest tests --ignore=tests/integration -k "research or dr_flow or harness_text or loop_hooks or process_appendix or final_shape or fetch_gate"
# 911 passed, 8 skipped (missing channel SDKs and the render extra)
uv run --frozen pytest tests --ignore=tests/integration
# 7 failed, 19368 passed, 151 skipped. The same run over a `git archive origin/main` tree
# through the same interpreter: 12 failed, 19289 passed. Failing-ID diff: 0 introduced by
# this branch. The 7 shared failures are pre-existing on main in this sandbox (doctor's
# memory path, NAT64 IPv6 cases, and friends); the 5 extra on the archive side are
# git-dependent tests that cannot run outside a checkout.
uv run --frozen ruff check agents/raven-research tests/test_agents_research_* # All checks passed
uv run --frozen ruff format --check agents/raven-research tests/test_agents_research_* # 68 files already formatted
make check-vendored-subagents check-vendored-invariants # exit 0
uv run --frozen python scripts/check_source_language.py origin/main..HEAD # exit 0
GITHUB_PR_BASE_SHA=$(git rev-parse origin/main) uv run --frozen python scripts/check_large_files.py # exit 0
make check-commits # commitlint + scripts/check_commit_messages.py, exit 0
```
Measured behaviour (deepseek-v4-flash-0731 via openrouter, Tavily pages, 2026-09-07):
- Plain-first classification, FreshQA (never / slow / fast-changing, false premise) plus CHARM memorization, 80 offline questions and 30 live medium turns: 0 false plain answers over the research-required questions (45 offline, 10 live); settled questions answered without a research round 29/35 offline and 9/10 live at low judge effort (7 to 67 s, 4 to 5k tokens per turn). False-premise questions the judge accepted (6/10) were all correct: the draft rejected the premise.
- Six multi-source hard queries, high and max run twice each with the fixed reviewer: the reviewer delivered a verdict in 22 of 23 reviews (13 of 18 failed open before the fix); the one fail-open is a 16384-token truncation on the longest draft and is named as such in the ledger. Rejections 3 (two high, one max), each buying an evidence round. Paired on the same query and pass, max exceeded high on readable pages 9/11, fetches 10/11, tokens 9/11, wall time 6/11. Means: high 15.3 pages / 27.5 min / 477k tokens, max 19.3 pages / 26.4 min / 625k tokens. One high run was cancelled at the driver's 75-minute timeout after a runaway 101k-token generation and is excluded. The floor released one draft unmet after two bounces (a thin corpus), the designed degrade-to-high path.
- Earlier six-query batch, all three modes, key-fact rubric: medium 30.5, high 32.5, max 31.0; blind five-dimension judge ranked max first on 7/11 with completeness and sourcing above high and correctness below it. Read: the floor buys coverage, not correctness; the quality lever is the reviewer, which is why it was fixed here and why the two-tier verdict is the named follow-up.
Not verified: quality re-grading of the rerun's drafts; behaviour under a provider other than openrouter/deepseek (the reviewer's forced tool call is in the trunk `LLMProvider.chat_with_retry` protocol, and the verdict tests bind their stub to that signature).
Rollback budget: max's worst case is exactly the loop's cap of 8 hook rollbacks per turn (spin break 1, salvage nudge 1, report-shape bounce 1, revisions 3, floor bounces 2), pinned by a test; a new bouncing gate has to take room from another.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] User-facing docs or screenshots are updated when needed (CHANGELOG; the mode picker blurb)
## Risk
- [x] Security impact considered: no new network surface, no credentials; the new `request_research` tool is model-facing only and executes nothing.
- [x] Backward compatibility considered: configs stamped with a retired label are refused with the successor named, as before; `verify.attemptHttpTimeoutSeconds` is kept for twin parity and logged as not honoured; every other new knob defaults off.
- [x] Rollback path is clear: revert the commit. Mode files and the flow config are the only runtime inputs that changed.
User-visible behaviour: medium may answer a settled general-knowledge question without sources and says so; high and max take longer than before on hard questions (measured means in Verification). max's floor can add one bounce per turn; past two bounces it degrades to high.
## Related Issues
N/A
## Summary
Adds ACP presets for six agents a machine may already have installed, and fixes three
defects that measuring them exposed.
**Presets.** Provenance is the official ACP registry (`registry.json`, schema 1.0.0), so
launch arguments were read as structured data rather than transcribed. Two launch shapes,
and which one a row gets is a fact about the package, not a preference:
- The package **is the agent** -- its npm `bin` is the product's own CLI and ACP is a flag
on it. The row names the bare executable, `copilot --acp`, so the agent that answers is
the one the user installed, at the version they chose, holding the login they already
granted. Fetching a second copy would run a build they never picked against the
credentials they did, and would report the agent as installed on a machine that lacks
it, because `_probe_acp` resolves `argv[0]` and an `npx` command always resolves. These
rows carry no version.
- The package is only an **ACP shim**, whose product lives elsewhere. Nobody installs a
shim on purpose, it holds no credential of its own, and there is no local build to defer
to, so raven fetches it, pinned, because an unpinned `npx -y` silently changes which
shim build runs. `SHIM_LAUNCHED_PRESETS` declares that split and a test holds every acp
command to it.
Shipped: `github_copilot`, `qwen_code`, `qoder`, `codebuddy`, `grok` (bare local) and `pi`
(the one shim). `opencode` also moves from a pinned npx fetch to `opencode acp` for the
same reason; a stored row is never re-merged from the preset table, so no already
configured agent changes.
Every row was measured through the whole chain before shipping: it completes a real turn,
renders its tool calls into the rows a reader gets, holds context across two prompts on
one session, resumes a session from a fresh process, and works as a spawn, a direct chat
and a DAG node.
**Ten further registry agents are deliberately held back.** They answer the handshake and
stop: nine wait on a credential their owner has to grant (a product sign-in, an API key,
an unfinished OAuth) and one refuses `session/load` with `-32603` while advertising it. A
roster entry that cannot run a task is worse than an absent one, because the model reads
the roster as the list of what it can delegate to. They are a separate change, once logged
in and re-measured.
**Three fixes, each from a real agent's frames.**
1. A tool call's own subject key beats a discriminator beside it. One agent sends
`{"variant": "ReadFile", "target_file": "hello.txt"}`; with no key matching, `argument`
fell through to its first-string-value sweep and dict order handed it the
discriminator, so the row read `read ReadFile` and never named the file. `target_file`
joins `SUBJECT_KEYS` after the file-path family, so a call carrying both still prefers
`file_path`.
2. One `toolCallId` is one call, however many opening frames carry it. The spec revises
with `tool_call_update`; one agent re-sends `tool_call` once it knows the kind, and
appending on every opening frame rendered a single read as two assistant rows with one
result to pair, leaving one dangling for good. A frame whose id is already open is now
treated as the revision it is, which also lets its finer `kind` name the call.
3. Statefulness follows `loadSession`, the capability its own call is gated on. Resuming an
acp instance is the agent's `session/load`, but `is_stateful` read
`sessionCapabilities.resume` and `_open_session` tested that first, so an agent
advertising `loadSession` alone was stateless and never reached the load call. Measured:
three shipped agents report `resume: false` with `loadSession: true`, and all three
resume correctly when it is called, replaying the transcript and recalling a token
planted before the reconnect. The reverse pairing was wrong the other way, promising a
resumability no call could deliver.
## Type
- [ ] Fix
- [x] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
Measured against real agents, not fixtures, under an isolated `RAVEN_HOME` so nothing
touched the developer's own config or capability store.
```
uv run pytest tests/test_subagent_acp.py tests/test_subagent_third_party.py \
tests/test_rpc_subagents.py tests/test_subagent_turn_rows.py -q # 506 passed
uv run pytest tests/ -k "subagent or preset or acp or dag or instance" -q
# 3309 passed, 3 skipped
uv run pytest tests/test_rpc_schema_match.py tests/test_living_docs.py \
tests/test_kernel_closure.py -q # 336 passed
uv run ruff check raven/ tests/ && uv run ruff format --check raven/ tests/ # clean
uv run lint-imports # 8 contracts kept, 0 broken
uv run python scripts/check_commit_messages.py origin/main..HEAD # exit 0
uv run python scripts/check_source_language.py origin/main..HEAD # exit 0
uv run python scripts/check_large_files.py origin/main..HEAD # exit 0
```
Each of the three fixes was written test-first and watched fail for the right reason
before the fix existed; the dedupe one reported `one call expected, got ['Read', 'read']`.
End to end, per shipped agent: `create_instance`, then a `spawn` planting a token, the
registry binding, a `chat` on the same handle recalling it, and a two-node DAG whose first
node reads a file with its own tool and whose second depends on it. All six pass every
step, dependency passing included, and the node transcript shows one call and one result
where fix 2 applies.
Checked and deliberately not fixed, with reasons:
- One agent's direct-chat recall failed on the first end-to-end run and passed on a
re-run, 2 passes to 1 miss. The binding and the resume both ran -- the session was bound
both times -- and the reply simply lacked that run's token. Cause unconfirmed, because
the harness discarded the reply text on a miss, which was the evidence needed. The same
agent was separately seen answering with a token from an unrelated earlier session, so
it appears to carry context of its own across ACP sessions.
- A preset's `description` renders into the roster the model reads, and these carry a
human install hint ("install with `npm i -g ...`"). The field is shared by the config
overlay and the roster with no human-only channel, and the probe's own failure message
names the missing executable and nothing else, so the hint stays where a user will
actually see it. The six pre-existing presets read the same way.
- Tool-call arguments are not streamed. One agent sends `tool_call_delta_chunk` frames the
collector ignores; the `tool_call` frame that follows carries the complete `rawInput`, so
no argument is lost, but a character-by-character live view would need those frames read.
- No dialect module was added. The two existing ones exist for frame shapes that carry
information nowhere else; every deviation found here was either cosmetic (the delta
chunks above) or an informational mirror of a request already answered through the
permission path.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
## Risk
Fix 3 changes which agents the model is told it can resume. Every consumer reads one
derived field, so the effect is uniform: an agent advertising `loadSession` now gets the
spawn schema's `instance` parameter, a standing strip row, and a place among the
direct-chat targets. A `session/load` that then fails already falls back to a fresh session
with a warning, so a wrongly widened gate degrades rather than breaks -- which matters
here, because one of the held-back agents advertises the capability and refuses the call.
The preset table itself is additive. A stored config row is never re-merged from it, so
`opencode`'s new command reaches only agents added after this lands.
Rollback is per commit: the presets, the three fixes, and the six-agent scoping are
separate and independent.
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
N/A
## Summary
Adds ACP presets for six agents a machine may already have installed, and fixes three
defects that measuring them exposed.
**Presets.** Provenance is the official ACP registry (`registry.json`, schema 1.0.0), so
launch arguments were read as structured data rather than transcribed. Two launch shapes,
and which one a row gets is a fact about the package, not a preference:
- The package **is the agent** -- its npm `bin` is the product's own CLI and ACP is a flag
on it. The row names the bare executable, `copilot --acp`, so the agent that answers is
the one the user installed, at the version they chose, holding the login they already
granted. Fetching a second copy would run a build they never picked against the
credentials they did, and would report the agent as installed on a machine that lacks
it, because `_probe_acp` resolves `argv[0]` and an `npx` command always resolves. These
rows carry no version.
- The package is only an **ACP shim**, whose product lives elsewhere. Nobody installs a
shim on purpose, it holds no credential of its own, and there is no local build to defer
to, so raven fetches it, pinned, because an unpinned `npx -y` silently changes which
shim build runs. `SHIM_LAUNCHED_PRESETS` declares that split and a test holds every acp
command to it.
Shipped: `github_copilot`, `qwen_code`, `qoder`, `codebuddy`, `grok` (bare local) and `pi`
(the one shim). `opencode` also moves from a pinned npx fetch to `opencode acp` for the
same reason; a stored row is never re-merged from the preset table, so no already
configured agent changes.
Every row was measured through the whole chain before shipping: it completes a real turn,
renders its tool calls into the rows a reader gets, holds context across two prompts on
one session, resumes a session from a fresh process, and works as a spawn, a direct chat
and a DAG node.
**Ten further registry agents are deliberately held back.** They answer the handshake and
stop: nine wait on a credential their owner has to grant (a product sign-in, an API key,
an unfinished OAuth) and one refuses `session/load` with `-32603` while advertising it. A
roster entry that cannot run a task is worse than an absent one, because the model reads
the roster as the list of what it can delegate to. They are a separate change, once logged
in and re-measured.
**Three fixes, each from a real agent's frames.**
1. A tool call's own subject key beats a discriminator beside it. One agent sends
`{"variant": "ReadFile", "target_file": "hello.txt"}`; with no key matching, `argument`
fell through to its first-string-value sweep and dict order handed it the
discriminator, so the row read `read ReadFile` and never named the file. `target_file`
joins `SUBJECT_KEYS` after the file-path family, so a call carrying both still prefers
`file_path`.
2. One `toolCallId` is one call, however many opening frames carry it. The spec revises
with `tool_call_update`; one agent re-sends `tool_call` once it knows the kind, and
appending on every opening frame rendered a single read as two assistant rows with one
result to pair, leaving one dangling for good. A frame whose id is already open is now
treated as the revision it is, which also lets its finer `kind` name the call.
3. Statefulness follows `loadSession`, the capability its own call is gated on. Resuming an
acp instance is the agent's `session/load`, but `is_stateful` read
`sessionCapabilities.resume` and `_open_session` tested that first, so an agent
advertising `loadSession` alone was stateless and never reached the load call. Measured:
three shipped agents report `resume: false` with `loadSession: true`, and all three
resume correctly when it is called, replaying the transcript and recalling a token
planted before the reconnect. The reverse pairing was wrong the other way, promising a
resumability no call could deliver.
## Type
- [ ] Fix
- [x] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
Measured against real agents, not fixtures, under an isolated `RAVEN_HOME` so nothing
touched the developer's own config or capability store.
```
uv run pytest tests/test_subagent_acp.py tests/test_subagent_third_party.py \
tests/test_rpc_subagents.py tests/test_subagent_turn_rows.py -q # 506 passed
uv run pytest tests/ -k "subagent or preset or acp or dag or instance" -q
# 3309 passed, 3 skipped
uv run pytest tests/test_rpc_schema_match.py tests/test_living_docs.py \
tests/test_kernel_closure.py -q # 336 passed
uv run ruff check raven/ tests/ && uv run ruff format --check raven/ tests/ # clean
uv run lint-imports # 8 contracts kept, 0 broken
uv run python scripts/check_commit_messages.py origin/main..HEAD # exit 0
uv run python scripts/check_source_language.py origin/main..HEAD # exit 0
uv run python scripts/check_large_files.py origin/main..HEAD # exit 0
```
Each of the three fixes was written test-first and watched fail for the right reason
before the fix existed; the dedupe one reported `one call expected, got ['Read', 'read']`.
End to end, per shipped agent: `create_instance`, then a `spawn` planting a token, the
registry binding, a `chat` on the same handle recalling it, and a two-node DAG whose first
node reads a file with its own tool and whose second depends on it. All six pass every
step, dependency passing included, and the node transcript shows one call and one result
where fix 2 applies.
Checked and deliberately not fixed, with reasons:
- One agent's direct-chat recall failed on the first end-to-end run and passed on a
re-run, 2 passes to 1 miss. The binding and the resume both ran -- the session was bound
both times -- and the reply simply lacked that run's token. Cause unconfirmed, because
the harness discarded the reply text on a miss, which was the evidence needed. The same
agent was separately seen answering with a token from an unrelated earlier session, so
it appears to carry context of its own across ACP sessions.
- A preset's `description` renders into the roster the model reads, and these carry a
human install hint ("install with `npm i -g ...`"). The field is shared by the config
overlay and the roster with no human-only channel, and the probe's own failure message
names the missing executable and nothing else, so the hint stays where a user will
actually see it. The six pre-existing presets read the same way.
- Tool-call arguments are not streamed. One agent sends `tool_call_delta_chunk` frames the
collector ignores; the `tool_call` frame that follows carries the complete `rawInput`, so
no argument is lost, but a character-by-character live view would need those frames read.
- No dialect module was added. The two existing ones exist for frame shapes that carry
information nowhere else; every deviation found here was either cosmetic (the delta
chunks above) or an informational mirror of a request already answered through the
permission path.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
## Risk
Fix 3 changes which agents the model is told it can resume. Every consumer reads one
derived field, so the effect is uniform: an agent advertising `loadSession` now gets the
spawn schema's `instance` parameter, a standing strip row, and a place among the
direct-chat targets. A `session/load` that then fails already falls back to a fresh session
with a warning, so a wrongly widened gate degrades rather than breaks -- which matters
here, because one of the held-back agents advertises the capability and refuses the call.
The preset table itself is additive. A stored config row is never re-merged from it, so
`opencode`'s new command reaches only agents added after this lands.
Rollback is per commit: the presets, the three fixes, and the six-agent scoping are
separate and independent.
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
N/A
## Summary
The host side of hosting an ACP sub-agent: what the host does when the agent speaks without being asked, and when it does not speak at all.
- A session opened behind a running turn says busy, not broken.
- An unprompted report wakes the conversation that owns the instance. Recording an unprompted ACP turn was half the fix; nothing routed the words back (measured 2026-09-01: a watch instance reported finished GPU work five times into its own log while the main agent slept eleven hours beside idle hardware). The manager remembers the route back from the announces that carry one and injects the report untrusted-fenced, with a five-minute per-instance debounce; tool-only wake rounds stay in the log.
- A silent connection is probed and a timed-out open drops it, so a wedged sub-agent process is replaced instead of hit three times.
- The rpc bootstrap builds the engine for the channel the stack serves, so wakes armed by the on-call agent fire (they were refused as outside the cron partition: seven wakes over two runs, none fired).
- An acp wake runs on the session that armed it, as a CRON-sourced turn with the wake's own text, and a prompt names its session pair, so a wake's output and a `message` tool call land where the session's subscriber is (the final FEA report of 2026-09-04 went to `acp:default`, which nobody read).
## Type
- [x] Fix
## Verification
```
uv run ruff check raven tests && uv run ruff format --check raven tests # clean
uv run pytest tests/test_subagent_acp.py tests/test_subagent_manager.py tests/test_acp_unprompted.py tests/test_rpc_bootstrap.py tests/test_acp_methods.py tests/test_core_cron_stack.py tests/test_subagent_dag_runner.py -q # 688 passed
uv run python scripts/check_commit_messages.py origin/main..HEAD # clean
```
Field check: the on-call wake fired inside the ACP process on 2026-09-04 (`Cron: executing job 'wake oncall-flow:beam-limit-load'`, four wakes, zero refusals) after the bootstrap fix.
- [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
An unprompted report is injected untrusted-fenced, the same way a result announce is. TUI-served stacks keep the previous wake behaviour; only the acp channel changes. Rollback is a revert of the squash commit.
## Related Issues
Split from !475 and !476 (closed), retargeted at main.
## 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.
`raven/cli/_repl_spine.py` wires the `agent -m` path -- one turn through
submit, lane, run_turn, hub, outlet -- and has done since the REPL it was named
for was removed. It becomes `_one_shot_spine.py`, `build_repl` becomes
`build_one_shot_spine`, and the three docstrings that pointed at it follow.
The command modules cited a plan file for their command count, described a
login flow as "WhatsApp today, generalized in a follow-up commit" (it is
capability-routed already), and explained the stderr sink, the doctor's memory
section, the gateway's cron ownership and its control-command intercept through
what they did before. Each states the rule it protects.
Co-authored-by: Claude (claude-fable-5) <noreply@anthropic.com>
Six test files still carried the address their subject lived at before the
assembly root and the market existed: cli/_cron_handler, cli/_*_stack,
cli/_plugin_stack, core.helpers and plughub. Renamed to the package they
exercise today (core.cron_stack, core stacks, core.plugin_stack,
providers.factory, market); contents unchanged, the two docstring pointers
were already corrected.
Audit ref RES-15, ruled: rename.
Co-authored-by: Claude (claude-fable-5) <noreply@anthropic.com>