Add token economy composer mode / 增加省 token 协作模式#4151
Conversation
af98812 to
254f870
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af98812842
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Merged — another excellent one, and thanks for the clean rebase onto main-v2 after #4071 landed. I measured the effect end-to-end: economy cuts the first-request prefix ~56% on a lean project (37 tools / ~11.8k tok → 20 / ~5.2k) and more as skills/MCP/CodeGraph/LSP stack up — the economy prefix stays flat while full grows. That's exactly the lever this project is built around. What I appreciated most: the default/full profile is provably byte-identical (full == default on the complete provider-visible schemas, not just names), so existing users' cache is untouched — and you fenced both profiles with regression tests. The connect-on-demand round-trip is the right tradeoff for the lean-coding common case. One note for the record (not a change request): in economy the agent spends a turn on |
Summary
#4071 has already landed in
main-v2. This PR is now rebased directly on the latestmain-v2and should be reviewed as the follow-up delta that adds a desktop/composer token economy mode. The goal is to keep the first provider-visible request lean for economy sessions while preserving the existing full/default request shape.What changed
TokenModeboot profile:full/ empty keeps the existing default capability surface.economykeeps only core coding tools visible at boot and moves optional sources behindconnect_tool_source.connect_tool_sourcefor economy mode to enable optional capabilities on demand:web_fetchinstall_sourcetasktask,web_fetch, andinstall_sourceare hidden from the economy first request until explicitly enabled.MetaandTabMetaComposerProfilemodel:goalDraftModehelper and testdocs/COLLABORATION_MODES.zh-CN.mddocs/TOOL_APPROVAL_MODES.zh-CN.mddocs/GUIDE.zh-CN.mdCache behavior
This intentionally creates two stable request profiles rather than mutating the existing full profile:
connect_tool_source, so later turns pay for them only when the task actually needs them.Rebase update
After #4071 was merged, this branch was rebased with only the token economy commit on top of the latest
main-v2. The PR diff now excludes the history/memory retrieval implementation from #4071 and contains only the token economy follow-up changes.Validation
Passed:
git diff --checkgo test ./internal/boot -count=1go test ./...fromdesktop/pnpm --dir desktop/frontend test:typecheckpnpm --dir desktop/frontend testpnpm --dir desktop/frontend check:cssLocal environment notes:
go test ./...with the normal user environment failed only because machine-local MCP configuration pollutedinternal/control TestRemoveMCPServerRemovesUnconnectedLazyPlaceholder.go test ./...with an isolated home removed that MCP-config failure; the remaining local failures were macOS sandbox confinement tests (internal/sandbox TestSandboxEnforcesWritesandinternal/tool/builtin TestBashSandboxConfinement) where this host did not deny writes outside the sandbox root. Those failures are unrelated to this token economy change.