Skip to content

[feat] Add a 404 page across oss, ee and mobile - #6360

Merged
mmabrouk merged 2 commits into
release/v0.114.4from
feat/404-page
Aug 31, 2026
Merged

[feat] Add a 404 page across oss, ee and mobile#6360
mmabrouk merged 2 commits into
release/v0.114.4from
feat/404-page

Conversation

@ashrafchowdury

@ashrafchowdury ashrafchowdury commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Context

The app had no 404 page of its own. An unknown URL fell through to Next's stock page, which carries no branding and no way back.

Signed out it was worse. The auth guard in state/url/auth.ts redirects any unmatched path to sign-in, so /typo became /auth?redirectToPath=/typo. The visitor never learned the link was dead. They just got asked to log in.

Changes

NotFoundScreen lives in @agenta/auth-ui, beside AuthShell. It is the other surface a signed-out visitor lands on, and it is built from the same scoped auth.css tokens (the page ground, the yellow keycap, the surface button), so it adds no colour of its own. All three hosts render it from thin route shells: oss, a two-line re-export for ee, and a <Head> wrapper for mobile.

The brand SVGs move into the package as AgentaBrand.tsx. They have to be inline because the mobile app's /m basePath breaks a bare <img src="/assets/...">, and a package ships no assets of its own. That lets mobile/src/components/AgentaLogo.tsx drop its duplicate copy of the path data and re-export the shared one.

Two routing guards learn about /404. Both read Next's matched route, not the parsed URL, because the app's location snapshot only ever holds the literal address.

Before:

const isNotFoundRoute = pathname === "/404"   // pathname is "/typo", never matches

After:

const isNotFoundRoute = Router.pathname === "/404"
  • Layout renders it bare, outside the app shell and outside ProtectedRoute.
  • The signed-out redirect exempts it, so a bad link explains itself instead of bouncing to sign-in.

In Layout the check sits in the component on useRouter, not in layoutRouteFlagsAtom. That atom recomputes only when the URL snapshot changes, and syncAppLocation skips its store.set when the location signature is unchanged. Putting the check there left the flag stuck at true on the hop off a 404 back into the app, which rendered real pages with no sidebar and no ProtectedRoute.

One more detail worth knowing: Next prerenders /404, where asPath is the literal string "/404" rather than the address the visitor asked for. The failed path in the footer therefore renders only after mount, or it hydrates against different text.

Tests

  • types:check and lint pass for @agenta/auth-ui, @agenta/oss, @agenta/ee and @agenta/mobile.
  • Checked on the running ee app at :3001 and on /m at :3000, both light and dark. No hydration warnings in the mobile console.
  • Confirmed the redirect exemption does not leak: from /404, a client-side push to /w while signed out still redirects to /auth.
  • Not covered: the signed-in desktop case (sidebar returns after leaving /404) needs a local backend, which was not running. The fix is reactive by construction but untested against a real session.

Demo

Captures exist from the running ee and mobile apps in both themes. They still need attaching to this PR.

What to QA

  • Visit any bad URL while signed out, for example /nope. You get the 404 page, not the sign-in screen.
  • Visit the same URL signed in. Still the 404 page, full screen, no sidebar.
  • Click "Go back". You return to the previous page and the app shell comes back with its sidebar.
  • Click "Report". It opens Agenta-AI/agenta/issues in the same tab.
  • Check /m/nope on a phone viewport. Same page, and the "404" block fits without a horizontal scrollbar.
  • Switch to dark mode on both. The logo and the "404" are white, not yellow.
  • Regression: sign out and visit a real protected route such as /w. You still get redirected to /auth.
  • Regression: the sign-in page and the sidebar rail still show the yellow leaf in dark mode. Only the 404 page overrides it.

PReview

image

The app had no 404 of its own, so an unknown route fell through to Next's
stock page — and signed out, the auth guard redirected it to sign-in before
anyone saw anything at all.

NotFoundScreen lives in @agenta/auth-ui beside AuthShell: it is the other
surface a signed-out visitor lands on, and it is built from the same scoped
auth.css tokens, so all three hosts render one page from thin route shells.
The brand SVGs move into the package too (inline, because the mobile app's
/m basePath breaks a bare public/ asset path), which lets mobile's AgentaLogo
drop its duplicate copy of the path data.

Two routing guards learn about /404, both keyed off Next's matched route
rather than the parsed URL — the app's location snapshot only ever holds the
literal address, so a bad path like /typo never reads as "/404":

- Layout renders it bare, outside the app shell and ProtectedRoute. The check
  sits in the component on useRouter, not in layoutRouteFlagsAtom: that atom
  recomputes only when the URL snapshot changes, which leaves the flag stale
  on the hop off a 404 back into the app.
- The signed-out redirect in state/url/auth.ts exempts it, so a bad link
  explains itself instead of bouncing to sign-in.
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 29, 2026
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Aug 29, 2026 5:36am

Request Review

@dosubot dosubot Bot added enhancement New feature or request frontend labels Aug 29, 2026
@coderabbitai

