Skip to content

fix(console): follow-up for #13108 docs/en routing and locale cookie sync#13608

Merged
adamdotdevin merged 4 commits intoanomalyco:devfrom
Seungjun0906:fix-console-docs-en-locale
Mar 5, 2026
Merged

fix(console): follow-up for #13108 docs/en routing and locale cookie sync#13608
adamdotdevin merged 4 commits intoanomalyco:devfrom
Seungjun0906:fix-console-docs-en-locale

Conversation

@Seungjun0906
Copy link
Contributor

Closes #13606
Refs #13108

What does this PR do?
This is a follow-up to #13108.

In production, two issues were still reproducible:

  • /docs/en could return 404
  • English selection could be overridden by an existing non-English oc_locale

This PR fixes the remaining console-side docs routing/cookie sync gap by:

  • handling /docs/<locale> as explicit locale input during request locale resolution
  • canonicalizing /docs/en, /docs/en/, and /docs/en/* to English root docs paths
  • appending Set-Cookie: oc_locale=<resolved-locale> on docs proxy responses

Changed files:

  • packages/console/app/src/lib/language.ts
  • packages/console/app/src/routes/docs/index.ts
  • packages/console/app/src/routes/docs/[...path].ts
  • packages/console/app/src/routes/s/[id].ts

Why this works:

  • docs-path locale is now resolved before cookie/Accept-Language fallback
  • English docs path is normalized to canonical root docs path
  • locale cookie is synchronized on docs proxy responses, so English remains sticky

How did you verify your code works?

  • Ran typecheck:
    • bun run typecheck (in packages/console/app)
  • Ran targeted routing smoke checks:
    • docs("en", "/docs/en") -> /docs
    • docs("en", "/docs/en/") -> /docs/
    • docs("en", "/docs/en/agents") -> /docs/agents
  • Ran locale-resolution precedence checks:
    • request to /docs/en with Cookie: oc_locale=ko resolves locale as en
    • request to /docs/en/agents with Accept-Language: ko resolves locale as en

Copy link

@trueberryless trueberryless left a comment

Choose a reason for hiding this comment

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

Looks good to me 🥳

Thanks for the fix!

@Seungjun0906
Copy link
Contributor Author

Looks good to me 🥳

Thanks for the fix!

Thanks!

@Seungjun0906
Copy link
Contributor Author

@thdxr

Hi there, could you please review this PR?
It looks like others are experiencing the same issue with the documentation. (#14409)

@akronb
Copy link
Contributor

akronb commented Mar 5, 2026

@Seungjun0906 there are a lot of issues connected to that PR: Closes #15984, #15194, #15904, #14997, #14409

@adamdotdevin could you take a look at this?

@adamdotdevin adamdotdevin merged commit 76cdc66 into anomalyco:dev Mar 5, 2026
9 checks passed
jerome-benoit pushed a commit to jerome-benoit/opencode that referenced this pull request Mar 6, 2026
@dfk1352
Copy link

dfk1352 commented Mar 6, 2026

Problem persists. Sadly.

@Seungjun0906
Copy link
Contributor Author

Problem persists. Sadly.

at least docs/en does work now...
not language selector does not..

but i made another pr...

qdddddd pushed a commit to qdddddd/opencode that referenced this pull request Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(console): follow-up to #13108 — /docs/en still 404 and English locale does not persist

5 participants