Repository navigation
Support isolated sessions in the AgentsAPI and enable restricted dreaming sessions - #159246
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
e077962 to
a8dd16a
Compare
aacfb23 to
5420831
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 9:23 PM ET / September 27, 2026, 01:23 UTC (Revision 6). ClawSweeper reviewWhat this changesThe branch lets the Agents API run fresh restricted sessions for Memory Core dream narratives and other isolated completions, then collect final text and delete known temporary sessions. Merge readiness✅ Ready for maintainer review Current main lacks this capability. The branch has convincing native behavior proof and no remaining actionable code finding. A repository maintain-role contributor recorded acceptance of the documented service-helper and lost-response limits. Priority: P2 Review scores
Verification
How this fits togetherMemory Core and other isolated-completion callers send a prompt through the selected agent harness. The Agents API harness creates a native session and returns text to the caller, which may publish a diary entry or title. flowchart LR
A[Dreaming or isolated caller] --> B[Selected agent harness]
B --> C[Agents API restricted session]
C --> D[Native result and usage]
D --> E[Final text selection]
E --> F[Diary or caller result]
C --> G[Session cleanup]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +245, Docs +39. Total +284 across 15 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Ship the capability with its documented restricted-mode semantics, while preserving a separate literal zero-tool guarantee for runtimes that can enforce it. Do we have a high-confidence way to reproduce the issue? Not applicable to this new harness capability. The contributor supplied real native runs of the affected dreaming and title flows; the lost-response case was not forced. Is this the best way to solve the issue? Yes. The branch uses the existing harness contract and official SDK, with a precise restricted-mode promise and cleanup for sessions whose IDs are known. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f8a3418494f0. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Live behavior proofTested commit: Native Linux/arm64 Docker, ordinary Slack ingress, real Agents API requests, and the existing managed Memory Core dreaming job. No mocks, fakes, special test mode, or synthetic completion results. The observer only read native sessions and events through the official SDK. Observed on 2026-09-26, 16:53 to 16:55 PDT:
Redacted Gateway log excerpts, with session identifiers and workspace paths replaced: Actual native answer excerpts also found verbatim in the diary:
Scope limits: the normal deep sweep ranked three candidates and promoted none; durable promotion and live cancellation/disposal are not proven. The separate memory-save setup/export flow still has restriction-admission and artifact-path failures. Empty supplied tools do not establish absence of API built-in helpers; that known API limitation remains documented. This proof clears the earlier incomplete-retest evidence gap, not the separate authority/deadline findings. |
5420831 to
25937c6
Compare
|
The completed live retest is now attached in the proof comment, including redacted API cleanup logs and the actual generated diary excerpts. Both light and REM completed, reached idle, were deleted, and published their native final answers. The PR body records the tested commit and the later formatting-only head separately. The intended product behavior is default restricted Agents API sessions, with no executor, supplied functions, web search, vaults, or subagents. The request explicitly accepts the API's possible built-in helpers, requires documenting that API limitation, and rejects adding an opt-in setting or disabling dreaming for it. Output rejection is not claimed to prevent a helper's earlier effects or establish literal zero-tool isolation. Please assess this backend against that accepted, documented limitation rather than changing the requested product behavior. The caller-authority issue is valid. A proposed fix separates caller-aware request admission from response/cleanup authority, retaining the new session ID when cancellation follows dispatch. The deadline timers overlap rather than providing two consecutive full budgets; reusing the original deadline removes the creation timer's small later start. Explicit unsupported sampling limits can be rejected before creation; the dreaming caller supplies neither token nor temperature limits. These logic changes await the requester's required approval and will be isolated in a separate commit quoting the review requests. This response does not claim those findings are resolved. |
Revalidate caller authority at the final creation request boundary while retaining harness authority to receive the new session ID and clean up work admitted before cancellation. Share the original inference timeout with creation, keeping the existing creation cap and bounded cleanup windows. ClawSweeper requested: > Revalidate caller authority at the creation request (P1) > Session creation uses `cleanupClient`, whose final fetch assertion checks only harness lifetime. If the caller aborts or loses authority while guarded fetch prepares the request, the provider request can still be sent with its API key and prompt. Keep cleanup authority for cancellation and deletion, but require the caller-aware assertion and abort at creation's final network effect. > Use one deadline for creation and inference (P2) > The inference timeout starts before creation, but creation gets a separate timeout of up to the full requested duration and ignores the inference signal. A slow creation can therefore outlive Memory Core's 60-second narrative budget before the run and cleanup finish. Use the remaining time from one deadline while preserving a separate bounded cleanup window.
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review The preceding command was superseded when the PR body was updated to link the completed proof. The body and head are now settled at Please review the shared-contract documentation correction. It implements your remaining request without behavior changes or new settings. The accepted native-helper limitation and intentionally deferred sampling controls remain as requested. Fresh ordinary-flow Docker evidence and its explicit cancellation limits are in #159246 (comment). |
|
🦞👀 Re-review progress:
|
|
The requester explicitly approved restricted Agents API sessions as the default and directed that service-owned helpers be documented as an API shortcoming, without an opt-in or disabling the feature. I verified that the authenticated account has repository role The newly raised strict-visible finding is valid from source. A narrow one-call-site patch is prepared to select only |
|
The latest generated review in run 36283223489 proposes creating the restricted session before submitting its prompt. There is relevant real API evidence missing from that review: the earlier native Docker run already attempted creation without initial input and received HTTP 400, This was observed in the Gateway's model-fallback diagnostics on 2026-09-26 at 16:44 PDT, during the ordinary managed Memory Core light and REM jobs. Narrative generation failed and used its fallback. Supplying the initial input during creation is the correction that enabled the subsequent successful real-flow proof already attached here. The lost-acknowledgment concern is real, but the proposed empty-create-then-input sequence is rejected by the service. The implementation retains a returned session ID across caller cancellation and deletes known, settled work; it cannot guarantee deletion if the service accepts creation but its response never reaches the Gateway. The successful cleanup proof does not claim to cover that case. I have not changed the code to the rejected API sequence or added speculative recovery/retry behavior. The strict-visible finding remains valid and its narrow fix still awaits the requester's required approval for review-driven logic changes. |
ClawSweeper requested: "For strict-visible calls, accept only explicitly final text and allow an empty result." Filter native items to final_answer for existing strict-visible callers before reading the result. Preserve ordinary completion and dreaming text selection. Review: #159246 (comment)
ClawSweeper identified: "If the creation POST is accepted but its acknowledgment is lost, sessionId stays undefined and finally cannot delete the prompt-bearing session." Document the remaining cleanup limit and the observed API requirement to send initial input during conversation-only session creation. No runtime change.
Strict-visible fix and real title-flow proofThe approved fix is in f758ee2afe5e61ef75a7e5aa7d8a204a8325a9a2, a separate commit directly quoting ClawSweeper's request. Strict-visible callers now admit only native items marked Tested that exact runtime in a fresh native Linux/arm64 Docker Gateway on 2026-09-26, 18:06 to 18:08 PDT. Current head
The first title request also returned a valid title, but the initial observer found its session too late to capture the final text. The second request used the same ordinary RPC, with an observer that discovered the session from this Gateway's log; it did not alter API traffic or generated results. Limits: no unphased native result was forced, so rejection of that case is established by the source change and independent review, not claimed as live fault reproduction. The fresh Gateway's first memory lookup reported an uninitialized index; the supported indexing command subsequently indexed one file and nine chunks with embeddings and FTS ready. This title test does not replace the previously attached dreaming and deadline-cleanup proof. Post-test runtime observationThe final closeout inspection found that Docker killed the test Gateway at 2026-09-26 18:23 PDT, after the successful 18:06-18:08 live checks and the settled Slack lease release. Docker inspection reported: {"OOMKilled": true, "ExitCode": 137}The last health probe at 18:21 PDT passed. No Gateway restart was attempted, and its state is preserved. The cause of the later memory exhaustion is not established; this proof establishes the completed functional flows, not sustained-runtime stability. The persisted delivery queue was still empty at closeout. |
|
@clawsweeper re-review The approved strict-visible fix is pushed in its own commit, New real title-flow proof shows the ordinary Gateway RPC returned exactly the completed native Please also account for the actual API rejection of empty creation. The suggested create-first/input-later sequence was tried through the real Gateway and returned The requester explicitly accepts restricted sessions as the default with possible service-owned helpers, and rejects an opt-in or disabling the capability. The shared SDK and caller documentation state that limitation. The authenticated author has verified repository role Sampling enforcement remains intentionally deferred for this MVP, as previously directed. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Maintainer decision for this MVP: accept the documented restricted-mode limits. I have explicit authorization from the requesting maintainer to record this decision and proceed toward merge:
Both limits are documented in the current PR. The requesting maintainer has now explicitly authorized recording the second acceptance in addition to the previously approved native-helper behavior. No stronger isolation or cleanup guarantee is claimed, and no SDK/security-owner or organization-admin role is claimed. The authenticated publishing account's verified repository role is Please clear the remaining decision gate if this satisfies your recommended option, Accept documented restricted mode. The head remains |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…ming sessions (openclaw#159246) * fix(agentsapi): enable restricted memory dreaming completions * fix(agentsapi): preserve caller authority and completion deadline Revalidate caller authority at the final creation request boundary while retaining harness authority to receive the new session ID and clean up work admitted before cancellation. Share the original inference timeout with creation, keeping the existing creation cap and bounded cleanup windows. ClawSweeper requested: > Revalidate caller authority at the creation request (P1) > Session creation uses `cleanupClient`, whose final fetch assertion checks only harness lifetime. If the caller aborts or loses authority while guarded fetch prepares the request, the provider request can still be sent with its API key and prompt. Keep cleanup authority for cancellation and deletion, but require the caller-aware assertion and abort at creation's final network effect. > Use one deadline for creation and inference (P2) > The inference timeout starts before creation, but creation gets a separate timeout of up to the full requested duration and ignores the inference signal. A slow creation can therefore outlive Memory Core's 60-second narrative budget before the run and cleanup finish. Use the remaining time from one deadline while preserving a separate bounded cleanup window. * docs(agentsapi): clarify the restricted completion boundary ClawSweeper: "Update the shared contract and caller guidance before merge." Document the accepted service-owned helper exception at the shared harness and caller contracts. Preserve runtime behavior and add no settings. * fix(agentsapi): honor strict-visible isolated output ClawSweeper requested: "For strict-visible calls, accept only explicitly final text and allow an empty result." Filter native items to final_answer for existing strict-visible callers before reading the result. Preserve ordinary completion and dreaming text selection. Review: openclaw#159246 (comment) * docs(agentsapi): describe lost creation response cleanup limit ClawSweeper identified: "If the creation POST is accepted but its acknowledgment is lost, sessionId stays undefined and finally cannot delete the prompt-bearing session." Document the remaining cleanup limit and the observed API requirement to send initial input during conversation-only session creation. No runtime change. --------- Co-authored-by: Sarah Fortune <[email protected]>
## What Problem This Solves Fixes: isolated and utility completions can require an OpenAI API key even when the selected model is available through the user's ChatGPT sign-in. Related: #168033. ## User Impact User impact: Codex utility completions can use the same subscription route as the model picker. Explicit auth profiles and utility-model overrides remain in force. A missing pinned profile fails instead of using another account. ## Why This Change Was Made The status path used the first logical catalog row. Dispatch used the resolved model's transport. Either row could describe the Platform API, while a separate physical row described the available ChatGPT route. Both paths now pass the catalog's physical routes to the existing auth planner through the same catalog view used by foreground runs. Dispatch reads the published catalog captured at admission. It keeps the existing model transport when no catalog route is available. No new route selector, config field, or stored state is added. The isolated-session contract in #159246 is unchanged; its changes in this file concern the documented isolation boundary, not auth route selection. ## Evidence - On baseline `0a687e8e01d`, both route-order cases fail through `runIsolatedCompletion` with `No route-compatible authentication source is configured for openai.` - With this fix, both orders select the subscription route, display the Codex runtime, and dispatch to the isolated harness with the subscription profile. The harness returns text through the real completion entry point. A missing pinned profile does not dispatch. - The focused completion and plugin-scope suites pass: 56 tests. These include utility-model overrides, CLI profile selection, quota rotation, cancellation, and authority lifetime controls. - The final focused regression in `src/agents/isolated-completion-route.test.ts` passes both route orders. The agent-root TypeScript check and changed-source lint pass. The original route-order regression uses a synthetic catalog and mocked dispatch. The additional adapter-boundary regression below covers native login and inference serialization without contacting ChatGPT. ## Adapter boundary proof The permanent [plugin-owned adapter regression](https://github.com/openclaw/openclaw/blob/408cc759db6741b58063d348a765d0ff1a2c347f/extensions/codex/isolated-completion.adapter.e2e.test.ts) drives the real `runIsolatedCompletion` and auth planner through the existing test-only SDK barrel into the real Codex harness/client and a [stdio JSON-RPC executable](https://github.com/openclaw/openclaw/blob/408cc759db6741b58063d348a765d0ff1a2c347f/test/e2e/qa-lab/runtime/codex-isolated-app-server.fixture.mjs). The [core-only test fixture](https://github.com/openclaw/openclaw/blob/408cc759db6741b58063d348a765d0ff1a2c347f/src/agents/isolated-completion.adapter.test-support.ts) keeps bundled plugin implementation files out of core TypeScript graphs. - **Allowed:** ChatGPT route is second behind Platform. The scoped synthetic account reaches `account/login/start` exactly once, then `turn/start`; completion returns `Completed as synthetic-allowed-account`. [Redacted transcript](https://gist.github.com/obviyus/ba2dd960adfd458f96736bf39d459f12#file-allowed-json). - **Nearest forbidden:** a stored OAuth account explicitly pinned against config declaring that profile API-key-only is rejected by real eligibility policy; **zero RPC messages**. [Transcript](https://gist.github.com/obviyus/ba2dd960adfd458f96736bf39d459f12#file-forbidden-json). - **Revoked:** remove the allowed profile and revoke caller authority while the real model-materialization await is held; release it and observe rejection before any RPC, including login/inference. [Transcript](https://gist.github.com/obviyus/ba2dd960adfd458f96736bf39d459f12#file-revoked-json). All three moved cases pass (23.8 s test time; 78.8 s including cold transformation). Core-agent and extension-test TypeScript checks and targeted lint pass. `check-changed` passes extension/core-import and SDK boundary checks, then stops only at the known UI E2E root budget (722/720). Merged current `origin/main`, including its managed-cleanup lint fix. Synthetic principals and isolated state only; no live ChatGPT request, real credentials, user Gateway, or default login. Admission/catalog inputs and the deferred model resolver are fixture-controlled; auth planning, profile scoping, native serialization, process transport, and result handling are real. No production execution changes. No overlap with Pash/Sarah changes. Merge danger: two-way door. Reverting the patch fully restores the old behavior; it writes no state. The blast radius is auth planning for harness-owned isolated completions and their runtime labels when a model has multiple physical catalog routes. Co-authored-by: Ayaan Zaidi <[email protected]>
…law#168552) ## What Problem This Solves Fixes: isolated and utility completions can require an OpenAI API key even when the selected model is available through the user's ChatGPT sign-in. Related: openclaw#168033. ## User Impact User impact: Codex utility completions can use the same subscription route as the model picker. Explicit auth profiles and utility-model overrides remain in force. A missing pinned profile fails instead of using another account. ## Why This Change Was Made The status path used the first logical catalog row. Dispatch used the resolved model's transport. Either row could describe the Platform API, while a separate physical row described the available ChatGPT route. Both paths now pass the catalog's physical routes to the existing auth planner through the same catalog view used by foreground runs. Dispatch reads the published catalog captured at admission. It keeps the existing model transport when no catalog route is available. No new route selector, config field, or stored state is added. The isolated-session contract in openclaw#159246 is unchanged; its changes in this file concern the documented isolation boundary, not auth route selection. ## Evidence - On baseline `b046f0c6532`, both route-order cases fail through `runIsolatedCompletion` with `No route-compatible authentication source is configured for openai.` - With this fix, both orders select the subscription route, display the Codex runtime, and dispatch to the isolated harness with the subscription profile. The harness returns text through the real completion entry point. A missing pinned profile does not dispatch. - The focused completion and plugin-scope suites pass: 56 tests. These include utility-model overrides, CLI profile selection, quota rotation, cancellation, and authority lifetime controls. - The final focused regression in `src/agents/isolated-completion-route.test.ts` passes both route orders. The agent-root TypeScript check and changed-source lint pass. The original route-order regression uses a synthetic catalog and mocked dispatch. The additional adapter-boundary regression below covers native login and inference serialization without contacting ChatGPT. ## Adapter boundary proof The permanent [plugin-owned adapter regression](https://github.com/openclaw/openclaw/blob/408cc759db6741b58063d348a765d0ff1a2c347f/extensions/codex/isolated-completion.adapter.e2e.test.ts) drives the real `runIsolatedCompletion` and auth planner through the existing test-only SDK barrel into the real Codex harness/client and a [stdio JSON-RPC executable](https://github.com/openclaw/openclaw/blob/408cc759db6741b58063d348a765d0ff1a2c347f/test/e2e/qa-lab/runtime/codex-isolated-app-server.fixture.mjs). The [core-only test fixture](https://github.com/openclaw/openclaw/blob/408cc759db6741b58063d348a765d0ff1a2c347f/src/agents/isolated-completion.adapter.test-support.ts) keeps bundled plugin implementation files out of core TypeScript graphs. - **Allowed:** ChatGPT route is second behind Platform. The scoped synthetic account reaches `account/login/start` exactly once, then `turn/start`; completion returns `Completed as synthetic-allowed-account`. [Redacted transcript](https://gist.github.com/obviyus/ba2dd960adfd458f96736bf39d459f12#file-allowed-json). - **Nearest forbidden:** a stored OAuth account explicitly pinned against config declaring that profile API-key-only is rejected by real eligibility policy; **zero RPC messages**. [Transcript](https://gist.github.com/obviyus/ba2dd960adfd458f96736bf39d459f12#file-forbidden-json). - **Revoked:** remove the allowed profile and revoke caller authority while the real model-materialization await is held; release it and observe rejection before any RPC, including login/inference. [Transcript](https://gist.github.com/obviyus/ba2dd960adfd458f96736bf39d459f12#file-revoked-json). All three moved cases pass (23.8 s test time; 78.8 s including cold transformation). Core-agent and extension-test TypeScript checks and targeted lint pass. `check-changed` passes extension/core-import and SDK boundary checks, then stops only at the known UI E2E root budget (722/720). Merged current `origin/main`, including its managed-cleanup lint fix. Synthetic principals and isolated state only; no live ChatGPT request, real credentials, user Gateway, or default login. Admission/catalog inputs and the deferred model resolver are fixture-controlled; auth planning, profile scoping, native serialization, process transport, and result handling are real. No production execution changes. No overlap with Pash/Sarah changes. Merge danger: two-way door. Reverting the patch fully restores the old behavior; it writes no state. The blast radius is auth planning for harness-owned isolated completions and their runtime labels when a model has multiple physical catalog routes. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #169066 ## What Problem This Solves Fixes slow, misleading **Test connection** results that count model/credential preparation and internal agent-session work as provider latency. ## User Impact Connection checks make a fresh request without creating an agent session. Each credential shows a labeled **Request round-trip**; the ambiguous aggregate header timing is gone. Empty or thinking-only responses fail the format check, timeouts remain timeouts, and provider diagnostics remain useful and secret-redacted. ## Why This Change Was Made The original probe in [40181af](40181af) exercised a real provider request through an embedded agent. [#117494](#117494) added the structured internal session required by that runtime. Connectivity checks can now use the existing isolated-completion owner instead of paying for that agent-session lifecycle. The deliberately isolated, read-only direct-credential generation from [#125816](#125816) stays intact. Every credential still uses raw OpenClaw transport, preserving [#121500](#121500). OAuth refresh remains with its normal persistent owner, including the historical-peer fencing and settlement from [#168957](#168957); no new cooldown/quota writes are introduced. Known configured models no longer trigger unnecessary catalog preparation. Checked Sarah's [#159246](#159246): its Agents API restricted-session contract and runtime defaults are unchanged. No overlap with Pash's changes. ## Evidence - Command/target/resource regressions: **38 passed**. Includes direct and stored credentials, immutable API-key auth state, expired OAuth refreshing once into the real shared store with owner/peer fences and peer settlement, and valid OAuth causing no credential/state write. - Isolated-completion suite: **50 passed**; Gateway probe suite: **13 passed**. - Models view: **38 passed**; i18n verification passed; Models browser E2E: **7 passed**. - Discriminating negative control: removing the output/timeout/diagnostic fixes makes empty and thinking-only responses incorrectly report `ok`, aborted timeout output report `unknown`, and provider-detail assertions fail. - Mock-export gate passes after six justified isolation annotations and removal of six retired baseline entries. ### Paired timing comparison Real Gateway and Control UI button clicks against the same synthetic HTTP provider with a 250 ms response delay. Baseline `cbba7e2e2ef` versus candidate `994f04547a9`; five alternating measured samples per row, excluding one warmup per lane. These are local stub measurements, not live-provider speed claims. | Scenario | Median full probe RPC, before → after | Median displayed credential duration, before → request-only after | | --- | ---: | ---: | | Successful response | 2,103 → 738 ms | 1,532 → 256 ms | | HTTP 401 | 1,073 → 389 ms | 929 → 256 ms | The stub's median HTTP duration was 251–253 ms. Each success made one HTTP request; the old 401 path made two, while the new isolated check made one. Full probe time still includes setup; it is not shown as provider request time. ### Desktop Before — unlabeled aggregate and repeated credential timing:  After — labeled per-credential request timing, no aggregate header duration:  ### Mobile   ### CI context The initial CI run also hit the main-owned `eager-import-closure.test.ts` duplicate-inventory failure. The same three duplicate paths are demonstrated on clean main `44f538c1855d` in [the existing main reproduction](#169511 (comment)), and in [this PR's failing job](https://github.com/openclaw/openclaw/actions/runs/38198084932/job/114645376204). This PR does not modify that test, wrapper inventory, or those source files. Merge danger: two-way door. Reverting restores the old probe path without a schema or configuration migration. Blast radius is model connection diagnostics in the CLI and Control UI; ordinary chat and other runtime adapters are unchanged. Co-authored-by: Ayaan Zaidi <[email protected]>
…#169554) Closes openclaw#169066 ## What Problem This Solves Fixes slow, misleading **Test connection** results that count model/credential preparation and internal agent-session work as provider latency. ## User Impact Connection checks make a fresh request without creating an agent session. Each credential shows a labeled **Request round-trip**; the ambiguous aggregate header timing is gone. Empty or thinking-only responses fail the format check, timeouts remain timeouts, and provider diagnostics remain useful and secret-redacted. ## Why This Change Was Made The original probe in [5083dd5](openclaw@5083dd5) exercised a real provider request through an embedded agent. [openclaw#117494](openclaw#117494) added the structured internal session required by that runtime. Connectivity checks can now use the existing isolated-completion owner instead of paying for that agent-session lifecycle. The deliberately isolated, read-only direct-credential generation from [openclaw#125816](openclaw#125816) stays intact. Every credential still uses raw OpenClaw transport, preserving [openclaw#121500](openclaw#121500). OAuth refresh remains with its normal persistent owner, including the historical-peer fencing and settlement from [openclaw#168957](openclaw#168957); no new cooldown/quota writes are introduced. Known configured models no longer trigger unnecessary catalog preparation. Checked Sarah's [openclaw#159246](openclaw#159246): its Agents API restricted-session contract and runtime defaults are unchanged. No overlap with Pash's changes. ## Evidence - Command/target/resource regressions: **38 passed**. Includes direct and stored credentials, immutable API-key auth state, expired OAuth refreshing once into the real shared store with owner/peer fences and peer settlement, and valid OAuth causing no credential/state write. - Isolated-completion suite: **50 passed**; Gateway probe suite: **13 passed**. - Models view: **38 passed**; i18n verification passed; Models browser E2E: **7 passed**. - Discriminating negative control: removing the output/timeout/diagnostic fixes makes empty and thinking-only responses incorrectly report `ok`, aborted timeout output report `unknown`, and provider-detail assertions fail. - Mock-export gate passes after six justified isolation annotations and removal of six retired baseline entries. ### Paired timing comparison Real Gateway and Control UI button clicks against the same synthetic HTTP provider with a 250 ms response delay. Baseline `b372edb6424` versus candidate `994f04547a9`; five alternating measured samples per row, excluding one warmup per lane. These are local stub measurements, not live-provider speed claims. | Scenario | Median full probe RPC, before → after | Median displayed credential duration, before → request-only after | | --- | ---: | ---: | | Successful response | 2,103 → 738 ms | 1,532 → 256 ms | | HTTP 401 | 1,073 → 389 ms | 929 → 256 ms | The stub's median HTTP duration was 251–253 ms. Each success made one HTTP request; the old 401 path made two, while the new isolated check made one. Full probe time still includes setup; it is not shown as provider request time. ### Desktop Before — unlabeled aggregate and repeated credential timing:  After — labeled per-credential request timing, no aggregate header duration:  ### Mobile   ### CI context The initial CI run also hit the main-owned `eager-import-closure.test.ts` duplicate-inventory failure. The same three duplicate paths are demonstrated on clean main `1abe83478663` in [the existing main reproduction](openclaw#169511 (comment)), and in [this PR's failing job](https://github.com/openclaw/openclaw/actions/runs/38198084932/job/114645376204). This PR does not modify that test, wrapper inventory, or those source files. Merge danger: two-way door. Reverting restores the old probe path without a schema or configuration migration. Blast radius is model connection diagnostics in the CLI and Control UI; ordinary chat and other runtime adapters are unchanged. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Memory Core dreaming falls back to a placeholder diary entry when an agent uses the Agents API harness, because that harness cannot run the background completion that writes the narrative.
User Impact
Agents API users can generate dream diary narratives through their selected backend. Restricted sessions are the default, without an opt-in. The API may retain service-owned helpers; callers requiring literally zero tools must use a runtime that guarantees that boundary.
Why This Change Was Made
Create a fresh native Agents API session with no executor, supplied functions, web search, vaults, or subagents. Submit the initial prompt once, preserve the prepared model and credential, await settlement, collect usage, and delete the temporary session. Reuse existing harness authority, session lifecycle, reasoning selection, result construction, and output validation.
The review follow-up checks caller authority at final request dispatch while preserving the returned session ID for cleanup after cancellation. Creation shares the original inference deadline. Separate documentation-only commits record the accepted helper limitation and lost-creation-response cleanup limit. Strict-visible title/label requests accept only explicitly final native text, allowing an empty result; ordinary dreaming selection is unchanged. Token/temperature enforcement remains intentionally deferred for this MVP.
Evidence
Dreaming and deadline-cleanup proof.
Strict-visible fix and real title-flow proof.
Dreaming and deadline cleanup were tested on
f5783283700c5dccfd0e141b13415ecd5f4ce738. The strict-output fix was tested onf758ee2afe5e61ef75a7e5aa7d8a204a8325a9a2in a fresh native Linux/arm64 Docker Gateway through ordinary Slack and the normalsessions.title.prepareRPC. Current heade06c9cccdfb7f77f615b5447aa6e42d57673a2d8adds documentation only. No mocks, fakes, special test mode, or unit tests.llm-taskreached its requested 120-second deadline, cancelled the native turn, deleted the session, and delivered the timeout to Slack. Native cancellation and deletion were independently observed.final_answeritem. Its root completed, session reached idle, deletion returned HTTP 200, and independent retrieval returned HTTP 404.Limits: manual Gateway
chat.abortreturnedaborted: false, so manual cancellation is not proven. Revocation during transport preparation and creation-acknowledgment loss were not forced live. Conversation-only sessions require input during creation, so a lost creation response can leave an unknown session that OpenClaw cannot delete. The API cannot attest absence of all service-owned helpers. Rejection of unphased strict-visible text is source-reviewed; no such native result was forced live. Durable memory promotion is not proven; the earlier deep sweep ranked candidates but promoted none. A successful cron receipt alone was not counted as narrative proof. No Gateway restart was used for these tests.