Repository navigation
fix(cli,mcp): forward max_tokens across step, plan, and MCP sync-after actions (#755) - #757
Merged
Conversation
…r actions (Tencent#755) Why: `bsk open --max-tokens <N>` and `bsk sync --max-tokens <N>` store `maxTokens` on the extension's cooperation baseline, but `bsk step`, `bsk plan`, and their MCP counterparts (`bsk_interact` with `sync_after`/`until_visible` and `bsk_plan`) previously exposed no `max_tokens` option and hardcoded `max_tokens: None` in `step::post_sync`. Any post-action sync on a changed or unchanged budgeted tab then failed `sameBudget` / `textDelta` (`baseline_reason: "token_budget_changed"`), discarded the held baseline, and forced an unbounded full-page re-capture. What: - Add `--max-tokens` to `bsk step` and `bsk plan`, threading `Option<u32>` through `step::post_sync` into `CooperateParams.max_tokens` for `Sync`/`Enable`. - Expose `max_tokens` on MCP `bsk_interact` (rejected unless `sync_after` or `until_visible` is set) and `bsk_plan` so CLI and MCP stay at parity. - Keep `None`/`undefined` explicit (do not silently inherit prior `maxTokens` in the extension), preserving callers' ability to switch back to unbounded captures and keeping `bsk recipe run` full-VOM resolution intact. - Update `crates/bsk-cli/skill/references/step-and-cache.md`, `docs/plan.md`, bilingual changelogs (`CHANGELOG.md`, `CHANGELOG.zh-CN.md`), and full-chain CLI/MCP E2E tests (`wave3a_lifecycle_envelope_and_cache`, `wave2_ssot_mcp_e2e`).
NianJiuZst
force-pushed
the
fix/755-step-plan-max-tokens
branch
from
November 16, 2026 09:07
222bed4 to
615d5e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #755
Summary
bsk step,bsk plan): Added--max-tokenstoStepArgsandPlanArgs/Plan, forwarding it throughstep::post_synctoCooperateParams.max_tokensonsync/enablecalls instead of hardcodingNone.bsk_interact,bsk_plan): Addedmax_tokenstoInteractArgs(validated to apply only withsync_afteroruntil_visible) andPlanArgsincrates/bsk-cli/src/cli/mcp/tools.rs.crates/bsk-cli/skill/references/step-and-cache.md,docs/plan.md,CHANGELOG.md, andCHANGELOG.zh-CN.md.Design Trade-off
max_tokensis omitted): In the current protocol (visual-observation.ts),max_tokens: 0fails header/notice budget checks, so omittingmax_tokens(None/undefined) is the only way for callers (includingbsk syncafter a truncated view orbsk recipe run) to request an unbounded full-page observation. Silently inheritingbaseline.maxTokenswhenparams.max_tokensisundefinedwould also violatetarget-policy.test.ts("never short-circuits an unchanged page acrossmax_tokensbudgets") and Wave 3a daemon budget-isolation guarantees.Verification
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --locked -- -D warningscargo test --workspace --locked(including new full-chain CLI/MCP E2E testsstep_and_plan_forward_max_tokens_and_preserve_delta_budgetinwave3a_lifecycle_envelope_and_cache.rsandbsk_interact/bsk_planmax_tokensassertions inwave2_ssot_mcp_e2e.rs)node scripts/check-skill-bundles.mjs,node scripts/check-crate-skill.mjs,node --test scripts/*.test.mjs, andpython3 scripts/check-changelog-sync.py origin/main