Skip to content

Write context window and max tokens into Pi's models.json on configure - #37

Closed
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1791370894-pi-configure-context-window
Closed

devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1791370894-pi-configure-context-window

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Before this change, requesty configure for Pi wrote only {"id": "<model>"} into ~/.pi/agent/models.json. Pi then used its custom-model defaults (contextWindow ?? 128000, maxTokens ?? 16384 in modelFromJson), so a 1M-context model run through plain pi auto-compacted at 128k.

The shared modelpicker already holds the full client.Model from /v1/models / /v1/models/managed. modelpicker.ChosenMsg now carries that Model instead of just the ID, and the integrations wizard copies its ContextWindow and MaxOutputTokens into ConfigureOptions. In both configure paths (merge and overwrite), Pi builds its entry from those with piCatalogModelFrom, the same function the requesty pi launch catalog uses:

{"id": "anthropic/claude-sonnet-5-5", "contextWindow": 1000000, "maxTokens": 128000}

If the list has no value for one of these, the launch defaults are written (piCatalogContextWindow 200k, piCatalogMaxTokens 8192). Other harnesses ignore the new options.

The values are a snapshot from configure time; the pi-requesty extension, if installed, replaces them with live limits on startup.

Link to Devin session: https://app.devin.ai/sessions/ed8e81b7f4e246f79baeef970ae8f691
Open in Devin Desktop: https://app.devin.ai/desktop/session/ed8e81b7f4e246f79baeef970ae8f691?variant=devin
Requested by: @requesty-JohnCosta27

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

AI Cost

No spend detected for branch devin/1791370894-pi-configure-context-window in the last 30 days.

Updated 2026-10-27T12:46Z · last 30 days · data from Requesty

@github-actions github-actions Bot added the cost:$0.00 AI cost for this branch label Oct 7, 2026
Comment thread internal/harnesses/pi.go Resolved
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Tested 70043b8 end to end with the real Requesty catalog, an isolated HOME, and plain Pi v1.4.0 with extensions disabled (--no-extensions).

  • Picking Sonnet on the Models tab and choosing merge wrote contextWindow: 1000000 and maxTokens: 128000 to models.json. Pi replied ok and its footer showed 0.2%/1.0M (auto), not /128k.
  • Overwrite mode and a managed-policy pick both wrote 1000000/128000.
  • Picking Sonnet, pressing Esc on the mode step, then picking Haiku wrote 200000/64000, so the Sonnet values were not kept.
  • A policy with no max_output_tokens fell back to maxTokens: 8192.
  • Merge kept an unrelated provider and its models.
Plain Pi response and footer Pi model registry
Plain Pi uses 1M context Pi lists Requesty 1M and 128K

Not exercised: actual compaction near 1M tokens, and the 200k fallback for a model with no context_window. Merge still replaces the existing providers.requesty.models array; that behaviour predates this PR.

Written by Devin

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Replaced by #40 (branch renamed to fix/eng-2213-..., squashed).

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

Labels

cost:$0.00 AI cost for this branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant