Skip to content

feat(agent): light/balanced/delivery execution settings with unified tools / 执行设定与统一工具面 - #8275

Open
SivanCola wants to merge 24 commits into
esengine:main-v2from
SivanCola:feature/agent-role-settings
Open

feat(agent): light/balanced/delivery execution settings with unified tools / 执行设定与统一工具面#8275
SivanCola wants to merge 24 commits into
esengine:main-v2from
SivanCola:feature/agent-role-settings

Conversation

@SivanCola

@SivanCola SivanCola commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replace economy/full/delivery work modes with three session execution settings (light | balanced | delivery, default balanced) that share one provider-visible tool surface and differ only in host TaskPolicy (planning route, verification intensity, independent review).

  • Unified tools: core coding/shell tools + stable use_capability; retire boot-time connect_tool_source / economy schema growth.
  • In-place switch: CLI /preset (aliases /work-mode, /profile), desktop execution-setting menu, ACP agent_preset (legacy work_mode dual-write) update the preset without controller rebuild.
  • TaskPolicy: one host-derived policy is frozen per turn and enforced across planner routing, capability routing, tool constraints, and post-mutation verification; plan mode freezes ForbidMutation; delivery readiness stays evidence-driven.
  • Events/UI: turn_phase + completion_summary on desktop composer/transcript and CLI TUI status/scrollback.
  • Compat (one version): dual-write agentPreset + legacy tokenMode on tabs/branch meta; skill profiles frontmatter is diagnostic-only.
  • Docs: CLI/GUIDE/TOOL_CONTRACT/ACP/COLLABORATION_MODES (+ site docs.astro) updated for 执行设定.

Test plan

  • go test ./...
  • cd desktop && go test ./...
  • go test -race ./internal/acp ./internal/control ./internal/agent
  • go vet ./...
  • go run ./tools/repolint
  • cd desktop/frontend && pnpm build
  • cd desktop/frontend && pnpm test:all
  • Desktop execution-setting persistence/race tests (SetAgentPreset in-place, branch-meta dual-write, ACP prompt admission)
  • CI full suite on this PR
  • Manual: CLI /preset light|balanced|delivery mid-session without rebuild; desktop execution-setting menu; ACP session/set_config_option agent_preset

Compatibility and cache impact

Cache-impact: medium - the reviewed system-prompt/tool-contract update causes one intentional cold prefix after upgrade; all execution settings then share an identical stable provider-visible tool schema, and in-place execution-setting switches do not rebuild or grow the prefix.

Cache-guard: go test ./internal/boot ./internal/agent covers TestEffectRoleSettingsShareProviderToolSurface, golden baseline/cache-prefix guards, Plan-toggle schema stability, and Delivery scope stability.

System-prompt-review: reviewed by @SivanCola - the provider-visible prompt/golden deltas describe the new execution-setting and unified-tool contract; execution-setting switches add only transient user-turn policy and do not mutate the stable system prefix.

Documentation-impact: updated - refreshed CLI, ACP, GUIDE, TOOL_CONTRACT, collaboration-mode, Chinese, and site documentation for execution settings, compatibility aliases, and unified tools.

The repolint baseline was regenerated because this PR deliberately adds/extracts execution-policy, completion, ACP, and frontend surfaces; layering violations were removed and go run ./tools/repolint is clean.

Notes

  • Legacy --profile economy|balanced|delivery remains accepted (economylight).
  • Next major can drop tokenMode dual-write and SetTokenMode aliases.

… / 角色设定与统一工具面

Problem:
Work modes (economy/full/delivery) mixed token surface trimming, delivery
gates, and UI labels. Economy forced connect_tool_source schema growth;
switching modes rebuilt controllers and busted prompt-cache prefixes.
Skill profiles could hide tools from the model surface.

Fix:
- Introduce AgentPreset (light|balanced|delivery) + TaskPolicy host floors
  for plan route, verification, and independent review.
- Share one provider-visible core surface across presets; optional tools
  dispatch only through use_capability (retire connect_tool_source boot).
- Switch role settings in place without controller rebuild (CLI /preset,
  desktop, ACP agent_preset; legacy work_mode/tokenMode dual-write one version).
- Emit turn_phase and completion_summary events; wire desktop/CLI UI.
- Keep skill profiles diagnostic-only; dual-write agent_preset on tabs/branch meta.
- Docs, i18n, golden surfaces, and regression matrix updated.

Verification:
- go test ./internal/boot ./internal/agent ./internal/cli ./internal/acp
  ./internal/control ./internal/skill ./internal/agentpreset ./internal/taskpolicy
- desktop role-setting smoke tests
Bring in recent main-v2 fixes before publishing the role-settings PR.
@SivanCola
SivanCola requested a review from esengine as a code owner August 11, 2026 01:25
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) tui Terminal UI / CLI (internal/cli, internal/control) skills Skill system (internal/skill, internal/tool) agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) labels Aug 11, 2026
Problem:
The feature branch was behind the current integration base.

Resolution:
Merge the latest main-v2 changes before applying review fixes so validation covers the current agent runtime.

Verification:
Focused and full validation will run after the review fixes are applied.
Problem:
Role settings derived policy fields that were not consistently shared by planner, capability routing, execution, and final readiness. ACP prompt admission could race an in-place role switch, and desktop branch metadata could restore a stale canonical preset. CI also exposed stale role-copy assertions, locale bundle overages, and an outdated repolint baseline.

Root cause:
Each layer independently inferred role behavior, prompt admission did not participate in the state-change lock, and session persistence updated only the legacy tokenMode field.

Fix:
Freeze one TaskPolicy per turn and enforce its route, capability, mutation, external-action, verification allowlist, explore-subagent, and post-write verification constraints. Serialize ACP admission with role changes, dual-write desktop role metadata, keep planner/router runtimes role-neutral for in-place switching, and repair lint/bundle/test contracts.

Verification:
go test ./...
cd desktop && go test ./...
go test -race ./internal/acp ./internal/control ./internal/agent
go vet ./...
go run ./tools/repolint
cd desktop/frontend && pnpm build && pnpm test:all
Problem:
The target branch advanced after the role-policy fix was pushed, so the CI merge result inherited new code outside this PR and exceeded the freshly generated repolint baseline.

Resolution:
Merge the latest main-v2 before regenerating and validating the combined-tree lint baseline.

Verification:
go run ./tools/repolint
focused and full suites rerun after the merge
Problem:
After the PR fix was pushed, main-v2 added an arbiter and transcript scrolling contracts. GitHub tests the synthetic merge, where those additions exceeded the PR's repolint and raw frontend budgets even though each branch passed independently.

Root cause:
The checked-in ratchets were generated against the previous main-v2 tip and had no room for the newly merged always-available contracts.

Fix:
Regenerate the combined-tree repolint baseline and extend the initial raw asset allowance by 3 KiB while preserving the existing gzip ceilings.

Verification:
go run ./tools/repolint
pnpm check:bundle
go test ./internal/agent ./internal/control ./internal/acp ./internal/boot
Problem:
The full CI lint job reported 19 issues that were not covered by repolint or go vet, including stale compatibility helpers, inefficient test string assembly, and staticcheck simplifications.

Root cause:
The role-setting refactor retired several helper call sites without removing their declarations, and its new policy/test code had not been run through the repository-pinned golangci-lint suite.

Fix:
Remove unused compatibility and boot helpers, simplify role-policy branches, use builders in tool-output tests, and ratchet the repolint baseline down after the cleanup.

Verification:
golangci-lint v2.12.2 run --timeout=5m
go test ./internal/acp ./internal/agent ./internal/taskpolicy ./internal/cli ./internal/boot
go run ./tools/repolint
Problem:
main-v2 advanced again while the final lint cleanup was being pushed, leaving the pull request without a mergeable synthetic ref.

Resolution:
Merge the latest target tip and validate the combined role-policy and turn-spend changes before rerunning CI.

Verification:
focused Go tests, golangci-lint, repolint, and frontend bundle checks rerun after conflict resolution

# Conflicts:
#	tools/repolint/baseline.json
…role-settings

# Conflicts:
#	tools/repolint/baseline.json
…role-settings

# Conflicts:
#	desktop/app.go
#	desktop/frontend/scripts/check-bundle-budget.mjs
…role-settings

# Conflicts:
#	internal/boot/effect_test.go
#	tools/repolint/baseline.json
…role-settings

# Conflicts:
#	internal/agent/run_loop.go
Problem: The target branch advanced with opt-in task spending and durable Inbox recovery, leaving the role-settings PR conflicted on the frontend bundle ratchet.

Resolution: Merge main-v2 at ced0eee, preserve both role-setting and Inbox contracts, and set narrowly measured locale/raw bundle ceilings for the combined tree.

Verification: go test ./internal/agent ./internal/taskpolicy ./internal/control ./internal/sessioninbox ./internal/config; cd desktop && go test ./...; focused Inbox frontend tests; pnpm test:typecheck; pnpm build; pnpm check:bundle.
Problem: TaskPolicy recognized a user's no-push/no-publish/no-deploy constraint, but the execution gate matched only literal command spellings and exact tool names. Valid global options or resolved capability names could bypass the host block.

