Skip to content

test(mock-server): serve an omp native-chat scenario - #14859

Closed
plotarmordev wants to merge 1 commit into
stablyai:mainfrom
plotarmordev:test/mock-server-omp-scenario
Closed

plotarmordev wants to merge 1 commit into
stablyai:mainfrom
plotarmordev:test/mock-server-omp-scenario

Conversation

@plotarmordev

Copy link
Copy Markdown
Contributor

Summary

The mock server's native-chat scenario is hardcoded to claude, so mobile's omp support can only be exercised against a live runtime. MOCK_CHAT_AGENT=omp switches the scenario's agent tab to omp with the two omp-specific shapes that matter:

  • a providerSession without transcriptPath — omp's hook discloses only its session id (extractAgentProviderSession), and mobile gates omp chat on readability, so this is the shape that must be mockable;
  • a four-message decoded transcript (user, assistant with a tool-call block, tool result, assistant) shaped like the runtime's omp decoder output (decodeOmpTranscriptLine), so the phone runs the same render path a live omp pane would.

Default behaviour is unchanged: without the env var the scenario is identical to today's claude one.

Screenshots

No visual change — this populates the existing mock with different data. Verified on the iOS simulator against MOCK_NATIVE_CHAT=1 MOCK_CHAT_AGENT=omp: the omp chat view renders all four messages including the tool-call block.

Testing

  • `pnpm lint` (mobile) — 0 warnings, 0 errors.
  • `pnpm typecheck` (mobile) — clean.
  • Manual: paired the simulator app to the mock with `MOCK_CHAT_AGENT=omp`; the tab presents as OMP with no transcript path and the chat view renders the transcript.

AI Review Report

Risks checked: whether omp needed a transcriptPath to stay realistic; whether the transcript shapes matched the real decoder rather than an invented format; whether default (claude) behaviour could change.

Findings and outcomes:

  • Confirmed omp's hook reports no transcript path — the omp branch of the providerSession mirrors extractAgentProviderSession exactly; adding a path would mock a shape the real runtime never sends.
  • Confirmed each block type against decodeOmpTranscriptLine output for a real session (text/thinking→text, toolCall→tool-call with object input, toolResult→tool with output) — no invented block types.
  • The claude path is bit-identical when the env var is absent (`CHAT_AGENT` defaults to `'claude'` and every branch resolves to the previous values).

Cross-platform: the change is a dev-only Node mock script plus a README line; no app code, no platform-conditional logic.

Security Audit

  • Input handling — reads one env var at module load; no untrusted input.
  • Command execution / path handling — none added.
  • Auth / secrets — none; dev fixture only, never shipped.
  • Dependencies / IPC — none added.

Follow-up: none identified.

MOCK_CHAT_AGENT=omp switches the native-chat mock's agent tab to omp:
a providerSession without transcriptPath (the shape omp's hook reports)
and a decoded transcript shaped like the runtime's omp decoder output,
so mobile's omp readability gate and renderer can be exercised without
a live runtime.
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The native chat mock server now supports Claude and OMP agent selection through MOCK_CHAT_AGENT. OMP mode provides agent-specific metadata, labels, launch settings, and a representative transcript with text and tool blocks. Native chat subscription and session-read responses now return the generated transcript. The mobile README documents the new environment variable and OMP scenario.

Merge Risk: ⚪ Minimal · up to 2fe68

This PR adds an OMP-only mock scenario while preserving the existing default behavior; no actionable merge-blocking risk remains, and the noted typing and comment cleanup can follow up normally.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, rationale, testing, and risks, but omits required sections including Linked Issue, Review, Checklist, and Author. Add the missing required sections, provide a linked issue, use the required Visual Proof wording, and complete the checklist or explain why items do not apply.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the addition of an OMP native-chat scenario to the mock server.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (2)
mobile/scripts/mock-server-native-chat-scenario.ts (2)

113-113: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Type mockTranscript with the native-chat message contract.

Line 113 returns unknown[]. This disables compile-time checks for message fields and block discriminators. Confirm the authoritative native-chat message type and use it as the return type. TypeScript can then detect fixture schema drift before mobile receives the RPC response.


28-30: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reduce each rationale comment to one concise line.

  • mobile/scripts/mock-server-native-chat-scenario.ts#L28-L30: keep only the reason that OMP has no transcript path.
  • mobile/scripts/mock-server-native-chat-scenario.ts#L110-L112: keep only the reason that the fixture mirrors decoded OMP blocks.

As per coding guidelines, “Comments must be concise, non-obvious, and brief—prefer one line.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 92025cf1-68f9-4f3b-96b3-4578baad3f6b

📥 Commits

Reviewing files that changed from the base of the PR and between 6cf6a7f and 2fe6839.

📒 Files selected for processing (2)
  • mobile/README.md
  • mobile/scripts/mock-server-native-chat-scenario.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.

@nwparker

Copy link
Copy Markdown
Contributor

#20655 credited here

@nwparker nwparker closed this Sep 14, 2026
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.

4 participants