[CI verification] Fix pdb / breakpoint() hang in workflow code#3
Open
elidlocke wants to merge 4 commits into
Open
[CI verification] Fix pdb / breakpoint() hang in workflow code#3elidlocke wants to merge 4 commits into
elidlocke wants to merge 4 commits into
Conversation
* Fall back to model_dump_json for OpenAI payload serialization OpenAI response and stream event types whose pydantic serializer is a lazily-built MockValSer cannot be serialized by the generic any-schema serializer, raising PydanticSerializationError (e.g. when streaming via WorkflowStreamClient). The model's own model_dump_json() handles them. Fixes temporalio#1585 * Dispatch pydantic models to their own serializer OpenAI's BaseModel sets defer_build=True, so a model's serializer is a MockValSer placeholder until pydantic's lazy build runs. The generic any-schema serializer reaches for that placeholder directly without triggering the build and raises PydanticSerializationError. Route pydantic models through their own model_dump_json (which triggers the build) by type instead of catching the error; non-model values continue through the generic serializer unchanged. * Build streamed events at the source instead of in the converter Force the deferred pydantic build on each streamed event before it is published or returned, so it serializes regardless of build state. This also covers the activity's list return value, which the payload converter serializes generically and cannot build on its own. Drop the now-redundant to_payload override.
* Update core submodule * Handle nexus annotation protos * Fix link conversion lint * Update temporalio/nexus/_link_conversion.py Co-authored-by: Alex Mazzeo <alex.mazzeo@temporal.io> --------- Co-authored-by: Alex Mazzeo <alex.mazzeo@temporal.io>
…poralio#1570) * TDD: failing test * AI-249: Support CustomTool in OpenAI Agents plugin tool dispatch Fixes temporalio#1561. Adds a CustomToolInput dataclass and CustomTool dispatch branch (mirroring the existing HostedMCPTool precedent), so Workflows exposing any CustomTool subclass — notably SandboxApplyPatchTool, which the default Filesystem capability registers on every SandboxAgent — no longer fail with `ValueError: Unsupported tool type: apply_patch` at Activity input construction. Also round-trips `defer_loading` through `tool_config`, so direct `CustomTool(defer_loading=True)` callers continue to work with `ToolSearchTool()` lazy tool discovery. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * AI-249: Type-annotate defer_loading test stub basedpyright in CI flagged the inline async stub callable for missing type annotations and unused-parameter warnings. Adds Any/str annotations and underscore-prefixes the params. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * PR comments --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When debug_mode=True (or TEMPORAL_DEBUG=1), breakpoint() inside workflow code now opens an interactive pdb prompt -- including from a sandboxed workflow run under pytest. Four pieces: - Inline dispatch on the asyncio main thread (via loop.call_soon to avoid nesting inside the dispatch task's __step() and tripping Python 3.14's task-entry validation). - breakpoint removed from the sandbox's invalid builtins so the call reaches the worker hook. Nothing else is relaxed. - A Pdb subclass that lands at the workflow's own frame, suspends sandbox checks during each REPL interaction, and overrides q/Ctrl-D to continue the workflow instead of failing it with BdbQuit. - A defensive sys.breakpointhook that raises a clear RuntimeError when breakpoint() is called from a workflow worker thread without debug_mode, replacing the previous silent hang. When debug_mode is not set, the worker's dispatch and sandbox config are unchanged. Adds a README subsection on debugging workflows and five tests at tests/worker/test_breakpoint_hang.py. Verified on Python 3.13 and 3.14. Closes temporalio#1104.
ae0fa2d to
e8702f5
Compare
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.
Self-PR on fork to run the full CI matrix for upstream PR
temporalio#1568 while upstream CI is gated on
first-time-contributor approval.
Do not merge. This branch is what we want upstream to take.
Diff should be exactly 3 files: