Skip to content

chore(sdk): update unset logic - #2435

Merged
Eugene Yurtsev (eyurtsev) merged 9 commits into
mainfrom
eugene/update_unset_logic
Apr 2, 2026
Merged

Eugene Yurtsev (eyurtsev) merged 9 commits into
mainfrom
eugene/update_unset_logic

Conversation

@eyurtsev

@eyurtsev Eugene Yurtsev (eyurtsev) commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator

Update unset logic so that files_update can only be dict | None (not Unset)

@github-actions github-actions Bot added package:deepagents Changes related to the `deepagents` SDK and agent harness. infra org:internal Issue or pull request created by a member of the `langchain-ai` GitHub organization. size: S Pull request with a small diff. labels Apr 2, 2026
@eyurtsev
Eugene Yurtsev (eyurtsev) marked this pull request as ready for review April 2, 2026 19:54
Copilot AI review requested due to automatic review settings April 2, 2026 19:54
@codspeed

codspeed Bot commented Apr 2, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 32 untouched benchmarks
⏩ 15 skipped benchmarks1


Comparing eugene/update_unset_logic (6448794) with main (5b2893c)

Open in CodSpeed

Footnotes

  1. 15 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copilot AI 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.

Pull request overview

This PR adjusts the deprecated files_update handling in backend result types so callers never observe the sentinel value and files_update is normalized to dict | None.

Changes:

  • Introduces an Unset sentinel and _normalize_files_update() helper to convert the sentinel into None and emit the deprecation warning only when files_update is explicitly provided.
  • Reworks WriteResult and EditResult to use @dataclass(init=False) with custom __init__, ensuring files_update is stored as dict | None (never _Unset).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +212 to 215
error: str | None
path: str | None
files_update: dict[str, Any] | None

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

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

files_update used to be excluded from the dataclass repr (it was declared with repr=False). With the new @dataclass(init=False) + plain annotation, files_update will now appear in WriteResult.__repr__, which can make logs noisy and potentially include large/sensitive data even though the field is deprecated. Consider restoring repr=False for files_update (e.g., by using a dataclass field with repr=False, while still normalizing the value in __init__).

Copilot uses AI. Check for mistakes.
Comment on lines 177 to 182
class _Unset:
"""Sentinel type for detecting explicit parameter usage."""


_FILES_UPDATE_UNSET = _Unset()
Unset = _Unset()

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

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

The sentinel is now exposed as a public module symbol named Unset. This is a new public API surface and the CamelCase name is easy to confuse with a type/class. If external callers aren’t expected to use it, consider keeping it private (e.g., _UNSET) or, if it is meant to be a constant, use an all-caps name to match typical constant conventions.

Copilot uses AI. Check for mistakes.
@eyurtsev
Eugene Yurtsev (eyurtsev) merged commit d3af2ae into main Apr 2, 2026
43 checks passed
@eyurtsev
Eugene Yurtsev (eyurtsev) deleted the eugene/update_unset_logic branch April 2, 2026 20:11
james8814 pushed a commit to james8814/deepagents that referenced this pull request May 1, 2026
Update unset logic so that files_update can only be dict | None (not
Unset)
james8814 pushed a commit to james8814/deepagents that referenced this pull request May 1, 2026
Merges upstream-sync-round11 into master.

Key upstream changes:
- fix: remove legacy subagents API (langchain-ai#2443) — backward-compat shim retained
- fix: inherit parent interrupt_on for subagents (langchain-ai#2334)
- fix: plumb through generics for create_deep_agent (langchain-ai#2383)
- fix: improvements in sandbox.write/read (langchain-ai#2321)
- fix(acp): block dangerous shell patterns (langchain-ai#2308)
- chore: update unset logic (langchain-ai#2435)
- feat(evals): auto-regenerate eval catalog (langchain-ai#2432)
- Various evals CI improvements, deps bumps (aiohttp, anthropic, litellm)

Local fixes:
- Restore local enhancements (logging, stream_writer, skills_allowlist,
  _EXCLUDED_STATE_KEYS expansion)
- Manual langchain>=1.2.15 dependency extraction (version kept at 0.5.0)
- Regenerate EVAL_CATALOG.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

# Conflicts:
#	libs/acp/deepagents_acp/server.py
#	libs/acp/uv.lock
#	libs/deepagents/deepagents/middleware/subagents.py
Marcelo5444 pushed a commit to Marcelo5444/deepagents that referenced this pull request Jul 30, 2026
Update unset logic so that files_update can only be dict | None (not
Unset)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

org:internal Issue or pull request created by a member of the `langchain-ai` GitHub organization. package:deepagents Changes related to the `deepagents` SDK and agent harness. size: S Pull request with a small diff.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants