Repository navigation
Open
Labels
Description
Summary
Pi had two defects, both fixed on main:
- Context window. Tale staged Pi's model by id alone, so Pi took 128,000 tokens for every gateway model. Pi caps each answer at that window minus its estimate of the conversation, and compacts only near it. A conversation of a larger model past about 124,000 estimated tokens got one-token answers and ended as
empty_turn. Fixed by fix(platform): give agents on Pi the model's context window #5416 (squash commit4368a0fb6). - Tool channel. Pi was staged without MCP, so its agents could not reach the workspace tools their instructions named. Fixed by
e5a3243c2, which is an ancestor ofmain.
The other runtimes have not been checked for the same things. This ticket asks for that check across every runtime Tale supports, on three points: the context window each one is given, when it compacts, and whether its tools reach the model. It proposes no fix. Anchors below are from origin/main at 4368a0fb6.
What the repo says today
Nine runtimes, plus the Claude Code (compact prompt) variant (claude-code/harness.yml:19). Paths are configs/platform/system/harnesses/<runtime>/harness.yml.
| Runtime | Window Tale gives it | Compaction | Tool channel (capabilities.mcp) |
|---|---|---|---|
| Claude Code | Catalog window as CLAUDE_CODE_AUTO_COMPACT_WINDOW, managed only (:158, :204), and only below 200,000 (:208-209). Every session defaults to 1M (:82-83). |
CLI auto-compaction, retuned by that variable (:188-204) |
Yes (:38) |
| Claude Code (compact prompt) | Same file (:19); not examined separately |
Same | Yes |
| Pi | Catalog window as contextWindow in the managed models.json (:82, :102). An unknown window leaves the key out, so Pi's own default of 128,000 applies. |
Pi's own, against the staged window (:90-95) |
Yes (:42); exposure: direct, no call timeout (:103-124) |
| OpenClaw | Fixed contextWindow: 200000 and maxTokens: 32000 for the managed gateway model, whatever its catalog window (:129-130) |
Not set here; not examined | Yes (:38); 60 s call limit, handled by bridgeCallTimeout (:145-147) |
| Codex | None | Codex compacts its own history (:124) |
Yes (:38), as mcp_servers config pairs (:138-141) |
| Gemini CLI | None | resume: false: each later kick is a fresh conversation, because --resume replays tool results (:39-52). In-run compression not examined. |
Yes (:38) |
| OpenCode | None; managed only (:1) |
Not set here; not examined | Yes (:29); 60 s call limit, bounded by the server's timeout (:130-136) |
| Qwen Code | None | Not set here; not examined | Yes (:44). No-argument tools fail on Anthropic Messages, so anthropicModels: false (:31-38) |
| Hermes | None | Not set here; not examined | No (:32): "the exec facts mount none" (:29-31) |
| Cursor | None | Not set here; not examined | No (:35); direct credentials only (docs/en/platform/agents/harnesses.md:22) |
How the window moves, from the code:
- A harness turn resolves its window in
services/platform/backend/core/chat/external_turn_shared.ts:334-391, called fromagent_run_host.ts:266andagent_host.ts:1764.services/platform/lib/harnesses/exec-builder.tsfills${model.contextWindow}only where a runtime names it (:238,:490-493). Only Claude Code and Pi name it. An unresolved window leaves the harness to size its conversation (external_turn_shared.ts:330-332). services/sandbox-runtimeandservices/sandboxcontain no window or compaction code. A grep for context window, compaction, auto-compact andcontext_lengthfinds nothing.- The user docs describe a window or compaction only for Claude Code and Pi:
docs/en/self-hosted/configuration/providers.md:112anddocs/en/platform/admin/governance/policies-and-limits.md:82.
What is already tested
- Goldens pin each built exec (
services/platform/lib/harnesses/fixtures/exec/*.yml). A window is pinned only for Pi (pi.yml:70), for OpenClaw (openclaw.yml, 200000), and for one managed Claude Code case (fixtures/exec/claude-code.yml:252-308). - Window values are unit-tested for Pi and Claude Code (
exec-builder.test.ts:498,:971). A grep for "compact" across the platform tests, the harness code and the sandbox runtime finds no test that drives a conversation past its window. - Tool reach:
services/platform/tests/integration/lib/bridge-reach.ts(header:11-15) and the Pi round trip, both added bye5a3243c2. Per that commit's message, each managed runtime gets the bridge tools to its model, Hermes gets none, and Pi callsworkspace_statusover the bridge. Read for their stated scope; not run for this ticket.
Constraints a check must respect
- A result holds only for the runtime's pinned CLI version, which the harness comments name (for example
qwen-code/harness.yml:36). - Use a model whose catalog window is not 32,768, 128,000 or 200,000, so each default stays distinguishable.
- Read the staged config from the exec facts. A key must never reach a staged file or a log (
pi/harness.yml:75-79). - Respect each runtime's credential path: OpenCode is managed only, Cursor is direct only.
What was not examined
- No runtime was run live for this ticket.
- Each CLI's own default window and compaction threshold at its pin, for Codex, Gemini, Hermes, Cursor, OpenCode, OpenClaw and Qwen Code.
- Whether OpenClaw's 200,000 drives its compaction or only a request cap.
- byo credential runs, beyond what the staged config says.
- Gemini's compression within one run, and the window Codex assumes for a model it does not know.
- Chat turns, which are not a harness.
docs/en/platform/chat/basics.md:125describes chat's own shortening of old results.
What would settle it
- Per runtime, with one model whose catalog window W is known: the window the CLI receives in its staged config is W, or the documented fallback.
- Per runtime, one long conversation past its compaction point, against a loopback stand-in model that reports W and logs each request's prompt size (pattern:
bridge-reach.ts). Pass: the runtime compacts and keeps answering, with no one-tokenlengthanswer and noempty_turn. - For runtimes with
resume: true: the compacted session resumes and answers. - Per runtime, tool reach. Either the workspace tools are staged and listed to the model (declared, or found by tool search as OpenClaw does), and a call returns the platform's answer; or the runtime declares no channel and its instructions do not name the workspace tools (Hermes, Cursor).
- Long calls: a stand-in tool that runs 90 s, on OpenCode and OpenClaw, to see whether their 60 s limit cuts it.
- No-argument tool calls succeed on each runtime's wire. Qwen Code on an Anthropic-format model is refused today (
anthropicModels: false). - Claude Code (compact prompt): steps 1 and 2 again, since its built-in prompt is shorter.
Options (no preference)
- Automated. Extend the goldens and the
bridge-reachstub so each runtime's window is pinned and each request's prompt size is recorded. Needs the runtime images in CI. - Manual. One box per runtime per check in a manual suite under
services/platform/tests/manual/, judged in a real round. Covers what a headless run cannot. - Policy first. Write down, per runtime, who sizes the window and when it compacts, as
providers.md:112does for Claude Code and Pi. Stage a window only where a runtime's CLI accepts one. - Audit first. A read-only pass over each pinned CLI's defaults, recorded in this issue, before any test is chosen.
These can be combined.
Questions for the owner
- Is OpenClaw's fixed 200,000 intended for every managed gateway model (
openclaw/harness.yml:129), or a placeholder until the catalog window can reach it? - Should a byo credential get the catalog window? Today Claude Code's variable is managed only (
claude-code/harness.yml:158), and Pi's models doc iswhen: [managed](pi/harness.yml:82). - Are Hermes and Cursor meant to have no tool channel (
mcp: false)? Do their instructions name workspace tools? That is the failure Pi had. - Is "the runtime sizes its own conversation" an acceptable answer for Codex, Gemini, Hermes, Cursor, OpenCode and Qwen Code, or should each get a staged window where its CLI accepts one?
Related
- fix(platform): give agents on Pi the model's context window #5416 (merged): the Pi window fix. This check covers the other runtimes.
e5a3243c2(onmain): the Pi tool channel.- feat(platform): let a catalog-less provider declare its models' context window #5073 (closed): a catalog-less provider's context window, the source of the 128,000 default.
- bug(platform): Qwen Code on an Anthropic model fails every run with a 400 on tools.2.custom.input_schema #5353 (closed): Qwen Code on an Anthropic model, no-argument tools.
- feat(platform): tell an agent runtime crash apart from an AI-model error #5375 (open): separates a runtime crash from an AI-model error in task failures; relevant to how a window failure is reported.
- Improvement: knowledge search and image generation exist twice, once for chat and shared-engine task runs and once for the harness bridge #4875 (open): knowledge search and image generation exist twice, once for the harness bridge.
- Decision: mount Playwright MCP in agent turns, or drop it from the sandbox image? #4730 (open): mount Playwright MCP in agent turns, or drop it.
- Epic: identify missing high-priority harness integrations and create subtickets #5014 (open): missing harness integrations. New runtimes, not these.
Activity
yannickmonney commentedon Nov 10, 2026
Per-harness test notes
Facts from
origin/mainat4368a0fb6. Paths are underconfigs/platform/system/harnesses/<runtime>/harness.ymlunless shown. The pin is theARGinservices/sandbox-runtime/Dockerfile. Nothing here was run live.For each runtime: credential lanes, what is staged for the window and compaction, resume, tool channel, what the tests already pin, and what a live check needs.
Claude Code (
CLAUDE_CODE_VERSION2.1.285):24-26). The compact-prompt variant runs the same CLI (:19).CLAUDE_CODE_AUTO_COMPACT_WINDOWtakes the catalog window only for managed models, and only below 200,000 (:158,:188-209). Otherwise it is empty. The 200,000 gate keeps a Claude model's own 1M window (the[1m]marker) from being cut down to the catalog's 200,000.:188-204).:73-81).--mcp-configwith--strict-mcp-config(:117-126).services/platform/lib/harnesses/fixtures/exec/claude-code.yml:252-308(managed case, window 32768); unitexec-builder.test.ts:971-1045. No test runs a conversation past the window.Codex (
CODEX_VERSION0.160.0):104-119).:121-131), so a resumed turn after compaction is the case to test.codex exec resume. The task host re-sends the whole current addendum at the start of each resumed turn (:121-131).mcp_servers.<id>config pairs (:134-141).fixtures/exec/codex.yml. The parser is pinned to 0.160.0 (services/platform/lib/harnesses/parsers/codex-jsonl.ts:302). No window test.Cursor (
CURSOR_AGENT_VERSION2026.10.01-e373342)CURSOR_API_KEY(:20-24).:2-3). A loopback stand-in cannot receive its requests, so window and compaction can only be checked live, with a real key.--resume, with no instructions to restate (:52).mcp: false(:35), and the composed instructions are dropped by design (:12-13). The agent sees neither Tale's instructions nor the workspace tools; only the task prompt reaches it.fixtures/exec/cursor.yml. No tool-reach proof: the runtime image test covers managed credentials only.Gemini CLI (
GEMINI_CLI_VERSION0.62.0):141-143).resume: false,:39-52). The pinned CLI's--resumereplays tool results twice (gemini-cli #29365, open), so the first request of a resumed conversation that ran a tool is refused. Each later kick is a fresh conversation. The check is one long single run, not a resumed one.mcpServersin the staged settings (:121-127). Native web tools are denied on managed runs (:111-117).OpenCode (
OPENCODE_VERSION1.18.34):18-20).-s, with the current instructions (:42).timeoutbounds its calls (:126-136).timeoutlets it finish; a live run confirms it. Image generation depends on this.OpenClaw (
OPENCLAW_VERSION2026.9.8)contextWindow: 200000andmaxTokens: 32000are fixed for the gateway model, whatever its catalog window (:113-130). Byo gets none staged. The goldens pin 200000 in every managed case (fixtures/exec/openclaw.yml). Owner question 1.--resume, with the current instructions (:50). A resumed session restores only the messages.mcp.servers(:138-147). OpenClaw finds the workspace tools by tool search, which bridge-reach exercises. Its 60 s limit is handled bybridgeCallTimeout(:145-147).Pi (
PI_CODING_AGENT_VERSION1.0.1):56-62), so its window is Pi's and is not examined.contextWindowin the stagedmodels.jsonfortale-gateway, when the catalog knows the window (:82,:96-102). When it does not, the key is left out and Pi's 128,000 applies. Fixed by fix(platform): give agents on Pi the model's context window #5416 (4368a0fb6).:90-95).--resume, with the current instructions (:55).exposure: directand no call timeout (:103-124). Round trip:services/platform/tests/integration/lib/pi-bridge-round-trip.ts(Pi callsworkspace_status).fixtures/exec/pi.yml:70(32768); unitexec-builder.test.ts:498.empty_turn, andmodels.jsonmust carry W.Qwen Code (
QWEN_CODE_VERSION0.24.7)anthropicModels: false(:31-38). No-argument tools fail on Anthropic Messages (400, bug(platform): Qwen Code on an Anthropic model fails every run with a 400 on tools.2.custom.input_schema #5353), so no Anthropic-format model should run here. Check that the gate refuses one.:77); that is a turn limit, not a window.--resume, with the current instructions (:56).mcpServers(:88-93).Hermes (
HERMES_AGENT_VERSION0.19.0):63-66).--resume, with the current instructions (:46).mcp: false(:32), and the exec facts mount none (:29-31). The runtime image test asserts Hermes gets no bridge tools (e5a3243c2).Cross-cutting
qwen-code/harness.yml:15,parsers/claude-stream-json.ts:394andparsers/claude-stream-json.test.ts:636. The Dockerfile pins 0.24.7.fixtures/exec/<runtime>.json; the goldens are.yml.Status: nothing run live; no fix proposed. The four owner questions are unchanged.
yannickmonney commentedon Nov 14, 2026
Decision
Rule. On every managed (gateway) lane, Tale tells the CLI the model's effective window, through whatever setting that CLI accepts. The effective window is the catalog window, narrowed by the organization's context limit. Claude Code keeps its documented exception: no variable at 200,000 and above, which protects the 1M window. Where the pinned CLI has no window setting, the harness comment and providers.md record who sizes the window, the CLI's fallback, and where it compacts, and a test enforces this. byo lanes keep the CLI's own model knowledge. A harness without a tool channel is never told about any workspace tool: knowledge tools, granted tools, the ask-human tool, project tools, image generation, host leases. One helper composes that guidance, and a guard test checks it. Proof is automated: goldens pin the staged window, and a new window-reach test runs each runtime against a loopback stand-in model with W = 49,152, past compaction and through a resume. Cursor gets manual boxes.
Answers
defaulton$number.harnessMountsMcp. On such a harness, the agent is told to state a missing fact in its final answer and stop, never guess. The editor shows that tool grants have no effect there. Stored grants are kept, not refused or cleared. Cursor drops composed instructions by design.Rationale. A wrong window ends long runs with one-token answers and
empty_turn. An instruction that names a missing tool sends an agent after it, and on the ask-human path it may then guess a fact it should have asked for. Patching call sites one by one misses guidance; one helper plus a guard does not. Results hold only per pinned CLI version, so they rerun on every image build.Units (all on main)
harnessMountsMcp, with a guard test (M)$numberdefault and${model.maxOutputTokens}(M).jsonreferences (M)Cross-issue amendments (decisions taken together with #4942):