Repository navigation
Let services and handlers declare themselves non-preemptable - #324
Open
StephanEwen wants to merge 1 commit into
Open
StephanEwen wants to merge 1 commit into
StephanEwen wants to merge 1 commit into
Conversation
Adds a `preemptable` option on services and handlers (default true, the handler setting overrides the service one), sent in the endpoint manifest under service discovery protocol V6. When false, the runtime never eagerly suspends invocations of the handler to free concurrency capacity; they still suspend on the inactivity timeout. For runtimes that negotiate an older discovery version the field is dropped instead of failing discovery, since those runtimes never preempt invocations.
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. The flag is passed through as-is at both the service and handler level, and the runtime resolves the handler override. Below V6 the field is dropped instead of rejected, which is right because older runtimes never preempt.
Reviewed changes
I reviewed the whole diff: the option plumbing, the manifest emission, the V6 negotiation and the new tests.
- Option plumbing:
preemptableis added to theService,VirtualObjectandWorkflowconstructors and tohandler(),main()and_add_handler(). It flows throughmake_handlertoHandler.preemptable.SessionObject.handler/viewandAgentObject/AgentOptionsforward it too, so agent-internal handlers inherit the service value. - Manifest:
discovery.Serviceanddiscovery.Handlercarrypreemptable.PythonClassEncoderleaves it out when it isNone, so the field appears only when explicitly set. - Version handling:
send_discoverynegotiatesendpointmanifest.v6+jsonahead of v5.compute_discovery_jsonclears the field forversion <= 5. I checked restatedev/restate#6026: V6 only adds this optional bool (default true, the handler overrides the service), so advertising V6 brings no other manifest obligations. - Tests:
tests/discovery.pycovers V6 emission, the handler override and inheritance, and V6/V5 negotiation end to end throughsend_discovery. These tests andruffboth pass locally.
claude-opus-5-5 | 𝕏
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.

Adds a
preemptableoption on services and handlers (default true, the handler overrides the service), sent in the endpoint manifest under discovery protocol V6. When false, the runtime never eagerly suspends invocations of that handler to free concurrency capacity. Below V6 the field is dropped instead of failing discovery, since older runtimes never preempt.Requires restatedev/restate#6026 (discovery protocol V6), which is split out of restatedev/restate#5931.
🤖 Generated with Claude Code