Skip to content

fix(harness): enforce plan mode for subagents - #2377

Open
RainYuY wants to merge 1 commit into
agentscope-ai:mainfrom
RainYuY:fix/subagent-plan-mode-inheritance
Open

fix(harness): enforce plan mode for subagents#2377
RainYuY wants to merge 1 commit into
agentscope-ai:mainfrom
RainYuY:fix/subagent-plan-mode-inheritance

Conversation

@RainYuY

@RainYuY RainYuY commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Install Plan Mode enforcement for automatically built general-purpose and declared subagents.
  • Propagate the parent's Plan Mode configuration, including shell access and the plan file directory.
  • Resynchronize Plan Mode state before spawning, reusing, or messaging persistent subagents.
  • Add regression tests covering Plan Mode propagation and write-tool restrictions.

Motivation

Plan Mode enforcement is provided by PlanModeMiddleware, rather than by the shared planActive state alone.

Previously, automatically built subagents inherited the parent's Plan Mode state but did not install the corresponding manager and middleware. As a result, tools such as write_file and edit_file could bypass the read-only boundary while the parent agent was in Plan Mode.

The parent agent was unaffected because its Plan Mode middleware was installed during its own build process.

Testing

mvn -nsu -pl agentscope-harness -am \
  -DskipITs \
  -Dtest=PlanModeSubagentPropagationTest,AgentSpawnToolPlanModeTest \
  -Dsurefire.failIfNoSpecifiedTests=false \
  test

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../agentscope/harness/agent/tool/AgentSpawnTool.java 88.88% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@RainYuY

RainYuY commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@jujn @chickenlj PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant