[P1] Define dual synchronous/asynchronous API contract across RLM libraries #54
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/prolog-rlm#54
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Make blocking-capable
prolog-rlmlibrary operations available through both synchronous and asynchronous APIs, following one asynchronous execution path plus a synchronous bridge for callers that want blocking behavior.This is a cross-library contract, not an
agentProlog/-only feature.Current state — 2026-08-18
Canonical
maininspected for this reconciliation:abfc30ebb9f335d5841c1f7910bd474da905ebcf.The core migration is substantially complete:
The old status sentence saying “#52 remains open” and treating #53 as an unfinished dependency was stale. Both #52 and #53 are closed on canonical
main.This issue remains open for the parts of the cross-library contract that do not yet exist end to end: concrete process/test/network tool surfaces under #49/#50, equivalence coverage for those future blocking-capable surfaces, and downstream
agentProlog/approval/TUI responsiveness. The existence of non-blocking pending approval in core does not prove a TUI that has not been built.Design principle
Do not build two independent implementations of every operation.
Prefer:
Code already running inside a bounded async worker calls the trusted execute ABI directly rather than nesting another Future wait.
Required task/future semantics
The reusable asynchronous result abstraction must support at least:
Cross-library coverage
The dual API contract applies where blocking or latency is meaningful, including provider/model requests, streaming, retries, tool/process/network work, MCP lifecycle and invocation, supervised agent work, graph run/resume, approval resolution, and downstream interactive clients.
Immediate/pure operations do not need decorative async twins.
Sync/async equivalence
For the same operation and inputs:
Avoid nested blocking
The async implementation must never internally call the synchronous wrapper for an async operation. The sync wrapper may wait on the async implementation.
Streaming
Streaming model/tool operations should be naturally asynchronous, with a synchronous convenience consumer allowed to collect/iterate the same stream rather than creating a second provider implementation.
Acceptance criteria
agentProlog/can remain interactive while one or more operations are active.Non-goals
References
docs/async-runtime.mddocs/authority-runtime.mdState audit after merged PR #55: the bounded Future runtime is useful and should be retained, but #54's core directionality is not yet satisfied.
rlm_completion_async/*, provider/chain async facades, and the publicrlmasync facade currently submit synchronous public predicates to the worker pool (async -> sync). The intended invariant is the reverse: canonical async/task execution with sync as await+cleanup wrappers. This slice will refactor completion and provider/chain first, extend Future metadata/continuations/cancellation propagation, add directionality/no-duplicate regression tests, then update this issue again with the exact remaining tool/MCP/agent/graph/authority work. #54 remains open.Post-merge verification for PR #59 is complete. Merge commit
ded8c2734a0c716c6074457b45fad5f475cd16c9passedmainCI run #509 (31947378064): the full deterministic unit/load/benchmark/conformance/deep-recursion/CLI/persistence gate and the complete REAL OpenRouter core, structured-repair, benchmark, depth 0/1/2 recursion, and CLI smoke gate all succeeded. #54 remains open for the tool/MCP/agent/graph canonical async migrations, authority pending-operation integration, and lateragentProlog/responsiveness work.Async/pending-operation update from PR #62:
The core async direction remains intact: execute ABI -> async Future; sync facade starts the same async operation and awaits it. Human approval uses deferred/manual Futures and does not occupy an
rlm_asyncworker while waiting.This hardening pass also fixed a core Future bug: a terminal Future whose stored result does not unify with a caller's pre-bound expected result now fails deterministically instead of falling back into the await polling loop forever. The focused MCP timeout exposed this because lifecycle connect was incorrectly expecting a wrapper shape; that connect adapter now returns the canonical MCP execute outcome directly.
Current deterministic CI is green across the canonical PlUnit suite, benchmark/conformance, deep recursion, CLI/trace, fresh-process graph resume, artifact handoff, and whitespace.
#54 remains open intentionally. Outstanding work includes:
REAL OpenRouter is currently externally rate-limited with HTTP 429
free-models-per-day-high-balance; do not weaken the live gate to close this umbrella issue.Authority/pending-operation integration from this umbrella is now complete on canonical
mainvia PR #62, squash merge88b64db41a4c474379a1808b95c761ffc78d9fc2.The core authority workflow uses deferred/manual Futures for human latency, canonical execute -> async Future -> sync-await direction, cancellation-linearizable approved execution, bounded terminal pending state, and agent/graph/MCP composition. Exact-head deterministic and complete configured REAL OpenRouter CI passed before merge.
Keeping #54 open intentionally: its remaining acceptance still includes concrete async process/test/network tool support, remaining cross-library equivalence coverage where those tools land, and downstream
agentProlog/responsiveness integration. Those should not be falsely marked complete by the authority merge.Post-merge reconciliation after PR #72: the
Current statetext above is stale where it says#52 remains open. #52 closed on 2026-08-17 via squash merge7b527750a64d5cbd9fff79413a399a8c69e90c75after exact-head deterministic + REAL validation. MCP install/run/configuration now uses first-class config references plus closed host-controlled installer/stdio execution profiles while preserving the canonical execute -> async Future -> sync-await direction.#54 remains intentionally open for its actual unchecked acceptance: process/test/network external-tool async work, approval/pending workflow integration, remaining cross-library sync/async equivalence coverage, and later agentProlog responsiveness. Do not treat #52 as a remaining dependency.