Skip to content

test: load placement admission after CLI execution mocks - #197050

Merged
obviyus merged 1 commit into
mainfrom
fix/cli-session-routing-tests
Nov 11, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/cli-session-routing-tests

Conversation

@obviyus

@obviyus obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: 4 tests in src/auto-reply/reply/agent-runner-execution-cli-sessions.test.ts fail on main (the codex-cli cases, e.g. "passes prepared CLI user turns to the runtime persistence boundary"). Main CI only runs tests affected by each change, so this went red unnoticed and now blocks ci-gate on unrelated PRs (seen on #196480).

User Impact

User impact: none. Test-only; no production change.

Why This Change Was Made

Bisected between 81ab38d (passes) and main (fails): first bad commit b8980ca (#196984). That PR made src/gateway/session-utils-store.ts import embedded-agent-runner/run-entry-runtime.ts. This test statically imports installSessionPlacementAdmissionProvider, whose graph (session-placement-admission → session-utils → session-utils-store → run-entry-runtime) now evaluates before the harness registers its model-selection mock. The CLI runtime selector therefore binds the real isCliProvider, which only recognizes codex-cli when its plugin backend is registered. The turn falls through to the embedded runner, whose mock returns undefined, and the swallowed TypeError: undefined is not an object (evaluating 'result.meta') becomes the generic error reply.

The test now loads installSessionPlacementAdmissionProvider with a dynamic import after setupAgentRunnerExecutionTestState(), the same pattern other suites in src/auto-reply/reply use. #196984's authority checks are untouched.

Evidence

  • Before, on main: 4 failed, 5 passed. After: 9/9.
  • With agent-runner-execution-cli-admission.test.ts: 27/27 on current main (clean env).
  • Broader run: 39 files / 445 tests pass, covering agent-runner-execution*, openclaw-delegate-tool*, gateway-caller-context, runtime-snapshot, zod-schema.agents and system-agent-approval*.
  • Format, test-lines ratchet and check:test-mock-exports pass.

For the #196984 author: the new session-utils-store.ts → run-entry-runtime.ts edge makes any suite that statically imports the session-utils graph before its mocks bind real CLI detection; agent-runner-execution-cli-admission.test.ts does so today but only uses claude-cli. A lazy import of resolveRunEntryCliRuntime in resolveAgentDefaultPermissionLabel would remove that hazard; left as is here.

Since #196984, Gateway session utilities import the run-entry CLI runtime
selector. The suite's static placement-admission import now evaluates that
graph before the shared harness registers its model-selection mock, so the
selector keeps the real isCliProvider and routes codex-cli turns to the
embedded runner. Import placement admission after harness setup.

Co-authored-by: obviyus <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 11, 2026
@obviyus
obviyus merged commit 0b818fd into main Nov 11, 2026
104 checks passed
@obviyus
obviyus deleted the fix/cli-session-routing-tests branch November 11, 2026 05:51
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 12, 2026
…7050)

Since openclaw#196984, Gateway session utilities import the run-entry CLI runtime
selector. The suite's static placement-admission import now evaluates that
graph before the shared harness registers its model-selection mock, so the
selector keeps the real isCliProvider and routes codex-cli turns to the
embedded runner. Import placement admission after harness setup.

Co-authored-by: obviyus <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant