Surface auto_start on ez.run() - #258
Open
cboulay wants to merge 3 commits into
Open
Conversation
…ut it does not exist.
`_sanitize` checked `isinstance(value, (bool, int, float, str))` before it checked `isinstance(value, enum.Enum)`. An IntEnum, StrEnum or IntFlag member is an instance of its mixed-in builtin, so it matched the first branch and was returned verbatim rather than reduced to its value. Those members then travel to the graph server and out over the settings event, settings snapshot and component metadata wires as pickled enum members -- `SettingsSnapshotValue.structured_value` / `.repr_value` and `SettingsFieldMetadata.default` / `.choices`. A client that does not have the defining package installed cannot unpickle them, which is the case sanitizing exists to prevent. It fails hard: `_subscribe_pickled_stream` has no per-payload recovery, and a reconnecting subscriber replays the retained event history, so one such event ends settings observation for the life of the graph server. Reorder the two checks. Nothing rendered changes -- json.dumps already emitted an IntEnum as its integer -- but the payload no longer references the package that defined the enum. Fixes #260
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.
Summary
Exposes the existing
auto_startoption on the publicez.run()/GraphRunnerAPI.The
auto_startmechanism already exists lower in the stack —GraphContext(auto_start=...)→GraphServer.ensure(auto_start=...)decides whether to spawn aGraphServerwhen none is reachable at a givengraph_address, and it's already plumbed throughsync.pyandhotpath.py. Butez.run()had no way to pass it through, so callingrun()with an explicitgraph_addresswould refuse to start a server even when the caller wanted one.This adds
auto_start: bool | NonetoGraphRunner.__init__andrun(), threads it intocreate_graph_context(), and documents the semantics.Motivation
Lets a parent process pick an ephemeral port and hand it to a child that owns the graph: the child binds to that explicit address and passes
auto_start=Trueso it spawns the server rather than expecting one to already exist.Behavior
auto_start=None(default): unchanged — a server is auto-started only when no explicitgraph_addressis given and no environment override is set.auto_start=True: force auto-start even when binding to a specific address.Tests
Adds
test_run_auto_start_with_explicit_address, which runs a pub/sub graph on an explicit ephemeral port withauto_start=Trueand asserts all messages are delivered.🤖 Generated with Claude Code