Repository navigation
feat: wait for a terminal result on result - #136
Merged
Merged
Conversation
GenAgentServer.result/3 takes wait_ms (0 to 600_000, default 0). A pending invocation keeps the caller as a waiter; record_completion/2 replies with the terminal result, and expiry drains the inbox before replying pending. Other calls on the instance are served meanwhile. The result operation publishes wait_ms with its bounds, the shared MCP listener caps it at 5000 ms to fit its 10 s request timeout, the CLI takes result ID --wait MS, and the remote ops task and remote CLI size their RPC timeout to the wait. Closes #135.
joshrotenberg
marked this pull request as ready for review
November 1, 2026 04:13
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.
Closes #135.
Changes
GenAgentServer.result/3andInvocations.result/3takewait_ms:(0 to 600_000, default 0);result/2is unchanged. Non-keyword options or unknown keys return{:error, :invalid_options}; out-of-range or non-integer waits return{:error, :invalid_wait}.Invocationskeeps waiters per pending ID (caller plus timer) and answers with{:noreply, ...}, so other calls are served while callers wait.record_completion/2replies to every waiter for the ID (completed, failed or cancelled) and cancels their timers. On expiry it drains the inbox first, so a turn that finished since the last poll is not reported pending; then it replies{:ok, :pending}.{:result, id}call is kept, with a comment, because the control extension's tests send it.resultoperation: optionalwait_mswithminimum: 0, maximum: 600_000in its schema.resultwaits are capped at 5000 ms in schema and at runtime, because the listener's request timeout is 10 s. This matches the existingaskcap there.result ID --wait MS, with usage, invalid-wait and not-found messages.mix gen_agent_server.ops --remoteandmix gen_agent_server.remotesize the RPC timeout to the wait plus 30 s.Checks
On the host: warnings-as-errors compile, format, root tests (127, 118 before),
examples/ensemble_patterns.exs,mix gen_agent_server ask echo ci, a prod release, and every extension (control 88, mcp 34, patterns 17, peers 19, public_source 7, schedule 5, selection 8).How it was made
Second run of
docs/working-an-issue.md(#134), with one more step given to agents:workspace_writeThe review defects were the shared MCP listener's 10 s timeout, the missing schema maximum, CLI messages, unvalidated options, and expiry without draining. The operator corrected one review claim (the two-element call is not dead code) and ran the host gates.