Skip to content

fix(platform): give agents on Pi the model's context window - #5416

Merged
yannickmonney merged 2 commits into
mainfrom
fix/pi-context-window
Nov 7, 2026
Merged

yannickmonney merged 2 commits into
mainfrom
fix/pi-context-window

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

What broke

Tale staged Pi's model with its id alone, so Pi took 128,000 tokens for every model it reached through the gateway. Pi caps each request's output at that window minus its estimate of the conversation (one token at least) and compacts only near it. Once a conversation of a larger model passed about 124,000 estimated tokens, every request asked for one token: the model stopped with length after one token, the run ended with empty_turn ("the agent ended its turn without a final report"), and the retry, which resumes the same Pi session, failed the same way at once.

Seen on a production deployment running 0.5.104 with agents on Pi (models of 196,608 tokens): a standing triage role, whose runs continue one conversation, failed twice at 115,854 input tokens with stopReason: length, output: 1, and a long Coder run failed after 50 minutes, then three times more on resume.

The change

  • Pi's model entry carries the run's window. harness.yml for Pi now stages contextWindow beside the model id: the window ${model.contextWindow} already gives Claude Code, the catalog's narrowed by the organization's context limit. Unlike Claude Code's, there is no below gate: Pi knows no model it reaches through Tale, so any resolved window is better than its 128,000.
  • A number template for doc fragments. A set tree could only substitute strings, and Pi's schema takes a number. { $number: '<template>' } now stands for the whole number its template resolves to. When the template resolves to nothing (an unknown window), its key or array slot is left out, so the CLI keeps its own default. Any other text is a config defect, refused without repeating it. $number can no longer be a key of a set tree. No shipped harness used one.
  • Docs (en, de, fr): the provider and the policies pages say that Pi follows the window, and a context limit, at any size.
  • Release notes for v0.5.105.

Testing

  • lib/harnesses: 358 tests. New: number templates resolve, are left out when empty (key and array slot), and refuse other text without echoing it. Pi's model gets the catalog window, and none when it is unknown. Pi's golden managed-model-context-window is refrozen with "contextWindow":32768. Pi left the "builds the same execs whatever the window" group.
  • packages/shared providers.test.ts: 104 tests. New: the schema reads a number template and refuses $number as a key, beside other keys, or as a non-text value.
  • tsc --noEmit for packages/shared and services/platform, type-aware oxlint, oxfmt --check, lint:links, the docs locale guards, and release-notes.ts --version v0.5.105 (no migration, API contract unchanged at 3.53.0).

Tale staged Pi's model with its id alone, so Pi took 128,000 tokens for
every model it reached through the gateway. Pi caps each request's
output at that window minus its estimate of the conversation, one token
at least, and compacts only near it: once a conversation of a larger
model passed about 124,000 estimated tokens, every answer was one token
long (stop reason `length`), the run ended without a report
(`empty_turn`), and its retry, which resumes the same conversation,
ended the same way.

Pi's models.json entry now carries the run's window, the catalog's
narrowed by the organization's context limit, as `contextWindow`. A
`set` fragment takes a number from the build as a number template,
`{ $number: '${model.contextWindow}' }`: the whole number its template
resolves to, and its key (or array slot) left out when that is empty,
so an unknown window keeps Pi's own default. Any other text is refused
without being repeated, and `$number` is no longer a key a `set` tree
may use.

The docs say that Pi follows the window, and a context limit, at any
size.
@yannickmonney
yannickmonney enabled auto-merge (squash) November 7, 2026 21:59
@yannickmonney
yannickmonney merged commit 4368a0f into main Nov 7, 2026
112 of 115 checks passed
@yannickmonney
yannickmonney deleted the fix/pi-context-window branch November 7, 2026 22:47
@yannickmonney

yannickmonney commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Release lease released: v0.5.105 is published

  • Holder: the operator, outside the hub (every dispatch is off).
  • Released: 2026-11-07 23:50 UTC, before the 01:51 UTC expiry.
  • Outcome: v0.5.105 is published from candidate 4368a0fb6a12b247e5a72f39546f6fc220ac1412 and is GitHub's latest release. Everything RELEASING.md step 5 checks is verified.

Receipt (RELEASING.md, "A release that has to go out", step 4):

What Identity Result
Candidate 4368a0fb6a12b247e5a72f39546f6fc220ac1412, version v0.5.105 the squash merge of #5416 (receipt also there), which carries the fix and .github/release-notes/v0.5.105.md; its tree equals the pull request's head 6a2720ea6
Candidate runs Build 42422559106, Checks 42422559107, SAST 42422559115, Commitlint 42422559137, E2E 42422559070, CLI 42422559079, Security 42422559119 all success on attempt 1, the last at 23:08 UTC
Gate release-candidate-gate.ts --sha 4368a0fb… --version v0.5.105, run at 23:09 UTC eligible, no reasons (arrival #5416 at 22:47:30 UTC)
Tag Release tag run 42423955842 ran the gate again and pushed v0.5.105 at the candidate pushed 23:10:50 UTC
Release Release run 42424052222 success on attempt 1; GitHub release published 23:18:56 UTC
Images all 12 services (tale-platform, -db, -proxy, -session-manager, -docs, -ui-docs, -web, -sandbox, -sandbox-runtime, -sandbox-buildkitd, -sandbox-llm-gateway, -sandbox-egress), :0.5.105 and :latest, linux/amd64 and linux/arm64 each org.opencontainers.image.revision is the candidate, each org.opencontainers.image.version is 0.5.105, and each :latest is the same index as :0.5.105
Publish packages run 42424688973 success; ui-v0.5.105 (0ea4093e1) and marketing-ui-v0.5.105 (d92ef2bdb) both record from 4368a0fb6a12b247e5a72f39546f6fc220ac1412
CLI run 42424701606 on the tag success; tale_linux, tale_linux_arm64, tale_macos, tale_macos_x64 and tale_windows.exe attached with tale_checksums.txt by 23:27 UTC, and each binary's GitHub digest equals its line in tale_checksums.txt

Holds, read again before the tag at 23:09 UTC: only the lease comment on the hub's Decide task; no comment or open issue names a hold.

Other checks:

  • main's own runs at the candidate: push Checks 42422253273, SAST 42422253313, CLI 42422253382 and Commitlint 42422253299 passed on attempt 1. Push Build 42422253332 ran out of its job time limits on attempt 1 (Docs container test past 15 minutes, Build platform past 20) while the candidate's Build ran beside it on the same runners; the candidate's Build, which builds the complete graph, passed both jobs in about six minutes each. Every job re-ran as attempt 2 from 23:32 UTC and passed at 23:49 UTC: Build platform in six and a half minutes, Docs container test in under ten. It is the push-Build time-out ci: main's Checks fail on 14 of 18 pushes since 2026-10-26 on checks that pass on a re-run, and main's Build times out on every push #5199 tracks (noted there).
  • Workspace upgrade: the newest run on main, 42338321230 (scheduled, 2026-11-07 04:24 UTC), passed; tools/cli has not changed since its source 673693988.
  • The fix in the image: tale-platform:0.5.105's /app/system/harnesses/pi/harness.yml gives Pi's model entry contextWindow: { $number: '${model.contextWindow}' }.

A published version is not a deployment elsewhere; Ops adopts it with its release adopter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant