Skip to content

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

Merged
jujn merged 2 commits into
agentscope-ai:mainfrom
RainYuY:fix/subagent-plan-mode-inheritance
Jul 28, 2026
Merged

fix(harness): enforce plan mode for subagents#2377
jujn merged 2 commits into
agentscope-ai:mainfrom
RainYuY:fix/subagent-plan-mode-inheritance

Conversation

@RainYuY

@RainYuY RainYuY commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

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
Collaborator Author

@jujn @chickenlj PTAL

@jujn

jujn commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

@jujn @chickenlj PTAL

Please resolve the conflicts. Thanks

…e-inheritance

# Conflicts:
#	agentscope-harness/src/main/java/io/agentscope/harness/agent/tool/AgentSpawnTool.java
@RainYuY

RainYuY commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

@jujn @chickenlj PTAL

Please resolve the conflicts. Thanks

done

@jujn
jujn merged commit 62f6315 into agentscope-ai:main Jul 28, 2026
6 checks passed
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.

2 participants