Skip to content

fix(harness): preserve structured output during snapshot overflow recovery - #4237

Merged
jujn merged 2 commits into
agentscope-ai:mainfrom
kevinvv03:fix/harness-structured-overflow-recovery
Nov 18, 2026
Merged

jujn merged 2 commits into
agentscope-ai:mainfrom
kevinvv03:fix/harness-structured-overflow-recovery

Conversation

@kevinvv03

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.1.0-SNAPSHOT, based on main@5a7e8e533.

Description

Fixes #4235.

In snapshot mode (journalEnabled(false)), context-overflow recovery retries structured requests through the plain call overload. The call can complete after emergency compaction without the structured data requested through Class or JsonNode schema parameters.

Preserve the original invocation through the recovery chain while passing the adjusted retry input. This retains the requested output format and the existing protection against duplicate user input.

Add four regression cases covering Class/schema calls with and without overflow, and update the English and Chinese context-management documentation.

Testing

  • HarnessAgentOverflowRecoveryTest: all 7 cases passed. Before the fix, both new overflow cases failed.
  • Full mvn -B -T1C clean verify passed on a clean source snapshot of main@5a7e8e533 plus this patch: 12,888 passed, 245 skipped, and no failures or errors.
  • Spotless and git diff --check passed.
  • Documentation checks passed: npm test (20 tests), npm run validate and npm run broken-links.

The development workspace contains an unrelated, pre-existing untracked LocalFilesystemErrorHandlingTest with four failures. It was left untouched; the full-build result above applies to the clean source snapshot containing this patch.

Overflow regression tests use a local model fixture without a real provider or API key.

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing, verified through clean verify on the clean source snapshot described above
  • Javadoc comments follow project conventions
  • Updated the relevant English and Chinese documentation
  • Code is ready for review

@mintlify

mintlify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit ac62d5c.

Approve preview

@guslegend0510 guslegend0510 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The snapshot overflow retry now preserves the requested structured output and avoids duplicating user input. I verified that both the class-based and JSON Schema regression cases fail on the base implementation and pass with this fix.

@jujn

jujn commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Assign to @guslegend0510 (Review)

@jujn
jujn merged commit a3676aa into agentscope-ai:main Nov 18, 2026
7 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.

[Bug]: Snapshot overflow recovery drops structured output in HarnessAgent

3 participants