Root cause: External-action detection used substring checks instead of the repository's static shell argv parser and did not tokenize resolved tool names.

Fix: Parse command segments and wrappers into static argv, conservatively recognize external action tokens across global options, fail closed for opaque dynamic subcommands, and classify resolved capability action tokens before execution.

Verification: focused classifier and end-to-end direct/use_capability tests; go test ./internal/agent ./internal/taskpolicy; go test -race ./internal/agent -run 'TaskPolicy|ExternalAction' -count=1; go vet ./...; go run ./tools/repolint.
Problem: main-v2 advanced with context-gauge cache invalidation while this PR independently narrowed the provider-visible tool surface, creating a Registry conflict and a stale-cache risk when the allowlist changes.

Resolution: merge main-v2 at ee2a6a7, preserve both contracts, advance schema revision only for real provider-visible allowlist changes, and cover both mutation and no-op updates.

Verification: go test ./...; go test -race ./internal/tool ./internal/agent; go vet ./...; go run ./tools/repolint; cd desktop/frontend && pnpm test:all && pnpm build.
main-v2 advanced after the role-settings CI completed with the production WebView2 smoke moved out of the shipped Desktop binary. Merge commit 717497e so the pull request remains based on the latest reviewed startup and packaging contracts while preserving the role-setting UI and bridge paths.

Verified with root and Desktop Go suites, vet, repolint, targeted race tests, frontend test:all and production build, bundle budgets, and release workflow contract tests.
main-v2 advanced after the exact role-settings CI completed with corrected over-limit context capacity rendering. Merge commit bb58eec so the pull request keeps the latest Desktop context UI and localized status contract without changing the role-setting behavior.

Verified with the full frontend test:all suite, remote and performance tests, production build, and bundle budgets.
Problem: User-facing role terminology suggests a persona switch, while these presets actually control planning, verification, and delivery behavior.

Root cause: Desktop, CLI, ACP, and documentation retained the earlier role-setting product name.

Fix: Use Execution setting / 执行设定 / 執行設定 consistently across product surfaces while preserving agent_preset, work_mode, tokenMode, and compatibility values.

Verification: go test ./internal/i18n ./internal/cli ./internal/acp; cd desktop && go test ./...; cd desktop/frontend && pnpm test:all && pnpm build; local browser menu click and overflow check.
@SivanCola SivanCola changed the title feat(agent): light/balanced/delivery role settings with unified tools / 角色设定与统一工具面 feat(agent): light/balanced/delivery execution settings with unified tools / 执行设定与统一工具面 Aug 11, 2026
Problem: CI failed in race, coverage, and platform test jobs after the product terminology changed.

Root cause: TestToolContractDocCoversDefaultBootSurfaces still expected the former role-settings heading.

Fix: Match the documentation contract assertion to the new execution-settings heading.

Verification: go test ./internal/boot; go test -cover ./internal/boot; go test -race ./internal/boot; go vet ./internal/boot; go run ./tools/repolint.
Problem:
The upstream main-v2 branch advanced while the execution-setting changes were under CI, leaving PR esengine#8275 behind the live base and conflicting in the generated repolint baseline.

Root cause:
Both branches updated files covered by the baseline, so Git could not choose combined finding counts.

Fix:
Merge the three latest upstream fixes and regenerate the repolint baseline from the combined source tree.

Verification:
- go test ./...
- cd desktop && go test ./...
- go vet ./...
- go test -race ./internal/acp ./internal/control ./internal/agent
- go run ./tools/repolint
- cd desktop/frontend && pnpm test:all
- cd desktop/frontend && pnpm build
Problem:
The upstream main-v2 branch advanced again before PR esengine#8275 could be pushed against the live base.

Fix:
Merge the latest Creation appearance overview swatch fix without changing the execution-setting implementation.

Verification:
- pnpm exec tsx src/__tests__/theme-pack.test.ts
- pnpm build
- go run ./tools/repolint
Problem:
The live main-v2 branch advanced with localized active-work errors while PR esengine#8275 was being prepared.

Root cause:
Both changes touched execution-setting notices and Chinese locale bundle budgets.

Fix:
Merge the upstream capability guidance, retain the adopted execution-setting terminology, update its contract tests, and set narrow bundle budgets for the combined locale payload.

Verification:
- pnpm exec tsx src/__tests__/capability-busy-notice.test.ts
- pnpm exec tsx src/__tests__/use-controller-meta.test.ts
- pnpm build
- go run ./tools/repolint
# Conflicts:
#	desktop/frontend/src/locales/zh.ts
#	tools/repolint/baseline.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) desktop Wails desktop app (desktop/**) skills Skill system (internal/skill, internal/tool) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant