chore(sdk): deprecate AgentBase.model_dump_succint - #4328
Merged
VascoSch92 merged 1 commit intoAug 3, 2026
Merged
Conversation
Unreferenced public method flagged in OpenHands#4224. Public API removal policy requires 5 minor releases of runway, so mark it deprecated in 1.40.0 for removal in 1.45.0 rather than deleting it now.
9 of 10 tasks
all-hands-bot
left a comment
Collaborator
There was a problem hiding this comment.
This review was created by an AI agent (OpenHands) on behalf of the repository maintainers.
Verdict
No material findings. The change is correct, minimal, and well-tested.
Risk Assessment: LOW — Additive-only change with no runtime behavior modification. The method body is byte-identical; only a decorator and an import were added, plus a new test file.
What this PR does
Adds @deprecated(deprecated_in="1.40.0", removed_in="1.45.0", details="Use model_dump(exclude_none=True) instead.") to AgentBase.model_dump_succint, starting the deprecation runway required before the method can be removed under the SDK's public-API compatibility policy (DEPRECATION_RUNWAY_MINOR_RELEASES = 5).
Verification performed
- Diff is additive-only. Confirmed via the PR diff: a new import, the
@deprecateddecorator, and a new test file. The method body and docstring source are unchanged (thedeprecationpackage injects the.. deprecated::block at decoration time, so there is no manual docstring duplication). - Runway is the legal minimum.
_minimum_removed_in("1.40.0")returns"1.45.0"(1.40 + 5 minors), matchingremoved_in. - Version anchoring is consistent with existing entries.
deprecated_in="1.40.0"is at the current version because thedeprecationdecorator only warns whencurrent_version >= deprecated_in; anchoring ahead would leave the warning untestable in-tree. The existingwarn_deprecatedentries follow the same pattern (anchored at or below the version current when written). - Both policy gates pass.
check_deprecations.py-> exit 0 (openhands-sdk: 5 deprecation metadata entries).check_sdk_api_breakage.py-> exit 0 (No breaking changes detected). - Tests pass.
tests/sdk/agent/test_model_dump_succint_deprecation.py-> 3 passed. Coverage is appropriate and proportionate: warning emission with both version strings asserted, equivalence tomodel_dump(exclude_none=True), and the explicitexclude_none=Falseoverride path. - Runtime behavior confirmed. Exactly one
.. deprecated::directive in the docstring; the emittedDeprecatedWarningreadsmodel_dump_succint is deprecated as of 1.40.0 and will be removed in 1.45.0. Use model_dump(exclude_none=True) instead.;model_dump_succint() == model_dump(exclude_none=True). - No callers exist.
git grep model_dump_succintfinds only the definition and the new test file.
Notes
- The
succinttypo is deliberately left alone — correcting it would introduce a new public symbol rather than deprecate one, which is the right call for a removal-track PR. - This is the first use of the
@deprecateddecorator (vswarn_deprecated) in the SDK. The decorator is the correct tool for direct method annotation, and the canonical helper inopenhands.sdk.utils.deprecationis used as intended. - The author explicitly flagged the maintainer decision point (deprecation vs allowlisted removal via
_ACCEPTED_REMOVED_MEMBERS); that's a policy call for maintainers, not a code issue.
VascoSch92
approved these changes
Aug 3, 2026
Member
|
Thanks :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HUMAN:
For #4224 I picked up the
model_dump_succintitem. I went with a deprecation rather than a deletion — removing it outright would pull a public method out from under anyone still using it with no warning period, and that isn't how this repo treats public API.AGENT:
Why
AgentBase.model_dump_succint()is the last unchecked dead-code item on #4224. It has no callers anywhere in the tree —git grepfinds only the definition.It cannot be deleted in a single PR, which is presumably why #4225 cleared the other five items and left this one.
AgentBaseis exported viaopenhands.sdk.__all__, socheck_sdk_api_breakage.pygoverns its public members, and the deprecation scan runs against the baseline tree rather than the PR:So the
@deprecatedmarker has to exist in an already-published release before removal is permitted. A PR that adds the marker and deletes the method together still fails, because the baseline it is compared against has no marker. Deleting it today gives:This PR therefore starts the runway instead of removing.
Question for maintainers — the reason this is worth a look rather than a rubber stamp. The issue says "remove", and this PR does not remove. There is an escape hatch:
_ACCEPTED_REMOVED_MEMBERSincheck_sdk_api_breakage.pyalready allowlists two removals (DockerWorkspace.mount_dir/DockerDevWorkspace.mount_dir, from #3822, shipped withrelease-note-required). If you would rather allowlist this one and take the deletion now, say so and I will swap this PR for the removal. If you would rather leave the method alone entirely, that is a fine answer too and I will close this. I picked the deprecation route because adding an entry to that allowlist is accepting a breaking change on behalf of downstream clients, which felt like your call and not mine.Summary
@deprecated(deprecated_in="1.40.0", removed_in="1.45.0", ...)toAgentBase.model_dump_succint, using the canonical helper inopenhands.sdk.utils.deprecation.1.45.0is exactly the minimum legal target:_minimum_removed_in("1.40.0")returns"1.45.0"forDEPRECATION_RUNWAY_MINOR_RELEASES = 5.deprecated_in="1.40.0"rather than1.41.0because the decorator only warns whencurrent_version >= deprecated_in, so anchoring ahead of the current version leaves it untestable in-tree. This matches existing entries, which anchor at or below the version current when they were written.succinttypo is deliberately left alone — correcting it would add a new public symbol rather than remove one.model_dump(exclude_none=True), and the explicitexclude_none=Falseoverride... deprecated::docstring block: thedeprecationpackage injects its own at decoration time, so a manual one renders twice.Follow-up note for whoever does the deletion:
check_deprecations.pygoes red on every PR oncepyprojectreaches 1.45.0, while the api-breakage gate rejects the removal until then. So the deletion has to ride in the 1.45.0 release PR itself. That is pre-existing behavior — the four existing1.36.0 → 1.41.0deprecations hit the same wall at the next release — not something introduced here.Issue Number
Part of #4224
How to Test
Full SDK suite (baseline on
mainbefore this change was 5650 passed / 9 skipped / 13 xfailed — the delta is exactly the three new tests):Focused tests:
Both policy gates:
Lint:
The warning and docstring, confirmed at runtime:
Exactly one
.. deprecated::directive, and the emittedDeprecatedWarningreads: