Skip to content

fix: make Workspace context state and defaults explicit#608

Draft
luokerenx4 wants to merge 3 commits into
devfrom
codex/issue-601-context-state
Draft

fix: make Workspace context state and defaults explicit#608
luokerenx4 wants to merge 3 commits into
devfrom
codex/issue-601-context-state

Conversation

@luokerenx4

@luokerenx4 luokerenx4 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What changed

  • default unknown Pi and OpenCode models to a conservative 256K context window instead of 1M
  • add Settings → AI Provider → New Workspace defaults, where each agent can choose the credential copied into future Workspaces and Pi/OpenCode can choose a context limit
  • persist 256K explicitly for existing Pi/OpenCode creation defaults through migration 0023_workspace_default_context_window
  • resolve a credential's remembered model (then vendor flagship) during creation so a credential + context declaration produces a complete Pi/OpenCode model config
  • preserve a Workspace's context limit when the same credential and model are selected again
  • avoid carrying a Workspace-local context limit into a different credential or model
  • let context-only edits save without a connection test that cannot validate local prefill memory
  • add high-context billing/memory guidance and explicit pause/resume instructions for running sessions
  • preserve valid custom limits such as 200K in both settings surfaces
  • stop WebPi snapshot updates from stealing the scroll position while the reader is browsing history, with an explicit Jump to latest control
  • update the managed Workspace owner guide and demo API handlers

Root cause

Credential injection and the Workspace settings UI independently defaulted Pi/OpenCode custom models to 1M. Explicit credential selection re-rendered runtime config from that default and discarded the Workspace's model-specific context choice. The existing user-global credential defaults also had no context field; adding one initially exposed a second edge case where a declaration without an explicit model wrote only the provider connection, so the context limit never reached the generated runtime config.

Separately, WebPi scrolled to the transcript tail for every snapshot revision, so polling and streaming updates could prevent completed conversations from being read upward.

User impact

Users can explicitly choose what provider state a new Workspace starts with. Pi and OpenCode show 256K as the safe default, warn above it, and write the selected value into each new Workspace's local config. Existing Workspaces are untouched and remain independently editable. Repeated Quick Chat launches keep the existing Workspace's explicit context choice.

Validation

  • npx tsc --noEmit
  • cd ui && npx tsc -b
  • pnpm -F @traderalice/desktop typecheck
  • pnpm test — 2,991 passed, 6 skipped
  • targeted context, migration, route, UI, adapter, and WebPi regression suites
  • demo-browser walkthrough of the new Settings controls, custom values, and high-context warning
  • isolated real-runtime walkthrough: saved defaults, created a Workspace in the UI, and verified generated Pi/OpenCode model configs contained 256K/128K respectively
  • real Pi and OpenCode calls using LongCat-2.0 with generated 256K Workspace configs
  • CSC_IDENTITY_AUTO_DISCOVERY=false pnpm electron:smoke:workspace

Scope note

This branch is based on current dev and intentionally does not mix in the unrelated Windows path-assertion cleanup identified on PR #607.

Fixes #601

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openalice-demo Ready Ready Preview, Comment Jul 15, 2026 12:05pm

Request Review

@luokerenx4 luokerenx4 changed the title fix: preserve Pi and OpenCode context state fix: make Workspace context state and defaults explicit Jul 15, 2026
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