fix: update sandbox and template models to use Pydantic Field for TTL…#58
Open
fix: update sandbox and template models to use Pydantic Field for TTL…#58
Conversation
… aliases This commit modifies the `sandbox_ttlin_seconds` and `sandbox_idle_ttlin_seconds` fields in the `Sandbox` and `Template` models to utilize Pydantic's `Field` for aliasing to `sandboxTTLInSeconds` and `sandboxIdleTTLInSeconds`, respectively. Additionally, tests have been added to ensure correct parsing and serialization of these fields with their aliases. Co-developed-by: Aone Copilot <noreply@alibaba-inc.com> Signed-off-by: Sodawyx <sodawyx@126.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Issue #53 by explicitly aliasing TTL-related fields that contain an acronym (TTL) so they correctly parse from/serialize to the Alibaba Cloud API’s expected camelCase keys (e.g., sandboxTTLInSeconds).
Changes:
- Add explicit Pydantic
Field(..., alias=...)for TTL fields inTemplate,Sandbox, andTemplateInput. - Add unit tests covering alias parsing/serialization and
from_inner_object()behavior for the TTL fields. - Minor test/style formatting cleanups in OpenAPI and integration test fixtures.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| agentrun/sandbox/template.py | Explicit alias for Template.sandbox_ttlin_seconds → sandboxTTLInSeconds. |
| agentrun/sandbox/sandbox.py | Explicit alias for Sandbox.sandbox_idle_ttlin_seconds → sandboxIdleTTLInSeconds. |
| agentrun/sandbox/model.py | Explicit alias for TemplateInput.sandbox_ttlin_seconds → sandboxTTLInSeconds. |
| agentrun/sandbox/__template_async_template.py | Keeps the codegen source template in sync with the TTL alias fix. |
| agentrun/sandbox/__sandbox_async_template.py | Keeps the codegen source template in sync with the idle TTL alias fix. |
| tests/unittests/utils/test_model.py | Adds tests validating TTL alias parse/serialize behavior and from_inner_object() parsing. |
| tests/unittests/toolset/api/test_openapi.py | Formatting-only change to $ref strings in test schemas. |
| tests/unittests/integration/test_langchain_agui_integration.py | Formatting-only change to request JSON message content strings. |
| agentrun/integration/utils/tool.py | Formatting-only change for how description is constructed in schema building. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
… aliases
issue: #53
This commit modifies the
sandbox_ttlin_secondsandsandbox_idle_ttlin_secondsfields in theSandboxandTemplatemodels to utilize Pydantic'sFieldfor aliasing tosandboxTTLInSecondsandsandboxIdleTTLInSeconds, respectively. Additionally, tests have been added to ensure correct parsing and serialization of these fields with their aliases.Co-developed-by: Aone Copilot noreply@alibaba-inc.com
Fix bugs
Bug detail
Pull request tasks
Update docs
Reason for update
Pull request tasks
Add contributor
Contributed content
Content detail
Others
Reason for update