coderabbitai Bot commented Aug 29, 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 YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b3299c0c-9342-4b9f-9e71-ad412d301fa7

📥 Commits

Reviewing files that changed from the base of the PR and between a7b6368 and 6871095.

📒 Files selected for processing (6)
  • web/mobile/src/components/AgentaLogo.tsx
  • web/oss/src/components/Layout/Layout.tsx
  • web/oss/src/pages/404.tsx
  • web/oss/src/state/url/auth.ts
  • web/packages/agenta-auth-ui/src/AgentaBrand.tsx
  • web/packages/agenta-auth-ui/src/NotFoundScreen.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • web/oss/src/components/Layout/Layout.tsx
  • web/oss/src/pages/404.tsx
  • web/packages/agenta-auth-ui/src/AgentaBrand.tsx
  • web/packages/agenta-auth-ui/src/NotFoundScreen.tsx
  • web/oss/src/state/url/auth.ts

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


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added a branded, responsive 404 page across web and mobile experiences.
    • Added “Go back” navigation and a link for reporting broken pages.
    • Added reusable Agenta mark and wordmark components with dark-mode support.
  • Bug Fixes

    • 404 pages now render correctly without the application shell or authentication redirect.
    • Improved logo display on mobile routes and ensured consistent branding across platforms.

Walkthrough

The change adds a shared 404 screen and brand components to agenta-auth-ui. OSS route handling now renders 404 pages without authentication or the app shell. EE reuses the OSS page, and mobile adds its own route integration.

Changes

Shared 404 experience

Layer / File(s) Summary
Shared branding and 404 screen
web/packages/agenta-auth-ui/src/AgentaBrand.tsx, web/packages/agenta-auth-ui/src/NotFoundScreen.tsx, web/packages/agenta-auth-ui/src/auth.css, web/packages/agenta-auth-ui/src/index.ts
The package adds reusable brand SVGs, a shared NotFoundScreen, responsive 404 styles, and public exports.
OSS 404 route handling
web/oss/src/state/url/auth.ts, web/oss/src/components/Layout/Layout.tsx, web/oss/src/pages/404.tsx
OSS detects matched /404 routes, permits signed-out rendering, uses the bare layout, and renders the shared screen.
EE and mobile host integration
web/ee/src/pages/404.tsx, web/mobile/src/pages/404.tsx
EE reuses the OSS 404 page. Mobile adds a 404 page that renders the shared screen and handles browser back navigation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🟡 Moderate · up to 68710

The PR adds branded 404 handling across the web and mobile apps, but it is not fully merge-ready while signed-out client-side navigation can still potentially send visitors to sign-in instead of the 404 page, and the new brand colors may bypass the shared theme palette and cause inconsistent styling.

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant NextRouter
  participant AuthState
  participant Layout
  participant NotFoundPage
  participant NotFoundScreen
  Browser->>NextRouter: request invalid route
  NextRouter->>AuthState: expose matched pathname /404
  AuthState->>AuthState: allow signed-out 404 rendering
  NextRouter->>Layout: provide pathname /404
  Layout->>NotFoundPage: render without app shell
  NotFoundPage->>NotFoundScreen: pass failed path and back handler
  NotFoundScreen-->>Browser: render 404 screen
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the main change: adding a 404 page across OSS, EE, and mobile.
Description check ✅ Passed The description directly explains the branded 404 page, routing changes, affected hosts, testing, and QA scope.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/404-page

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.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: cfeda633-06ca-4ba9-a417-1cda37ae21a8

📥 Commits

Reviewing files that changed from the base of the PR and between 4b474bf and a7b6368.

📒 Files selected for processing (10)
  • web/ee/src/pages/404.tsx
  • web/mobile/src/components/AgentaLogo.tsx
  • web/mobile/src/pages/404.tsx
  • web/oss/src/components/Layout/Layout.tsx
  • web/oss/src/pages/404.tsx
  • web/oss/src/state/url/auth.ts
  • web/packages/agenta-auth-ui/src/AgentaBrand.tsx
  • web/packages/agenta-auth-ui/src/NotFoundScreen.tsx
  • web/packages/agenta-auth-ui/src/auth.css
  • web/packages/agenta-auth-ui/src/index.ts

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

Comment thread web/oss/src/state/url/auth.ts
Comment thread web/packages/agenta-auth-ui/src/AgentaBrand.tsx Outdated
Comment thread web/packages/agenta-auth-ui/src/AgentaBrand.tsx
Review pass: the repo caps in-code comments at one short line. The
multi-line inline comments and the longer file docblocks added with the
404 page are cut back to the point each one was making.
@mmabrouk

Copy link
Copy Markdown
Member

hhh love the design

@mmabrouk
mmabrouk changed the base branch from main to release/v0.114.4 August 31, 2026 16:58
@mmabrouk
mmabrouk merged commit 241bff3 into release/v0.114.4 Aug 31, 2026
57 of 58 checks passed
@mmabrouk mmabrouk mentioned this pull request Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants