The human's ticks on the staffing card are the worker's grant; approvals follow the lead's mode.
A lead answers a worker's parked call; team and work-item gates keep their payload in the Inbox.
The per-turn `<system-context>` block opened with `Now: YYYY-MM-DD HH:MM` (2c9fb74,
2026-08-20) so that absolute scheduling had a clock. The block is glued onto the last
user message — the task prompt in a tool loop — and a provider's prompt cache is
reusable only up to the first byte that differs, so every minute crossing rewrote
message one and re-processed the whole conversation. 9d6a716 worked around it with a
trailing-message shape, an Anthropic-only relocation of that message, and a
`live_clock` switch that headless runs set off. This commit removes the cause instead
and deletes the workarounds; the shape is the same on every provider again.
- The block carries no clock, on any provider. What is left (folders, skill menu,
mode notices, memory-off notice, disable countermand) changes only when the user
changes something, so the outbound history is byte-identical turn to turn.
- `current_time` tool (coworker/clock.py), registered for every persona: local time
with offset and zone, the same instant in UTC, weekday. The environment block's
"Today's date" now says it is a session-start snapshot and points at the tool.
- `sleep_for(seconds)` is back beside `sleep_until` (a relative wait needs no clock
arithmetic; the four lead personas' manifests still told the model to call
sleep_for, which 2c9fb74 had removed). `sleep_until`'s description points at
current_time for the date/timezone. Timer wake messages carry their fire time.
- Deleted: `live_clock` config + COWORKER_LIVE_CLOCK, the trailing-message shape in
`_outbound_messages`, `_relocate_ephemeral_note` in the Anthropic provider. The
cache-diagnostics instrument (off by default) stays.
Validation runs (one long tool-heavy task, one attempt each on Fable 5.1 and Kimi K3,
compared with the 9d6a716 runs of the same task) are recorded on OPE-192.
Tests: tests/test_clock_tool.py (new), tests/test_context_block_placement.py and
tests/test_cache_breakpoint_placement.py rewritten for the single shape,
tests/test_live_clock.py removed; self-wake, attachments, message-source and
multiroot tests updated. Full suite unchanged against the Windows baseline.
Every turn the engine builds a `<system-context>` block — folders, skill menu, and a
live clock to the minute (owner ruling 2026-08-20) — and appended it to the last
message with role "user". In a chat that is the newest message. In a tool loop, tool
results carry role "tool", so the last user message is the task prompt: message one.
Every minute crossing changed message one, and a provider's prompt cache is reusable
only up to the first byte that differs, so the whole conversation was re-processed.
Measured on a long tool-heavy task (Fable 5.1): Anthropic's
cache-diagnostics beta reported every miss as `messages_changed`; per-message
fingerprints showed message 0 changing on every miss and nothing else; 7 of 7 minute
crossings missed. On one heavier task, 16 of 105 calls held 95% of the cache writes —
three quarters of that session's cost. A long multi-task Kimi K3 session on Together
had the same signature: 60% of minute crossings missed vs 1.5% otherwise, so the
OPE-186 attribution of that session's cache-miss cost to Together's fleet cache
was mostly wrong.
Three parts:
1. Engine: the block is sent as its OWN trailing user message, opening with
EPHEMERAL_CONTEXT_OPEN and a line saying it is automatic context. On the
OpenAI-compatible wire that leaves the prefix through the last tool result
byte-identical turn to turn. Validated on Kimi K3 via OpenRouter/Together: cache
misses 9/40 -> 0/29 calls, fresh input 0.76 M -> 0.03 M tokens on the same task.
2. Anthropic provider: `convert_messages` relocates a trailing note onto the last user
message before it — this provider's previous shape. A trailing note there is worse,
not better: a cache entry made at a block that is followed by another block in the
same message does not match a later request where the message ends there (27/27
misses, 2.3x the cost on the same task). The same property means chat
sessions on Anthropic have never reused the conversation cache (the note was always
glued to the newest user message); Anthropic's own pattern is to keep per-turn
reminders in the transcript, which is a larger change tracked on OPE-192.
3. `live_clock` config (default true; COWORKER_LIVE_CLOCK=0): with it off the block
omits the clock line and is static, so message one stays stable on Anthropic and the
trailing note stays stable on the OpenAI path. Headless runs set it off (nothing
schedules there). Validated on Fable 5.1, same task: full-conversation rewrites 6
-> 0, reported misses 7 -> 0, cost down 63%, same pass and reply count.
Also in this commit, off by default: a cache-diagnostics instrument in the Anthropic
provider (COWORKER_CACHE_DIAGNOSTICS=1 adds the cache-diagnosis beta and records
Anthropic's miss reason plus a per-message fingerprint of each request on the assistant
message) — it is what found the bug and is not used in normal runs.
Tests: tests/test_context_block_placement.py, tests/test_cache_breakpoint_placement.py,
tests/test_live_clock.py; test_multiroot, test_message_source and test_attachments
updated for the trailing note. Full suite unchanged against the Windows baseline.
The OPE-186 trial (15 long tasks) compacted 64 times and gave a usable summary on 7 of 103
summariser calls. Two independent causes, both fixed here.
1. The summariser was asked last and read the session last. `summarizer_messages`
sent the ~1,800-character instruction as the system message and then tens of
thousands of characters of transcript, ending wherever the session happened to
be — usually on a raw tool result. The model continued that voice instead of
summarising: 13 of 16 short replies were a next-action sentence ("The output
got truncated. Let me re-run the remaining checks." — 61 characters standing in
for 75 turns), each stopping voluntarily with most of its budget unused. The
transcript is now delimited and the instruction restated after it, in bold,
ending on the exact first heading to write.
2. The budget was 3,000 tokens, shared with the model's reasoning. On 60 of 103
calls Kimi K3 spent it thinking and the summary was cut off or never started.
SUMMARY_MAX_TOKENS is now 16,000 and is a setting: `compaction_summary_max_tokens`
in config.toml, COWORKER_COMPACTION_SUMMARY_MAX_TOKENS in the environment.
Measured by replaying 20 recorded compactions from that trial against Kimi K3,
scored by the gate below: the old shape at 3,000 tokens gives 4/20 usable; moving
the instruction alone gives 18/20; with the 16,000 budget, 20/20. Disabling
reasoning for the call adds nothing over that, so it is not done.
Also:
* A quality gate before a summary is accepted. "Not empty" let a 61-character
sentence become the coworker's whole memory of a span. `summary_quality_problem`
refuses empty, under 400 characters, or missing the section headings, and
`summarize_span` raises — so the engine's existing single retry runs before the
no-summary trim fallback.
* The first user message is pinned in the compacted block, whole, capped at 4,000
tokens. `_cap_user_messages` kept the newest 40, so any session with 41 or more
user messages silently dropped the opening mandate — the one message that never
goes stale. Omissions now come from the middle, and the block says so there.
* Per-message clipping is replaced by a token budget filled backwards from the
newest. Each preserved user message was cut at 600 characters; 8 of the 15 trial
task prompts are longer, up to 1,424, so after every compaction the agent's
verbatim record of its job was cut mid-sentence. On video-processing that
discarded the output path and both field names the task checks. The budget
is 8% of the compaction trigger, bounded to [2,000, 20,000] — a fraction, so
lowering the trigger to save tokens is not undone by the block, and 20,000 at
the default trigger is a generous allowance.
The trigger itself is unchanged: min(80% of the context window, cap), cap 250,000,
overridden by `compaction_cap_tokens`. Lowering the default should follow a working
summariser, not precede it.
Unrelated, included here to keep the tree clean: model-matrix rows for Claude Opus
4.6, Opus 4.5 and Sonnet 4.5. These are added so OpenWorker can be measured on
those models against published evaluations of the same models.
Tests: tests/test_compaction.py, tests/test_compaction_engine.py and
tests/test_compaction_transcript.py cover the new request shape, the gate, the pin,
the budget and the config/env plumbing. Their fake summarisers were returning
strings the gate now refuses, and were updated to real-shaped summaries.
Findings from a long multi-task Kimi K3 session: ten long tasks used 57% of
451 M tokens, tool results were 31% of the final context and whole-file
write_file bodies 14%, and compaction fired once. Three harness changes:
1. Tool-result cap. Every tool result is bounded on arrival at 10,000 bytes,
head + tail, with a marker naming the spill file that holds the full text
(coworker/toolresult.py; engine `_record_result`; config
`tool_result_max_bytes`, env COWORKER_TOOL_RESULT_MAX_BYTES, 0 = off).
The spill folder is the session's scratch root when there is one, else it
joins the session's directories read-only so read_file can open it.
shell.py's own 20k-char tail cut becomes a 2M safety net.
2. Edit steering. write_file, replace_in_file, apply_patch and
apply_unified_diff describe WHEN to use each (catalog.EDIT_TOOL_GUIDANCE),
and the Cowork prompt says to edit in place rather than rewrite.
3. Compaction. `compaction_cap_tokens` (config / env
COWORKER_COMPACTION_CAP_TOKENS) lowers the trigger; each compaction writes
the verbatim transcript of the compacted turns (no reasoning) to the spill
folder and the compacted block names the file (CompactionState.transcript_path,
compaction.render_transcript).
Trial on 15 long tasks x 3 attempts (Kimi K3 via Together, cap 60,000):
33/45 passed vs 54/75 for the unchanged harness on the same tasks, tokens per
attempt 3.30 M -> 1.40 M, cost down 44%. Observed and left for a
follow-up: Kimi's summariser reply lands mostly in reasoning within the
3,000-token summary budget (7 proper summaries in 103 calls), and the trial had
16 timeouts vs 9 in the baseline.
Tests: tests/test_tool_result_cap.py, tests/test_edit_tool_guidance.py,
tests/test_compaction_transcript.py; full suite unchanged against the Windows
baseline.
OpenRouter names the host that served a request in a top-level `provider`
field on responses and stream chunks. Keep it on AssistantTurn.served_by and
persist it as the `served_by` sidecar (event + message, stripped before
provider calls), so a run pinned to one host (Kimi K3 via OpenRouter ->
Together, because the sandbox hosts cannot reach Together directly) can prove
the pin held on every reply.
The summary produced by auto-compaction lived only in the engine's in-memory
`compaction_state`; the transcript's `compacted` notice carried a generic
sentence, so a saved session, an exported trajectory or a run record
showed that compaction happened but not what the model's memory was replaced
with (the app's session record keeps only the latest state).
- `_compaction_record()` returns `compaction_state.as_dict()` (summary text,
working state, boundary index, user-message list, summarizer model,
created_at, trimmed flag).
- Both compaction sites (the between-turn checkpoint and the context-overflow
retry) attach it to the persisted `compacted` notice as `compaction` and to
the COMPACTED event payload. Notices never reach a provider.
Tests: tests/test_compaction_persisted_summary.py — record equals the state,
summary text present, JSON-serialisable, event carries it; the trim fallback
records trimmed=True with the placeholder; nothing reaches the provider.
OpenWorker had no way to choose how hard a model thinks per reply; the level
was whatever each endpoint defaulted to (Anthropic: high; Kimi K3 on
Together: max), and a run record could not state it.
- `Config.reasoning_effort` (low | medium | high | xhigh | max, Anthropic's
vocabulary), config.toml / workspace / `COWORKER_REASONING_EFFORT`,
validated; unset sends nothing so existing requests are unchanged.
- `build_engine` threads it through `model_settings` like `max_tokens`.
- providers/effort.py: the level→parameter tables and the nearest-supported
rule (ties go up). Anthropic adaptive models get `output_config.effort`
(per-model support from the effort doc, read 2026-09-08); budget-thinking
models get `thinking.budget_tokens` (2,048 / 8,192 / 16,000 / 24,000 /
32,000, max_tokens floored above); OpenAI-compatible endpoints get
`reasoning_effort` (Kimi K3: low/high/max verified; others the OpenAI
vocabulary). Gemini, Bedrock, Responses: not sent, recorded as such.
- Fallback: an endpoint that rejects the parameter (400 naming it) gets the
request once more without it; the model is remembered for the run.
- Record: `AssistantTurn.effort` → `reasoning_effort` sidecar on every
assistant message and on the ASSISTANT_MESSAGE event: {requested,
effective, param, note}; stripped before provider calls. When a level is
configured but the provider reports nothing, the record says so.
- docs/config.example.toml documents the key.
Tests: tests/test_reasoning_effort.py, 40 cases (levels, config layering and
rejection, build_engine plumbing, mapping tables incl. every curated model at
every level, Anthropic complete/stream/budget/fallback/unrelated error,
OpenAI-compatible unset/mapped/fallback, engine record and outbound strip).
A reply that hit the output-token limit (finish_reason "length") with no tool
call — typically thinking consumed the whole budget and nothing else came back
— took the `if not turn.tool_calls` branch and ended the turn as "completed".
The task was silently abandoned (two of Fable 5.1's three failures and one of
Sonnet 5's on a ten-task trial were this shape).
Engine:
- On such a reply, append a user-role nudge (TRUNCATION_NUDGE: act now, do not
repeat the reasoning), emit a CONTINUATION event, and go round the loop.
At most MAX_TRUNCATION_CONTINUATIONS (2) consecutive nudges per turn; the
counter resets on any non-truncated reply and at the start of each turn.
- On the cap, persist a `truncated` notice and end with TURN_END
status "truncated" — never "completed".
- The cut-off reply stays in the transcript (finish_reason "length", its
partial reasoning) but is replayed to providers as a short stub
(`replay: "stub"` sidecar → TRUNCATION_STUB): its thinking block has no
signature, which Anthropic rejects, and it carries nothing useful anywhere.
- A truncated reply that still has a parseable tool call is unchanged (the
mangled-call path already covers broken arguments).
GUI (surfaces/gui): "continuation" event → info notice; turn_end "truncated"
→ warning; persisted `truncated` notice replays as a retriable warning; en/zh
strings.
Tests: tests/test_truncation_continuation.py (nudge then complete, stub
replay, partial text, cap → truncated + notice, tool-call case untouched,
counter resets within and between turns, normal path untouched, stub survives
persistence); GUI itemsFromMessages test for the truncated notice.
`anthropic:claude-sonnet-5` and `anthropic:claude-fable-5-1` (the models in
active use) had no matrix row, so their context window fell back to the
128,000 guess and auto-compaction fired at 102,400 tokens — a tenth of their
real window — rebuilding the prompt cache each time (observed twice in one
33-minute Sonnet 5 run).
- matrix.py: rows for claude-fable-5-1, claude-opus-5 and claude-sonnet-5
(1M context, vision + PDF), per platform.claude.com/docs/en/models/overview
read 2026-09-08.
- engine.py: `_compaction_config` logs one warning per engine when a model
has no matrix window and the fallback applies, naming the model, the
assumed window and the resulting trigger.
Tests: tests/test_matrix_current_models.py — the current rows and their
windows; every provider's recommended model is a matrix row (Ollama
excepted) and the ones without a verified window are exactly the known
set (MiniMax M2.5, Muse Spark 1.1); every model in reports/reviewer-eval-*
has a window; trigger arithmetic; the fallback warning fires once for an
unlisted model, not for a listed one, and not when compaction settings
supply a window.
Every provider capped each reply with a hard-coded constant (32,000 for the
Anthropic and OpenAI-compatible clients, 4,096 for Bedrock) that no config,
environment variable or CLI option could change, although `build_engine(...,
model_settings=)` already spread settings into every provider call and every
provider used `setdefault("max_tokens", ...)`. Now:
- `Config.max_output_tokens` (config.toml, workspace-overridable; env override
`COWORKER_MAX_OUTPUT_TOKENS`), validated as a positive integer; unset keeps
every provider's default byte-for-byte.
- `build_engine` folds it into `model_settings["max_tokens"]` unless the caller
passed an explicit value; explorer subagents inherit it.
- `AssistantTurn.output_limit`: the ceiling the provider actually sent, after
the Anthropic budget-thinking floor (which now logs a warning when it
overrides a configured value) or the OpenAI `max_completion_tokens` rename.
- The engine persists it on the assistant message as the `max_output_tokens`
sidecar and on the ASSISTANT_MESSAGE event, stripped before provider calls.
- Bedrock keeps 4,096 with a comment on why; the config key raises it.
- docs/config.example.toml documents the key.
Tests: tests/test_max_output_tokens.py (config layering, env override,
validation, build_engine plumbing, Anthropic complete/stream + floor warning,
OpenAI complete/stream + rename retry, engine record).
The engine received each reply's normalised stop reason (`stop` / `tool_calls` /
`length`) and used it only transiently (`_turn_truncated`); a saved session could
not tell "chose to stop" from "hit the output limit" without re-deriving it from
token counts. Now:
- `_assistant_message` writes `finish_reason` as a display sidecar next to `usage`
(omitted, never null, for partial turns and providers without a stop reason).
- The ASSISTANT_MESSAGE event payload carries it too.
- `_outbound_messages` strips it before every provider call, like the other sidecars.
- The Anthropic provider keeps its raw `stop_reason` in the `_anthropic` sidecar so
values the map collapses (`pause_turn`, `stop_sequence` -> "stop") stay recoverable.
Tests: tests/test_finish_reason.py (engine event + message, outbound strip, partial
turn, tool-call turn, Anthropic complete/stream sidecar, sidecar replay).
Backend core of the MCP trust redesign:
- Risk floor: every mcp__ tool classifies EXTERNAL, always — category-keyed,
fails closed on missing metadata; user overrides may only tighten (loader
and writer both refuse loosening rules, pointing at trust rules instead).
Closes the name-collision path where a server named like a catalog
connector inherited softer classification (and the reverse, via the
backed-connector category relabel at wiring).
- Durable per-tool trust replaces the server-wide requires_approval:false
trapdoor: "Always allow this tool" writes a named, visible, revocable rule
to the user-local override store; the legacy flag stays honored but gets a
one-click migration to per-tool rules. Server-side validated in
_grant_offered — cards cannot mint what the server won't honor (the
always_trust outcome also joins the approval_outcome validation tuple).
- Remove server revokes its trust rules (exact names and server-scoped
globs): they lived in a separate store keyed by name, so a future server
added under the same name inherited don't-ask rules sight unseen.
Sign-out deliberately keeps trust — tokens only.
- Run grants ("Allow for this request"): ApprovalOutcome.THIS_RUN covers the
exact tool for the remainder of the current run — in-memory, cleared at
the run boundary (finish, interrupt, teardown) plus a fresh-run belt;
never skips the auto-approve reviewer; offered for EXTERNAL risk only
(EXEC keeps command-scoped grants, EGRESS its domain grant). Covered
calls carry a run_grant transcript origin and auto_allowed audit rows.
- Honest evidence plumbing: PermissionRequest carries the MCP destination
(stamped from the user's own server config at registration, never from
server claims); parked approvals store category/destination/reason so a
redelivered card shows the live card's evidence; approval bodies stop
baking in the "requires approval" boilerplate.
- Connect-time tool review backend: include_tools is an include-list
(unchecked tools are never registered — fail-closed growth), and
exclude_tools records explicit declines so "new" can only ever mean the
server's menu grew.
- Trusted-origin split: the engine distinguishes a user's trust rule from
the legacy server flag so the transcript chip can name the right source.
Approval origins (reviewer/user/bypass, notes, grants) ride the tool message display sidecar so chips and deny blocks survive reload.
The Auto-Approve explainer is persisted once per session server-side with new shorter copy; later switches persist one-line markers.
Breaker pauses loudly and resets on non-deny verdicts and ask_user answers; replies reach the judge with the agent question marked as data.
Cardless runs annotate quietly: auto-approved (reviewer reason) or approval bypassed.
Fast-fail with a shell steer before any prompt; docstring names the closed catalog
and stops citing semgrep (pip/brew, deliberately unmanaged) as an example.
Found while designing reviewer stress scenarios: _authorize consulted
the reviewer on ANY needs_user decision, but two asks exist precisely
so a PERSON sees them - protected in-project files that execute later
(.git/hooks, CI configs: 'no auto-approve path may clear them') and
writes whose path cannot be located for scoping (an allow would bypass
root scoping unverified). A reviewer 'allow' on either was that floor's
bypass; the 8.3 prompt's git-hook example hoped for unsure but nothing
enforced it.
Decision grows human_only; the two branches set it; _authorize and
_preconsult_reviewer skip the reviewer when it's set (card always).
Shadow recording is untouched - a shadow verdict has no decision path
and 'would the reviewer have allowed this?' is useful data.
A text-file attachment's contents were flowing verbatim into the
reviewer's USER REQUEST block (the list-content extraction kept every
text part, and inlined .txt/.csv attachments ARE text parts) - an
attacker-writable channel into the judge's highest-authority input,
inconsistent with images/PDFs which were dropped silently.
New attachments.reviewer_text(): the user's typed words survive, every
attachment collapses to '[user attached: <name>]' (images: 'an image').
The reviewer learns a file exists - 'clean this up' plus an attachment
IS a different request than 'clean this up' - but never what it says.
The agent's view is untouched. A typed message mimicking the inline
prefix collapses too: the failure direction is less information, never
smuggled content. Prefix and collapser live in the same module so the
spelling cannot drift.
Corpus: inject-015 (planted upload instruction in an attached csv).
Tests: marker collapse, edge shapes, _user_history integration.
The reply-tag feature existed as two finished thirds: render_history
prints '[reply to a question the agent asked]' and the 8.3 instructions
tell the reviewer to weigh such replies lower - but nothing ever set
the tag, because ask_user answers return as tool results and
_user_history reads role:user only. This adds the missing third: the
engine records each answer at the moment question_asker returns (the
one point it KNOWS the text came from the human - inline card, Inbox,
or bound channel, all carrying the same trust as approval clicks) and
_user_history merges them chronologically, tagged is_reply.
Deliberately narrow (step 1 of the 8.2 plan):
- ANSWERS ONLY - the agent's question text (incl. grouped-form keys)
never enters the judge's view; showing it is step 2, evidence-gated
on shadow data.
- Replies join HISTORY, never the current request - 'ok proceed' must
not become the headline an action is judged against.
- Runtime-only: a restart costs reviewer context (more cards), never
correctness. Nothing is minted from an answer; the gate stands.
ask_user steering (all three description surfaces): never use it to
ask permission for a specific action - propose the action, the
approval card shows exact arguments and does the asking.
Leads lose propose_plan (trait-derived exclusion — plan mode is meaningless without execution tools) and gain propose_work_items: mode-independent decomposition whose approval creates the items.
Team field moves off the turn-save upsert to a dedicated setter (workers detached from their lead after one turn); board deliveries carry a MessageSource sidecar; test-worker prefers project-local tool installs.
team: manifest trait gates lead/worker toolsets; propose_team pre-spawns worker sessions on approval (fail closed on solo personas).
Deliveries + lead subscriptions are cursor-consumed projections; turns end with a queue kick, ticks replay; timer wakes carry the code-computed staleness digest; hourly wake cap is the budget gate.
Unparseable (_raw) args now get a truthful error: cut-off-by-output-limit says
'smaller pieces', bad JSON says 're-send with declared parameters'. Raw junk is
shrunk before entering history so replays can't teach the model the _raw shape.
Anthropic default max_tokens 16k -> 32k so typical report files fit outright.
Fact strip: 'OpenWorker installs its own verified copy from <publisher>' replaces
supply-chain jargon. On decline the engine re-resolves — a copy the user installed
themselves is handed to the agent as theirs, not treated as a refusal.
Registry metadata (version, publisher, checksum) moves to a distinct fact strip.
Decline button renamed to say the run continues; reason capped to one sentence.
Sidecar inherits the login shell's env; toolchain resolves absolute paths with pinned
installs; request_tool replaces the 'tool missing -> STOP' instruction that hid a check.
web_search reclassified EGRESS (spec 2.2, decided 2026-08-12): the destination is
fixed (the configured provider) but the query is model-chosen free text - the same
outbound channel web_fetch's URL is. It ran completely ungated in every mode until
now; it gates like any egress from here on, which also puts it in front of the
Auto-Approve reviewer.
The egress approval cards (spec 1.9):
- web_fetch offers "Always allow <host> this session" -> ALWAYS_DOMAIN. Tool-wide
"always" is gone from the card AND server-refused (_grant_offered): it would
cover every future destination, and the live A/B showed exactly that (one click
on a bbc.com card ran promptless fetches to hosts no card ever named).
- www. stripped at grant minting (allow_domain_for_session) - pure spelling only,
never eTLD+1. The card button shows the exact spelling the grant mints.
- web_search offers "Always allow searches this session" -> ALWAYS_TOOL (tool-wide
IS provider-wide for a fixed destination), with the card naming the LIVE
destination: "Queries go to your configured search provider (currently: <name>)".
Provider resolved when the card is raised (engine.approval_extras hook), not at
session start.
- Provider-change invalidation: set_web_search clears the web_search session grant
in every live engine when the provider actually changes - the grant was consent
to a named destination.
- Auto-Approve fall-through cards hide every session "always" button: grants don't
skip the reviewer there (1.5), and a button that lies is worse than none.
- scopeNote tells the truth for egress: "leaves this computer -> <host>" replaces
"stays on this computer" on fetch/search cards.
Corpora gain web_search cases (benign 22 / dangerous 17 / injection 14), including
query-borne secret exfiltration and a planted search-the-credentials injection.
Tests: test_egress_and_overrides (EGRESS class, gating, www-strip, 1.5 in
Auto-Approve), test_approval_integrity (tool-wide refused for URL-carrying egress,
kept for web_search; provider-change invalidation), ApprovalCard.test.tsx (domain
button + www-strip, provider line, Auto-Approve hides always). Full suites pass;
the 22 pre-existing failures (Slack fake-gateway timeouts, a Windows file-lock
rename) fail identically on the pre-change tree.
A reviewer deny now renders as a proper card in the transcript - the FULL
reason (the agent only ever got the terse refusal) plus an "Allow anyway"
button - and clicking it mints a ONE-SHOT exact-action approval.
Engine:
- approve_action_once(tool, arguments): human-minted grant keyed on the
exact tool + canonical (sort_keys) JSON arguments, consumed on first
match. Checked in _authorize's needs_user branch AHEAD of the reviewer,
so the approved re-proposal runs without a reviewer call or a card.
Audited as allow_anyway_granted + auto_allowed.
- Deliberately narrow: a re-proposal with even slightly different
arguments does not match and goes back through the normal flow, and the
grant only applies where needs_user is true - it CANNOT unlock a hard
deny (1.2), which is now a test.
Server: WS kind "allow_anyway" {name, arguments} -> engine.approve_action_
once, with input validation. The GUI follows up through the normal
user_message path with a visible "go ahead with it exactly as proposed"
message, so the retry is in the transcript, not magic.
GUI:
- tool items carry reviewerReason/allowAnyway (the event fields were
already broadcast verbatim; updateLastTool now keeps them).
- StepRow renders the deny card: full reason, a note that the agent was
told only THAT it was blocked (not why), and the button - which
collapses into a confirmation after one click (no double-fire).
- SessionSocket.allowAnyway; App.allowAnyway = WS grant + canned retry
message; onAllowAnyway threaded Transcript -> TurnGroup -> StepRow.
Tests: 4 engine (runs once without card/reviewer; consumed not standing;
different action never matches; hard deny stays denied) + 3 component
(card + reason + exact-args callback + one-shot button; no card on
ordinary denies; no button without the callback). 110 backend + 114 GUI
tests green.
Spec Part 6 step 3. The reviewer runs on every approval card and records
what it WOULD have decided, while the human decides everything. This is how
the ship gates get measured on real sessions before the flag ever defaults
on. Nothing about a decision changes.
- config.py: auto_approve_shadow flag, off by default, _GLOBAL_ONLY (a
cloned repo can't turn it on). agent.py attaches the reviewer when either
auto_approve OR the shadow flag is set; reviewer_shadow gates only the
recording path.
- engine.py: _spawn_shadow_review fires the reviewer fire-and-forget from
the needs_user branch and audits stage="reviewer_shadow" joined to the
human's approval_resolved row by call_id. The card is never delayed; a
shadow failure never surfaces. Skipped when the live path already
consulted the reviewer this card (no double spend). approval_requested /
approval_resolved rows gained call_id for the join.
Eval harness (scripts/eval_reviewer.py, spec 7.5):
- Runs the reviewer against three JSONL corpora and scores the ship gates:
benign allow-rate >= 30% (prompt-reduction proxy), zero false-allows on
dangerous and injection. Exit 1 on any gate failure.
- Corpora seeded: benign (20), dangerous (15), injection (13), each with a
~20% holdout and per-row answer keys, in the spec's 7.5.1 format. Known
world is reconstructed folders-and-remotes-only, matching the engine.
- --stub runs with no network (canned verdicts) for plumbing/CI; real runs
use ProviderRouter and cost money, so this is on-demand, not a pytest.
tests/test_shadow_eval.py (18): shadow records but never decides; shadow
off records nothing; live allow/unsure never double-recorded; shadow errors
swallowed; corpora well-formed; scoring/gate maths; stub passes all gates.
The mode from ocw-context/docs/reviewed-auto-mode.md (rev. 4), v1 scope.
coworker/reviewer.py (new)
- The 8.3 prompt verbatim, cache-shaped: instructions + known world (folders
and remotes only) + user-message history in the stable prefix; this turn's
request and ONE action in the suffix.
- parse_verdict: any defect (empty, non-JSON, unknown verdict) -> unsure.
There is no parse path that results in execution (8.5).
- Reviewer.review never raises: provider errors and timeouts -> unsure.
Metering counters (checks / verdicts / tokens) for 1.7.
- AGENT_DENY_MESSAGE: the terse, non-diagnostic refusal the agent gets on a
deny; the full reason goes to the user only (8.4 asymmetry).
coworker/engine.py
- Reviewer consulted ONLY when: attached, mode is AUTO_APPROVE, session
explicitly attended (unset is_attended counts as NOT attended, so
automations can never be reviewed), fewer than two denials this turn.
- Consulted ONLY on decisions the gate marked needs_user - hard denies
never reach it, so it can only turn "ask" into "allow" (1.2).
- One action per request, fired concurrently for all of a turn's escalating
calls before the sequential authorize loop (8.6): a verdict cannot land
on the wrong action, and approval cards still reach the human one at a
time in call order.
- allow -> runs, audited with the reason. deny -> blocked; user event
carries the full reviewer reason + allow_anyway; agent message carries
only AGENT_DENY_MESSAGE. unsure -> today's card.
- Reviewer sees the user's words only, extracted mechanically from
role=user messages - never agent output, never tool results (4.4).
coworker/permissions.py
- Mode.AUTO renamed Mode.BYPASS_APPROVALS ("bypass-approvals"); legacy
"auto" still parses via _missing_ so configs, saved sessions, and the
golden decision table are untouched.
- Mode.AUTO_APPROVE ("auto-approve"): gate-identical to INTERACTIVE except
session grants ("always allow this ...") no longer auto-allow - they
route to the reviewer instead (1.5: out-of-band standing policy may skip
the judge; an in-flow click may not). Config allowlists still skip.
- _domain_allowed(include_session=False) checks the user-settings list only.
coworker/config.py: auto_approve flag, off by default, _GLOBAL_ONLY (a
cloned repo cannot hand itself a looser reviewer). agent.py attaches the
Reviewer only when the flag is on; without it AUTO_APPROVE behaves exactly
like INTERACTIVE.
server/manager.py: autonomy audit ranks auto-approve above interactive
(turning the reviewer on IS raising autonomy) and below bypass.
GUI: mode picker label "Full access" -> "Bypass approvals" (wire value
"auto" kept). Verified live against the real sidecar; e2e spec updated;
tsc and all 111 GUI unit tests pass.
Tests: tests/test_auto_approve.py (33) - gate behaviour per mode, fail-
closed parsing, prompt shape, deny asymmetry, retry guard, attended
gating, hard-deny isolation, per-action verdict landing, and that the
reviewer never sees agent prose. Permission suites + golden table: 146
passing unchanged.
coworker/session_facts.py: KnownWorld (roots + git remotes + hosts, captured
once before the agent acts) and SessionFacts (per-turn ingestion records).
Nothing consumes either in v1 - the known world will be rendered into the
reviewer prefix in step 2, ingestion exists so the v2 question ("would this
fact have changed a verdict?") is answerable from a shadow run replay
instead of re-argued.
- render() shows folders and remotes ONLY. Hostnames are held for DST-1 in
v2 but never rendered: a host list is only useful to a reviewer that can
do a suffix match, which models get wrong and Python does not.
- Freezing is the point: a remote added after capture stays unknown, so an
agent cannot make its own destination look familiar.
- Ingestion records the fact and the hostname, never the content and never
a full URL (a query string is exactly where a payload rides). Failed
calls record nothing. Local reads are deliberately excluded; the cost of
that exclusion is recorded in the spec.
- Engine hook is inert when session_facts is None; classification keys on
tool metadata category (web/connector/mcp) so new connectors are covered
the day they ship.
22 new tests. Permission suites (146) and the golden decision table pass
unchanged - this step alters no decision.
Spec: ocw-context/docs/reviewed-auto-mode.md Part 0, 2.4, Part 6 step 1.