Repository navigation
docs: fix verified doc-vs-code mismatches (MCP examples, HITL, defaults, tool names) (en+zh) - #3293
Conversation
All corrections verified against the current source; en and zh guides kept in sync. Partially addresses agentscope-ai#1883 and agentscope-ai#1190. building-blocks: - agent.md / tool.md: McpClientBuilder examples rewritten to the real API (create(name) + stdioTransport/sseTransport/streamableHttpTransport + buildAsync()); the documented stdio()/sse()/streamableHttp() chain does not exist (8 spots across en+zh) - agent.md: HITL guide no longer claims ToolUseBlock.getSuggestedRules() — suggested rules live on PermissionDecision; resume snippet matches PermissionHITLExample (new ConfirmResult(confirmed, toolCall)) - agent.md: drop references to the removed legacy stream API and to the non-existent modelConfig()/reactConfig() builder methods - tool.md: @tool concurrencySafe default is true, not false; ToolGroup examples use ToolGroup.builder() (the 4-arg public constructor does not exist) - model.md / agent.md: structured-output metadata key is _structured_output (leading underscore) - permission-system.md: suggested rules carried on PermissionDecision, not on ToolUseBlock harness: - memory.md: memory-enabled agents register four tools (memory_search, memory_get, memory_save, session_search), not two; drop the undocumented "up to 30 hits" cap on memory_search - plan-mode.md: whitelist is 9 tools (agent_spawn/agent_send/agent_list/ task_output/task_list included per PlanModeMiddleware); remove the stale "subagents do not inherit plan mode" known gap — inheritance is implemented (contradicted subagent.md) - skill.md / workspace.md: shell tool is named execute, not execute_shell_command - filesystem.md: DockerFilesystemSpec isolationScope defaults to USER, not SESSION - compaction.md: list_files is not in the default tool-result eviction exclusion set examples / readme: - agentscope-examples/README.md: agentscope-core-java -> agentscope-core, cd examples -> cd agentscope-examples, exec:java commands gain -pl documentation, dead ../CLAUDE.md link -> CONTEXT.md, documentation link points to java.agentscope.io (was the Python repo), section numbering fixed - README.md / README_zh.md: dependency snippets 2.0.1 -> 2.0.3 (latest release)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
oss-maintainer
left a comment
There was a problem hiding this comment.
Summary
Doc-vs-code alignment pass over README/README_zh, the examples README and the v2 en+zh building-block/harness pages. Spot-checked every behavioural claim this PR changes against main@ea78c317: @Tool.concurrencySafe() really defaults to true (Tool.java:117), the structured-output metadata key is _structured_output (MessageMetadataKeys.STRUCTURED_OUTPUT), ConfirmResult does have the 2-arg convenience constructor and getSuggestedRules() lives on PermissionDecision (not ToolUseBlock), McpClientBuilder.create(..).<transport>(..).buildAsync().block() and ToolGroup.builder() match the current APIs, the filesystem isolation default is USER (HarnessAgent build: IsolationScope fsIsolationScope = IsolationScope.USER), execute is the registered shell tool name, the 4 memory tools are memory_search/memory_get/memory_save/session_search, ToolResultEvictionConfig.DEFAULT_EXCLUDED_TOOLS matches the reworded eviction list, maxIters default is 10, CONTEXT.md exists and CLAUDE.md does not, and 2.0.3 is the latest published release. All of it holds — this is a solid, low-risk docs fix and the en/zh pairs stay in sync.
Findings
- [Warning]
docs/v2/en/docs/harness/plan-mode.md:73— the quoted plan-mode denial output still does not matchPlanModeMiddleware.DENY_MESSAGE. - [Info]
docs/v2/en/docs/building-blocks/agent.md:353— deprecatedstream(.., RuntimeContext)overloads still exist; the reworded sentence slightly over-states their removal. - [Info] plan-mode whitelist (9 tools) and the sub-agent inheritance claim verified correct.
Nothing here blocks the change; the Warning is one more instance of the exact drift this PR sets out to remove.
Automated review by github-manager-bot
| ```text | ||
| [Tool denied — plan mode is active] | ||
| Only read-only tools and plan_enter / plan_write / plan_exit / todo_write are allowed. | ||
| Only read-only tools and plan_enter / plan_write / plan_exit / todo_write / |
There was a problem hiding this comment.
[Warning] This block is still presented as the literal tool-result the model sees, but it does not match the implementation. PlanModeMiddleware.DENY_MESSAGE is:
Blocked: you are in PLAN mode (read-only). You may investigate and run read-only tools, record your plan with plan_write, and call plan_exit when ready to execute. Do not modify files or run mutating commands until the plan is approved.
So the real message neither carries the [Tool denied — plan mode is active] header nor enumerates the whitelist. Since this PR is specifically about doc-vs-code drift, worth either quoting DENY_MESSAGE verbatim or dropping the fenced block and keeping the prose (the call is rejected with a plan-mode denial note).
There was a problem hiding this comment.
Fixed in 16df4cd — both guides now quote PlanModeMiddleware.DENY_MESSAGE verbatim (the zh page quotes the English literal too, since that is the string the model actually receives), replacing the invented header + whitelist enumeration.
| @@ -353,7 +353,7 @@ RuntimeContext ctx = | |||
| Msg result = agent.call(List.of(new UserMessage("Hi.")), ctx).block(); | |||
There was a problem hiding this comment.
[Info] The stream overloads still exist — ReActAgent keeps deprecated stream(List<Msg>, StreamOptions, RuntimeContext) (and the schema/structured variants, @Deprecated(since = "2.0.0", forRemoval = true)), and they do accept a RuntimeContext. Dropping the sentence is fine if the intent is to stop advertising deprecated APIs, but "provides RuntimeContext overloads for call and streamEvents" reads as a statement about the current surface, so a short "(plus deprecated stream overloads kept for compatibility)" would be more accurate. Same for the zh mirror.
There was a problem hiding this comment.
Addressed in 16df4cd — both en and zh now read "(plus deprecated stream overloads kept for compatibility)".
| Plan Mode lets the agent "figure out and write down intent" before executing. While active, the agent is in a **read-only phase**: | ||
|
|
||
| - Only **read-only tools** plus 4 whitelisted tools work: `plan_enter` / `plan_write` / `plan_exit` / `todo_write` (the shell can be opted in — see [below](#allowing-the-shell-during-the-plan-phase-opt-in)). | ||
| - Only **read-only tools** plus 9 whitelisted tools work: `plan_enter` / `plan_write` / `plan_exit` / `todo_write` / `agent_spawn` / `agent_send` / `agent_list` / `task_output` / `task_list` (the shell can be opted in — see [below](#allowing-the-shell-during-the-plan-phase-opt-in)). |
There was a problem hiding this comment.
[Info] Verified against PlanModeMiddleware.ALWAYS_ALLOWED: exactly these 9 names (plan_enter, plan_write, plan_exit, todo_write, agent_spawn, agent_send, agent_list, task_output, task_list) — good. The child-inheritance claim also checks out: AgentSpawnTool.propagatePlanMode(...) activates plan mode on the spawned child when the parent state has isPlanActive(), so removing the "known gap" note is correct.
…s (en+zh) - plan-mode.md quoted a denial output that never existed: the real tool result is the PlanModeMiddleware.DENY_MESSAGE constant, so both guides now quote it verbatim instead of an invented header + whitelist enumeration. - agent.md said ReActAgent provides RuntimeContext overloads for call and streamEvents; the deprecated stream(.., RuntimeContext) overloads still exist, so note them as kept for compatibility.
Summary
Fixes a batch of verified doc-vs-code mismatches found by cross-checking the v2 guides against the current source. All snippets were validated against real APIs (several were copy-paste-and-fail). En and zh guides are kept in sync; no code changes. Partially addresses #1883 and #1190.
Corrections (each verified with grep against source)
Building blocks
McpClientBuilder.stdio().name(...).command(...).build()etc. do not exist. Rewritten to the real API:McpClientBuilder.create("name").stdioTransport(cmd, args...).buildAsync().block()(andsseTransport/streamableHttpTransport), matchingMcpStdioExample/McpSseExample/McpStreamableHttpExample.ToolUseBlockhas nogetSuggestedRules()(that accessor is onPermissionDecision). Resume snippet now matchesPermissionHITLExample:new ConfirmResult(confirmed, toolCall), with a pointer to passing explicit rules.PermissionDecision, not onToolUseBlock.streamAPI and to the non-existentmodelConfig()/reactConfig()builder methods.@Tool.concurrencySafedefault istrue(Tool.java:117), notfalse;ToolGroupexamples now useToolGroup.builder()— the 4-arg public constructor in the docs does not exist (real one isprotectedwith a different parameter order)._structured_output(MessageMetadataKeys.java:120), notstructured_output.Harness
memory_search,memory_get,memory_save,session_search—HarnessAgent.java:2691-2694), not two; dropped the undocumented "up to 30 hits" cap (MemorySearchToolhas none).PlanModeMiddleware.ALWAYS_ALLOWED(addsagent_spawn/agent_send/agent_list/task_output/task_list); removed the stale "subagents do not inherit plan mode" known-gap — inheritance is implemented (AgentSpawnTool.propagatePlanMode) andsubagent.mdalready documented it, so the two guides contradicted each other.execute(ShellExecuteTool.NAME), notexecute_shell_command.DockerFilesystemSpec.isolationScopedefaults toUSER(SandboxIsolationKey: null scope treated as USER), notSESSION.list_filesis not inToolResultEvictionConfig.DEFAULT_EXCLUDED_TOOLS.Examples / README
agentscope-examples/README.md:agentscope-core-java→agentscope-core,cd examples→cd agentscope-examples,exec:javacommands gain-pl documentation(all main classes live in that module), dead../CLAUDE.mdlink →CONTEXT.md, documentation link now points to java.agentscope.io (was the Python repo), duplicate section numbers fixed.README.md/README_zh.md: dependency snippets2.0.1→2.0.3(latest release).Notes
release-notes.mdentries for 2.0.2/2.0.3, and thememory_searchbounding docs line that overlaps with PR fix(harness): bound memory_search results with maxResults and line truncation #3267.