Skip to content

[codex] stabilize openrouter defaults and app identity#197

Merged
anand-testcompare merged 4 commits intomainfrom
fix/public-icon-pack-editing
Mar 6, 2026
Merged

[codex] stabilize openrouter defaults and app identity#197
anand-testcompare merged 4 commits intomainfrom
fix/public-icon-pack-editing

Conversation

@anand-testcompare
Copy link
Collaborator

Summary

This PR temporarily switches Sketchi's default OpenRouter model back to google/gemini-3-flash-preview and improves OpenRouter request identification so activity and provider behavior are easier to trace.

This is a stabilization branch, not the full agent-architecture fix. The longer migration plan for moving the thread flow to Convex agent components is documented locally in .memory/convex-agent-migration-plan.md.

User impact

Users have been seeing inconsistent diagram generation/edit behavior, especially around multi-step structured flows. The immediate effect is that some requests fall into timeout or AI_NoOutputGeneratedError paths without producing a persisted scene.

This temporary change improves the default model path for generation/restructure work and makes OpenRouter traffic clearly attributable to the Sketchi backend in activity logs.

Root cause

There are two separate issues in play:

  1. The current inner structured-output harness is brittle. For intermediate generation/modification, the model is expected to generate JSON, call validation, and then restate the same JSON as the final output. That control flow is fragile and model-sensitive.
  2. OpenRouter request identity was too thin. We were only sending HTTP-Referer plus X-Title: sketchi (env), which makes traffic attribution harder when several apps share an OpenRouter account.

What this PR changes

  • Sets the default OpenRouter model to google/gemini-3-flash-preview
  • Updates backend and e2e env examples to reflect that default
  • Adds explicit OpenRouter app identity metadata:
    • appName
    • appComponent
    • appIdentifier
    • appTitle
    • normalized appUrl
  • Uses X-Title: sketchi/backend (env) instead of the previous ambiguous title
  • Adds test coverage for explicit app identity overrides and URL normalization

Validation

Local checks:

  • bun x ultracite fix
  • bun run check-types
  • bun run build
  • cd packages/backend && bun run test

Focused verification:

  • node .../validate_mermaid_in_md.mjs .memory/convex-agent-migration-plan.md
  • direct OpenRouter probes for plain text / object / tool-loop behavior
  • real intermediate-path probes comparing google/gemini-3.1-flash-lite-preview vs google/gemini-3-flash-preview
  • real thread-level probes using google/gemini-3-flash-preview

Residual risk

This PR does not fix the underlying harness/control-flow issue.

  • Structural generation/restructure behavior is healthier on google/gemini-3-flash-preview
  • Cosmetic tweak behavior is still inconsistent because the tweak/intermediate subflows still have the same brittle state transition problem

The intended follow-up is to replace the current nested flow with Convex agent components using a parent thread agent and child agents as tools, with deterministic terminal transitions for validated intermediate state.

@vercel
Copy link

vercel bot commented Mar 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sketchi-web Ready Ready Preview, Comment Mar 6, 2026 6:49am

Request Review

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

Browserbase Replays

  • Session f8718ad2-f96a-4b78-91da-b5fd343f36d1 (scenario: visual-sanity.ts): replay | debug
  • Session 4385b3d9-98c0-4900-a28b-6e579eaab701 (scenario: auth-gates.ts): replay | debug
  • Session c9da28e8-ac0f-4228-9746-c784ee97f498 (scenario: opencode-web-continuity.ts): replay | debug
  • Session 3f394955-2f71-4b76-9b00-7737582e9d9a (scenario: diagram-studio-happy-path.ts): replay | debug
  • Session da105f26-2ced-4b82-9609-efa2c7a95ec9 (scenario: diagram-studio-occ-conflict.ts): replay | debug

Workflow run: 22752563489

@anand-testcompare anand-testcompare marked this pull request as ready for review March 6, 2026 07:19
@anand-testcompare anand-testcompare merged commit c8f28b8 into main Mar 6, 2026
8 checks passed
@anand-testcompare anand-testcompare deleted the fix/public-icon-pack-editing branch March 6, 2026 09:57
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