Repository navigation
Conversation
…[id: N] prompt option
…t window fallback setting
|
Dogfood results (local Passed:
Findings:
Not tested: GPT models, sub-agents, plan mode, workspace tasks, the 1M-token model config. Preview: Run 1, summary fallback after the notes write: Run 2, Run 2, Admin setting, saved as "Start a new context window": Run 3, the new window that the fallback started: Run 3 video (real run, built from screenshots taken every 1.5 s, played at 4x): run3-new-window-fallback.mp4Generated with |
# Conflicts: # coderd/x/chatd/chatd_test.go





Warning
Do not merge. This is a throwaway prototype for an RFC about token-budget context windows in Coder Agents. The code will be rewritten.
Behind the
chat-token-budgetexperiment, Coder Agents start fresh context windows instead of summarizing. Past the model's compaction threshold, the agent gets two hidden nudges to save a checkpoint with a new chat-scopednotestool and then callnew_context. The new window holds the system prompt, a lead-in that lists the notes, and a copy of the current user message. Earlier windows stay in the database, and the agent reads them withchat_history(list_windows, list_items, search, read_item). If the agent ignores both nudges, a deployment setting picks the fallback at the forced point (90% by default): today's summary compaction, or a new window with no summary.The design copies the token-budget modes of the Codex CLI and Xum. A window boundary reuses the existing compaction rows, so the prompt query does not change. The user sees the summary card with the label "New context window" and the checkpoint inside.
Main changes:
coderd/x/chatd/contextbudget.go: the token points, the once-per-window nudges, and the boundary rows.coderd/x/chatd/chattool/{notes,newcontext,chathistory}.go: the three tools.generation.go: the boundary commits with thenew_contexttool result. Thenew_windowfallback skips the summary model call.000633_chat_notesand theagents_context_window_configsite config, behindGET/PUT /api/experimental/chats/config/context-windows.site/: the "Context window fallback" admin setting and the card labels.NOTE: This branch adds migration
000633_chat_notes.To try it: open the preview
eph-pr-31191(https://3000--dev--eph-pr-31191--tk--apps.dogfood.cdr.dev, members of the dogfoodcoderorganization, develop.sh admin login) and chat with the model "Sonnet 5.5 (64k budget test)". Its 64,000-token limit at threshold 70 gives nudges at 44,800 and 51,200 and the fallback at 57,600. Locally,./scripts/develop.shon this branch turns the experiment on by default (a prototype-only change toscripts/develop.sh). The fallback setting is under Admin settings, Coder Agents, Deployment settings.Dogfood results and evidence: #31191 (comment)
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh