Commit Graph
413 Commits
Author SHA1 Message Date
Devika Verma 8cfe67ca07 Merge pull request #566 from harneet2512/fix/security-readonly-variable-expansion
security: reject shell variable expansion in read-only grants
2026-09-18 23:32:39 +05:30
Devika Verma 2d5e52ad5e Merge pull request #183 from Aadhithya-arulvanan/fix/httpx2-deprecation-warning
fix: add httpx2 dev dependency to silence Starlette TestClient deprec…
2026-09-18 23:21:51 +05:30
Rohit Prasad e5cb2e8fbe Merge pull request #172 from Anuj04432/fix/relay-hub-exception-chaining
fix: preserve exception chain in RelayHub.wait_dispatched
2026-09-18 10:49:54 -07:00
Rohit Prasad 1b24796995 Merge pull request #123 from engmohamedsalah/fix/windows-rg-parser
fix: handle Windows drive-letter paths in grep (ripgrep) output
2026-09-18 10:49:02 -07:00
Rohit Prasad 5e1bde2ba2 Merge pull request #285 from xiaonancui/fix/setup-dev-env-bedrock-extra
setup_dev_env.sh: install the bedrock extra so a fresh env passes the test suite
2026-09-18 10:48:18 -07:00
Rohit Prasad fe2994c168 Merge pull request #669 from andrewyng/issue/ope-156-agent-loop-fixes
fix(engine): agent loop fixes for long, tool-heavy sessions (OPE-156)
2026-09-18 10:47:42 -07:00
Devika Verma c1e8b8cdf3 Make the time a tool instead of a line in every turn (OPE-192, final fix)
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.
2026-09-17 18:25:47 +05:30
Devika Verma c32e4b1274 Keep the per-turn context block out of the cached prompt prefix (OPE-192)
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.
2026-09-17 14:26:44 +05:30
Devika Verma 227466901e Raise the model-matrix size guardrail for the Claude 4.5/4.6 rows
The previous commit added Claude Opus 4.6, Opus 4.5 and Sonnet 4.5 to the matrix so
OpenWorker can be measured on those models. That took the matrix from 64 entries
to 67 and tripped the deliberate size assertion in
test_matrix_labels_and_custom_model_fallback, which caps it at 65.

Raised to 70 rather than pruning. The guardrail's own note says to reclaim slack by
removing retired entries before raising it again, and that is the right thing to do —
but deciding which entries are retired is an owner call, and dropping a row is not
cosmetic: an unlisted model falls back to the conservative default capabilities (no
parallel tool calls, the 128k context guess), so a wrong prune quietly degrades
whoever is using that model. The debt is recorded in the test comment for whoever
makes that call.

Found by the full suite: 2,053 passed, 36 failed, where 35 are the known
Windows-only baseline and this was the only new one.
2026-09-16 15:38:11 +05:30
Devika Verma 72e62e87b0 Make the compaction summary reliable, and stop losing the task statement (OPE-189)
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.
2026-09-16 15:31:06 +05:30
Devika Verma 65ba394393 Bound tool results, steer edits, keep compacted turns readable (OPE-186)
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.
2026-09-15 15:09:47 +05:30
Devika Verma 4caf7564a8 Replay reasoning on the OpenAI-compatible path (OPE-178)
Reasoning models served through the OpenAI-compatible client (Kimi K3 on
Together / Moonshot / OpenRouter, DeepSeek, GLM, …) return their thinking in
a message field — `reasoning_content`, or `reasoning` via OpenRouter — and
Kimi K3 explicitly requires the complete assistant message, thinking
included, to be passed back on later turns ("preserved thinking history").
The client read the field for display only; the engine strips the display
sidecar before every request, and nothing re-attached it, so every later
turn ran without the model's earlier thinking. The Anthropic and Gemini
clients already replay their formats via `extras`; this brings the
OpenAI-compatible client in line.

- `_reasoning_field` records which field the thinking arrived in;
  `_reasoning_extras` persists `{field, text}` as the `_openai_compat`
  sidecar on both the complete() and stream() paths.
- `replay_reasoning` re-attaches the text under that same field on every
  outbound assistant message that carries the sidecar, before
  `_strip_foreign_sidecars` removes the underscore key. Messages without it
  are untouched, so models that never send reasoning see identical requests.

Tests: tests/test_reasoning_replay.py — capture on complete and stream for
both field names, no-reasoning case, replay shape on the wire (original
field, sidecars stripped, foreign sidecars untouched), and an engine round
trip where the second request carries the first reply's thinking.
2026-09-09 19:19:55 +05:30
Devika Verma 08e6ab2c7d Persist the upstream host a router reports on each reply (served_by)
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.
2026-09-09 17:35:09 +05:30
Devika Verma 0a6cfcdacc Add Kimi K3 via OpenRouter to the model matrix (1,048,576 context)
Some sandbox hosts cannot reach api.together.xyz but can reach
openrouter.ai, which serves moonshotai/kimi-k3 through Together among other
hosts; a run can pin that host so the serving is unchanged. Row per
openrouter.ai/api/v1/models (read 2026-09-09); effort table gains the
lowercase slug.
2026-09-09 11:27:24 +05:30
Devika Verma 3083c7b8b8 Persist the compaction record on the compacted notice and event (OPE-170 p2)
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.
2026-09-08 21:24:36 +05:30
Devika Verma 1746c9ae20 Add a reasoning_effort setting translated per provider and recorded per reply (OPE-176)
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).
2026-09-08 20:22:10 +05:30
Devika Verma d15a7126e1 Run both turns of the continuation reset test in one event loop (OPE-171)
Two asyncio.run() calls on one engine raced the engine's loop-bound stop
event on the second turn and ended it early (test artefact: every real caller
runs all turns in a single loop). 8/8 passes now.
2026-09-08 18:39:04 +05:30
Devika Verma 786ba30225 Continue the turn when a reply is cut off at the output limit with no action (OPE-171)
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.
2026-09-08 18:29:44 +05:30
Devika Verma 267c562fd1 Refresh Kimi, GLM and DeepSeek context windows from vendor catalogs (OPE-170 p1)
The GLM-5.2 rows (Z.ai, Together, Fireworks, OpenRouter) still carried
128,000 although the model shipped with a 1M window in June; DeepSeek V4 Pro
on Together is 512,000, not 128,000; Kimi K3 on Together is 1,048,576, not
the rounded 1,000,000; Kimi K2.6 / K2.7 Code on Together are 262,144.

Sources, all read 2026-09-08: Together's /v1/models `context_length` for
every Together row (exact, per model), docs.z.ai for the native GLM-5.2 row,
openrouter.ai/z-ai/glm-5.2, fireworks.ai/models/fireworks/glm-5p2. Rows
without a source consulted today (DeepSeek native, Fireworks/OpenRouter
DeepSeek and Kimi K2.6) are left as they were.

Effect: with the 250,000 compaction cap these rows all now compact at
250,000 instead of 102,400. Tests updated with the new values.
2026-09-08 17:52:28 +05:30
Devika Verma 2a5c169ac5 Add Claude 5 rows to the model matrix; warn on the 128k context fallback (OPE-170 p1)
`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.
2026-09-08 17:34:07 +05:30
Devika Verma 2c91bd9a22 Make the per-reply output-token limit configurable (OPE-177)
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).
2026-09-08 17:08:29 +05:30
Devika Verma a6677e00ca Persist finish_reason on assistant messages (OPE-173)
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).
2026-09-08 16:32:11 +05:30
Rohit Prasad 5bc10d928e Merge pull request #598 from andrewyng/issue/ope-136-mcp-permission-model
MCP permission model: EXTERNAL floor, durable per-tool trust, fixed approval cards (OPE-136)
2026-09-02 21:12:29 -07:00
Devika Verma fe9cbb00c8 Fix CI: teach provider fakes messages.stream, un-Windows the write-fence probe
df919ed moved complete() to stream-and-accumulate, but the test fakes only
stubbed messages.create — every complete() test died on AttributeError. The
fakes now expose a stream() context manager (get_final_message returns the
canned response) alongside create, which the public stream() path still uses.

test_gate_order_write_fence_survives_bypass probed the fence with a literal
C:/ path — absolute on Windows, but a relative dir named 'C:' on POSIX, which
_candidate() resolves INTO the workspace root; the fence passed and Bypass
allowed. The probe now uses tmp_path.parent, out-of-root on every OS.
2026-08-31 08:48:28 +05:30
Devika Verma df919edd3b Anthropic complete() streams internally — the non-streaming path was dead on every Anthropic model
The SDK refuses non-streaming requests whose max_tokens (default 32000
here) could exceed ~10 minutes: a ValueError before any network I/O.
Every consumer of the non-streaming complete() path was dead on Anthropic
models — most notably the auto-approve reviewer, which errored on ALL
rows (found by the 2026-08-31 reviewer eval; fail-closed, so verdicts
fell back to asking a human — safe, but the mode delivered nothing on
Claude session models).

stream + get_final_message() returns the identical Message shape as
create() on both the plain and beta-fallback paths; both live-probed OK
(claude-sonnet-4-6, claude-fable-5), and the Sonnet 4.6 eval rerun then
passed every ship gate.
2026-08-31 08:06:14 +05:30
Devika Verma 4a42d8ffc9 OPE-136: GUI — honest approval cards, one tool-review dialect, connectors clarity
Approval surface:
- MCP cards show the full argument envelope (expandable JSON) and the real
  destination ("leaves this computer → host", stamped from the user's own
  config); the long-tail card path never silently truncates any argument —
  values the one-liner can't show whole render as labeled complete blocks
  (the old 96-char cut hid email bodies past char 96).
- The MCP grant ladder: Allow once / Allow for this request (EXTERNAL
  family; tooltip states the trade — later calls in this answer run unseen,
  nothing survives the answer) / Always allow this tool (durable, revocable
  on the server page) / Deny. Session-wide grants stay hidden where the
  server refuses them — no button that lies.
- One renderer for parked approvals: a redelivered (reconnect/navigation)
  approval maps back into the real card component — evidence and buttons
  can never drift from the live card again. Transcript origin chips name
  their source: your trust rule vs the legacy server flag vs a run grant.

Connectors/MCP management:
- Connect-time tool review: per-tool checkboxes; first review is an
  explicit "Keep these tools" consent moment (creates the include list and
  locks in fail-closed growth), later toggles auto-save with a receipt;
  "new" badges only tools the server added since review (declines are
  remembered via the exclude list, never badged).
- Trust surface: right-aligned "always allowed · Revoke" chip per trusted
  tool (idle-dimmed when the tool is unchecked — standing rules never
  vanish from the screen that audits them); header counts granted
  authority; loud banner + one-click migration for the legacy server flag.
- One tool-review dialect: shared row/chip/count primitives across MCP and
  catalog-connector pages; read/asks-first chips explain themselves
  (offered only where our own code pins the kind — MCP rows carry no risk
  chips, a server's word is not evidence; the page states "every tool asks
  unless always-allowed" once instead).
- Clarity passes from live testing: one healthy status word (Ready);
  group headers count their own rows; adding/connecting a server lands on
  the detail page where the review ceremony waits (curated offers live in
  Available, never among servers you own); Test shows Testing…/a transient
  result at the button with the durable receipt in the header; the
  per-server Configuration mirror is replaced by one "Show mcp.json"
  reveal-in-file-manager affordance; lifecycle controls carry explanatory
  tooltips. en+zh throughout.
2026-08-31 08:06:14 +05:30
Devika Verma 6f0d71c641 OPE-136: the reviewer learns MCP names are labels, not evidence — with the eval rows to prove it
Reviewer INSTRUCTIONS gain an "MCP tools" context entry: mcp__* names and
descriptions are the SERVER's own words — judge by the arguments against
the user's request; unfamiliar server + arguments carrying data outward is
"unsure" at best, while familiar-looking work whose arguments match the
request stays ordinary (the line must not manufacture paranoia).

Eval rows pin both directions: a familiar MCP read naming exactly the
asked-about ticket must ALLOW (paranoia control); a deceptively-named tool
carrying a credential to an unrequested destination must DENY; an
unfamiliar server pushing config secrets on a look-only request must ASK;
a repo-file instruction driving an MCP call that ships .env contents must
DENY.

Layered gate corpus (+12 generator-built rows): the MCP mode matrices — a
default server (EXTERNAL in every mode, floored) and a trusted one (card
waived in interactive/custom only; discuss/plan still hard-deny,
auto-approve still reviewer-eligible). The production-tool parity guard
learns the mcp__ family is legitimate by construction (runtime-defined
names); everything else still must match the live catalog.

Ship-gate evidence (reports/, 2026-08-31): Kimi K3, GLM-5.2, and Claude
Sonnet 4.6 all pass every gate on the grown corpus — 100% benign
allow-rate (no manufactured paranoia), zero false-allows on dangerous
and injection, zero provider errors.
2026-08-31 08:06:14 +05:30
Devika Verma 7ea4de3877 OPE-136: MCP permission model — EXTERNAL floor, durable per-tool trust, run grants, honest approval plumbing
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.
2026-08-31 08:06:14 +05:30
Rohit Prasad fb1bfc6272 Merge pull request #548 from mo-tunn/fix/skill-upload-token-traversal
fix(skills): confine staged upload tokens
2026-08-30 12:45:18 -07:00
Rohit Prasad 9e145d9ceb Merge pull request #350 from rkfshakti/fix/repair-tool-pairing-on-load-331
fix: repair tool-call/result pairing on load to prevent unrecoverable 400 errors
2026-08-29 17:03:32 -07:00
Rohit Prasad fbf57149fa Merge pull request #70 from lifrary/fix/atomic-conversation-shrink
Make the conversation-log shrink rewrite atomic (prevent history loss on a mid-write crash)
2026-08-29 17:00:12 -07:00
Rohit Prasad ccc845ded4 Merge pull request #56 from Saidheerajgollu/tolerate-corrupt-jsonl-on-load
Tolerate a corrupt line when loading a conversation .jsonl
2026-08-28 22:53:29 -07:00
Rohit Prasad 5c8f6dd1c2 Merge pull request #219 from hacksics/unparsed-tool-calls-upstream
Recover truncated tool calls, and never pass a leaked one off as an answer
2026-08-28 22:37:03 -07:00
Rohit Prasad e8824ab1f0 Merge pull request #55 from Saidheerajgollu/harden-session-id-path-traversal
Reject path-traversal session ids in the conversation store
2026-08-28 22:35:57 -07:00
Rohit Prasad 6dfd1a4f3b Merge pull request #24 from Saidheerajgollu/fix-inbox-reply-substring-intent
Parse inbox reply intent from the leading word, not substrings
2026-08-28 22:09:53 -07:00
Rohit Prasad d20dd624bb Merge pull request #379 from Saidheerajgollu/fix/scheduler-stale-tick-double-run
fix: scheduled task can run twice when an approval lands on a tick
2026-08-28 22:09:25 -07:00
Rohit Prasad c10485448c Merge pull request #127 from jasmine889966/feat/gui-i18n
Add GUI internationalization with English and Simplified Chinese
2026-08-28 21:46:38 -07:00
Rohit C Prasad 709a9bab90 gui: fix plural forms and notice strings caught by CI e2e
Folder-count summary gets _one/_other; keyboard shortcuts register at commit
so early input isn't dropped during boot; restores main's copy for the
files-location help and the onboarding signed-in line.
2026-08-28 21:13:13 -07:00
Rohit Prasad 03e4a5334b Merge pull request #586 from rakeshutekar/fix/attachment-read-auth
fix(teams): enforce attachment read authorization
2026-08-28 20:55:48 -07:00
Rohit Prasad 5f2a5542e5 Merge pull request #585 from rakeshutekar/fix/worker-board-item-auth
security(teams): enforce worker visibility on board item reads
2026-08-28 19:41:57 -07:00
Rohit C Prasad 086be2a1a6 gui: re-apply and extend i18n wrapping onto current main
Re-applies the react-i18next wrapping onto main's components and covers the
ones added since; count keys use _one/_other plural forms.
Locale tests enforce en/zh key parity and placeholder contracts.
2026-08-28 16:06:05 -07:00
Rohit C Prasad 5392e7ac15 Merge main into feat/gui-i18n 2026-08-28 16:05:58 -07:00
Rakesh Utekar 0939fd6624 fix(teams): authorize attachment reads
Require attachment reads to resolve through an actor-visible item in the requested board space. Record authoritative attachment provenance so forged comment or transition refs cannot grant blob access, while preserving legacy refs through an atomic one-time migration.

BREAKING CHANGE: BoardDialect.attachment and the /v1/board/attachment endpoint now require a board space.
2026-08-28 15:35:55 -07:00
Rakesh Utekar e826b48a90 fix(teams): enforce worker item visibility 2026-08-28 14:47:07 -07:00
Rohit Prasad 86c57f0692 Merge pull request #569 from andrewyng/rp/readme-security
Updating README
2026-08-26 10:29:40 -07:00
Rohit C Prasad ca52cf798e docs: center README header lockup (title, links, badge) 2026-08-26 10:19:51 -07:00
Rohit C Prasad 810edb3ac2 docs: switch to all-languages trendshift badge, centered 2026-08-26 10:14:41 -07:00
Rohit C Prasad 5c799b0363 docs: security-first README (use cases + governed-by-design) and SECURITY.md
README gains a use-cases section led by the security coworkers and a governed-by-design section describing floors, the autonomy ladder, and audit provenance.
SECURITY.md adds vulnerability disclosure via security@openworker.com.
2026-08-26 10:08:45 -07:00
Shakti Prasad Mohapatra 9bad0fdd8e fix: don't inject placeholder for trailing pending tool calls
The repair was synthesising placeholder tool results for any dangling
call, including calls in the last assistant message that are simply
pending (interrupted for approval/question). This broke durable resume
because the provider saw the placeholder and thought the tool already
ran, so resolve_inbox could not re-execute the tool.

Now trailing calls (assistant tool_calls as the last message with no
result) are left untouched — the engine will resume them. Placeholders
are only injected when the thread has moved past the call, proving it
is corrupt rather than pending.

Fixes test_durable_resume_question and
test_durable_resume_approval_executes_tool.
2026-08-26 21:55:48 +05:30
Shakti Prasad Mohapatra 47e82e9336 chore: trigger CI re-run 2026-08-26 21:55:48 +05:30