Skip to content

fix(test): unbreak main — admit the adoption-replay create fixture through the structured-chat gate - #19246

Merged
nwparker merged 1 commit into
mainfrom
nwparker/fix-structured-adoption-replay-settings-gate
Sep 7, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/fix-structured-adoption-replay-settings-gate

Conversation

@nwparker

@nwparker nwparker commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5
Prod 0 0 0 0

What broke

src/main/runtime/rpc/methods/structured-agent-session-adoption-replay.test.ts fails on origin/main:

AssertionError: expected { id: 'request-1', ok: false, …(2) } to match object { ok: true, …(1) }
  committed adopting create RPC replay > republishes from durable identity after the source
  disappears and account selection drifts

The agentSession.create call is refused at the RPC envelope level (ok: false,
structured_agent_session_unsupported) instead of succeeding at the envelope level and
refusing at the result level with agent_session_operation_unknown.

Semantic conflict, not a bad PR

Both sides were green on their own branches; the failure only exists after both landed.

Neither branch could see the other, and main runs no typecheck/test gate after merge, so it
landed silently red.

Root cause

Before #18700, supportsStructuredAgentSessions only consulted
experimentalStructuredNativeChat when clientKind === 'mobile'. A runtime client was
admitted on its negotiated agent-session.structured.v1 capability alone. #18700 made the host
setting one rule for every caller.

The adoption-replay fixture builds a real OrcaRuntimeService from a settings-service stub
that only supplies agentDefaultEnv, so getClientSettings() never reports the setting on.
Under the new rule the gate refuses before the create handler runs, and the whole
durable-identity replay body — the thing this test exists to cover — never executes.

Which side I fixed, and why

The test. #18700's rule is the intended product behaviour, and it is documented in the gate
itself: methods that start, extend, retain or read work go behind requireStructuredHost;
only stop/retire methods (close, cancel, unsubscribe, release) use the cleanup gate.
agentSession.create starts work, so it belongs behind the gate — loosening it would undo the
one-rule-for-every-caller fix and re-open the desktop/mobile asymmetry #18700 removed.

Nothing in #19176's test is about admission; it is about republishing from durable identity
after the transcript disappears and account selection drifts. It just needs an admitted caller.

This is also exactly what #18700 already did for the sibling fixture in the same directory —
structured-agent-session-precommit-refusal.test.ts got
getClientSettings: () => ({ experimentalStructuredNativeChat: true }) with the same rationale.
This test was simply not in that branch's tree to be updated.

The fix is five lines and touches no production code. Every replay assertion (acquire called
once, publishStructuredAgentSessionTab called twice, selectAccountHome called once, the two
agent_session_identity_required refusals) is unchanged and now genuinely runs — the test was
previously exiting at its first expect.

Verification

  • pnpm tc — exit 0
  • npx vitest run --config config/vitest.config.ts src/main/runtime/rpc/methods/structured-agent-session-adoption-replay.test.ts — 1 passed
  • npx vitest run --config config/vitest.config.ts src/main/runtime/rpc/methods/ src/main/native-chat/agent-session-wire/ --exclude "**/*.electron.test.ts" — 2021/2022 passed. The one failure, structured-agent-session-handoff-options.test.ts > keeps a picked model through a native to TUI to native round trip, is an unrelated vi.waitFor timeout under 233-file parallel load; it passes in isolation and touches none of this code.
  • pnpm run check:code-quality:changed — 0 new findings

…tured gate

Semantic conflict between two green PRs. #19176 added this replay test while
`agentSession.*` still admitted a `runtime` client on its negotiated capability
alone; #18700 then made `experimentalStructuredNativeChat` one rule for every
caller. Neither branch saw the other, and main runs no post-merge test gate, so
`agentSession.create` started refusing at the envelope level and the test's
`ok: true` expectation broke.

#18700's rule is the intended behaviour and `create` starts work, so it belongs
behind the gate. The fixture is what is stale: it builds a real
`OrcaRuntimeService` whose client settings are unset. Enable the setting the way
#18700 already did for the sibling pre-commit fixture. The assertions about
durable-identity replay are untouched and now actually run.
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 64cb2de3-8cbd-4964-b7a4-d246ed8b5c54

📥 Commits

Reviewing files that changed from the base of the PR and between 3145060 and 4254a52.

📒 Files selected for processing (1)
  • src/main/runtime/rpc/methods/structured-agent-session-adoption-replay.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The replay test now mocks runtime.getClientSettings to enable experimentalStructuredNativeChat. The test can therefore pass the structured-agent-session settings gate and exercise the durable-identity replay path.

Merge Risk: ⚪ Minimal · up to 4254a

The replay test now enables the required structured-chat setting so it exercises durable-identity replay rather than being rejected at the RPC gate. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the failure, root cause, rationale, scope, and verification. However, it omits several template sections, including the required Linked Issue, ELI5, Visual Proof with … Add the missing template sections. Include a linked issue after “Fixes #”, state “N/A” with a reason under Visual Proof because this is not a UI change, complete or explicitly mark AI Disclosure, Review, Agent skill upstream boundary, Notes…
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the test fix and the structured-chat gate involved. It is specific, concise, and related to the main change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the failure, root cause, rationale, scope, and verification. However, it omits several template sections, including the required Linked Issue, ELI5, Visual Proof with an N/A explanation, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist.

Resolution

Add the missing template sections. Include a linked issue after “Fixes #”, state “N/A” with a reason under Visual Proof because this is not a UI change, complete or explicitly mark AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist, and preserve the existing failure analysis and verification details.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

The PR is a five-line, test-only fix that admits the adoption-replay agentSession.create fixture through the settings gate so the durable-identity replay body it exists to cover actually runs.

  • getClientSettings admission spy — structured-agent-session-adoption-replay.test.ts now stubs getClientSettings to report experimentalStructuredNativeChat: true, matching the sibling structured-agent-session-precommit-refusal.test.ts fixture that #18700 already updated. The gate (supportsStructuredAgentSessions → isStructuredNativeChatEnabled) now admits the call, and the previously-unreached replay assertions (acquire once, publishStructuredAgentSessionTab twice, selectAccountHome once, two agent_session_identity_required refusals) genuinely execute. vi.restoreAllMocks() in afterEach covers the spy.

I confirmed the root cause against the gate in structured-agent-session-policy.ts and ran the test file in isolation (1 passed). The change is minimal, consistent with the documented one-rule-for-every-caller behavior, and touches no production code.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit ffff6ea into main Sep 7, 2026
29 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 7, 2026
…tured gate (stablyai#19246)

Semantic conflict between two green PRs. stablyai#19176 added this replay test while
`agentSession.*` still admitted a `runtime` client on its negotiated capability
alone; stablyai#18700 then made `experimentalStructuredNativeChat` one rule for every
caller. Neither branch saw the other, and main runs no post-merge test gate, so
`agentSession.create` started refusing at the envelope level and the test's
`ok: true` expectation broke.

stablyai#18700's rule is the intended behaviour and `create` starts work, so it belongs
behind the gate. The fixture is what is stale: it builds a real
`OrcaRuntimeService` whose client settings are unset. Enable the setting the way
stablyai#18700 already did for the sibling pre-commit fixture. The assertions about
durable-identity replay are untouched and now actually run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant