Skip to content

Add public auth fallback, health-config page, and sandbox UI pages#22

Open
Huynhthuongg wants to merge 10 commits into
mainfrom
codex/explain-codebase-structure-for-beginners-xev5l0
Open

Add public auth fallback, health-config page, and sandbox UI pages#22
Huynhthuongg wants to merge 10 commits into
mainfrom
codex/explain-codebase-structure-for-beginners-xev5l0

Conversation

@Huynhthuongg

@Huynhthuongg Huynhthuongg commented May 22, 2026

Copy link
Copy Markdown
Member

Motivation

  • Provide a fallback public mode when Clerk is not configured so the app remains usable in dev/test environments.
  • Expose runtime environment and required env var status via a /health-config page to make missing configuration easier to diagnose.
  • Add several lightweight sandbox/demo pages and routes (mobile dashboard, static chat, termux mock, tools hub, and an auth portal) to support developer exploration and previewing UI flows.

Description

  • Introduce runtime auth detection and flags: parse VITE_AUTH_MODE, compute authMode, isClerkConfigured, and isAuthEnabled, and build an envChecklist for display.
  • Add HealthConfigPage which renders envChecklist and basic runtime auth information at /health-config.
  • Implement public-mode app flow with PublicOnlyRouter and PublicAppWithoutAuth, and update App to mount the public app when auth is disabled instead of failing on a missing Clerk key.
  • Add new routes and lightweight page components: auth-portal.tsx, mobile-dashboard.tsx, chat-static.tsx, termux-lab.tsx, and tools-hub.tsx, and add a short self-healing runbook in docs_self_healing_process.md.

Testing

  • Performed an automated build for the sandbox app using pnpm --filter @workspace/sandbox-ai run build, which completed successfully and verifies TypeScript/build checks for the modified package.
  • The build confirmed the new pages compile and route imports resolve without type errors.

Codex Task


Summary by cubic

Adds a public auth fallback when Clerk isn’t configured, a /health-config diagnostics page, and new sandbox pages. Tightens public-mode routing (including /pricing and /chat* redirects), improves the /auth portal, and fixes CI type errors.

  • New Features

    • Runtime auth detection via VITE_AUTH_MODE with fallback to public; exports authMode, isAuthEnabled, envChecklist, and clerkConfig from src/config/auth-mode.ts, plus a short self-healing runbook.
    • Public-only app when auth is disabled: adaptive /auth portal; redirects /sign-in and /sign-up to /auth; guards /chat*; adds /health-config, /mobile-dashboard, /chat-static, /termux-lab, /tools; small banner linking to /health-config.
  • Bug Fixes

    • Fixed public-mode /pricing crash by redirecting to home.
    • Resolved CI type errors by typing onSuccess callback params and removing broken project references in tsconfig.json.

Written for commit 09b90a7. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented May 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
sanbox Ready Ready Preview, Comment May 22, 2026 10:01pm

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 71e6940f-93e4-4cb1-968d-7e30d6570052

📥 Commits

Reviewing files that changed from the base of the PR and between 5d913c4 and 09b90a7.

📒 Files selected for processing (3)
  • artifacts/sandbox-ai/src/App.tsx
  • artifacts/sandbox-ai/src/pages/auth-portal.tsx
  • artifacts/sandbox-ai/src/pages/termux-lab.tsx

📝 Walkthrough

Summary by CodeRabbit

Ghi chú Phát hành

  • New Features

    • Thêm trang Cổng Xác thực cho đăng nhập/đăng ký
    • Thêm Bảng điều khiển di động với menu điều hướng
    • Thêm trang Chat tĩnh để hiển thị giao diện chat mẫu
    • Thêm Termux Lab để mô phỏng terminal AI
    • Thêm Hub Công cụ với danh sách công cụ hỗ trợ
    • Thêm trang Kiểm tra Sức khỏe để chẩn đoán cấu hình
  • Refactor

    • Hỗ trợ chế độ công khai (không cần xác thực) và chế độ Clerk
    • Cập nhật hệ thống định tuyến để linh hoạt hơn

Walkthrough

PR thêm auth-mode (clerk/public) và xuất cấu hình Clerk/env checklist; thêm 6 trang mới (AuthPortal, HealthConfig, MobileDashboard, ChatStatic, TermuxLab, ToolsHub); mở rộng routing/App để hỗ trợ chế độ public; cập nhật vài chú thích kiểu và tsconfig; thêm tài liệu self-healing.

Changes

Auth Mode & New Pages Integration

Layer / File(s) Summary
Auth Mode Configuration Module
artifacts/sandbox-ai/src/config/auth-mode.ts
Tạo module cấu hình xác định auth mode từ VITE_AUTH_MODE, kiểm tra Clerk key, xuất isAuthEnabled, clerkConfigenvChecklist.
New Page Components
artifacts/sandbox-ai/src/pages/auth-portal.tsx, artifacts/sandbox-ai/src/pages/chat-static.tsx, artifacts/sandbox-ai/src/pages/health-config.tsx, artifacts/sandbox-ai/src/pages/mobile-dashboard.tsx, artifacts/sandbox-ai/src/pages/termux-lab.tsx, artifacts/sandbox-ai/src/pages/tools-hub.tsx
Thêm 6 trang: AuthPortal (liên kết sign-in/sign-up hoặc health-config khi public), ChatStaticPage (UI chat tĩnh), HealthConfigPage (hiển thị envChecklist), MobileDashboard (menu mobile + links), TermuxLab (mock terminal + AI assistant), ToolsHub (lưới công cụ).
App.tsx Routing & Auth Mode Handling
artifacts/sandbox-ai/src/App.tsx
Sử dụng clerkConfig/isAuthEnabled, mở rộng Router với /auth, /mobile-dashboard, /chat-static, /termux-lab, /tools, /health-config, thêm PublicOnlyRouter()PublicAppWithoutAuth(); điều phối render theo isAuthEnabled.
Type Annotations in Chat Components
artifacts/sandbox-ai/src/components/chat-area.tsx, artifacts/sandbox-ai/src/components/chat-sidebar.tsx
Thêm annotation any cho tham số conv trong onSuccess và cho tham số c trong filter() để rõ kiểu callback.
TypeScript Configuration & Documentation
artifacts/sandbox-ai/tsconfig.json, docs_self_healing_process.md
Loại bỏ references khỏi tsconfig và đổi format sang nhiều dòng; thêm tài liệu mô tả quy trình self-healing, checklist auto-remediation và runbook.

Sequence Diagram

sequenceDiagram
  participant App as App Component
  participant AuthMode as Auth Mode Config
  participant Router as Main Router
  participant PublicRouter as PublicOnlyRouter
  participant Pages as Pages (Auth/Health/Mobile/Chat/Termux/Tools)

  App->>AuthMode: import isAuthEnabled, clerkConfig
  AuthMode-->>App: provide auth flags & config
  alt isAuthEnabled true
    App->>Router: render full router
    Router->>Pages: mount /auth, /health-config, /mobile-dashboard, /chat-static, /termux-lab, /tools
  else isAuthEnabled false
    App->>PublicRouter: render PublicAppWithoutAuth
    PublicRouter->>PublicRouter: redirect /sign-in,/sign-up,/chat -> / or /auth
    PublicRouter->>Pages: mount public-only routes
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰
Giữa hai chế độ clerk và public tôi nhảy,
Routes mới xếp hàng, health-check ghi đầy,
Termux thì lẻn vào, Chat tĩnh gọi mây,
Dashboard nhỏ rung đuôi đợi mở cửa,
Tôi vẫy tai mừng — đường dẫn giờ sáng nay.

🚥 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 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Tiêu đề rõ ràng và cụ thể mô tả các thay đổi chính: thêm public auth fallback, health-config page và các sandbox UI pages; phù hợp với nội dung thực tế của changeset.
Description check ✅ Passed Mô tả liên quan chặt chẽ đến changeset, nêu rõ động lực, chi tiết kỹ thuật, và kết quả kiểm tra; cung cấp ngữ cảnh đầy đủ cho việc review.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/explain-codebase-structure-for-beginners-xev5l0
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch codex/explain-codebase-structure-for-beginners-xev5l0
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/explain-codebase-structure-for-beginners-xev5l0
  • 🛠️ Aethon

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped Aethon/backend-api.


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 and usage tips.

@kilo-code-bot

kilo-code-bot Bot commented May 22, 2026

Copy link
Copy Markdown

Kilo Code Review could not run — your account is out of credits.

Add credits or switch to a free model to enable reviews on this change.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 412d4ff37d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread artifacts/sandbox-ai/src/App.tsx Outdated

@Huynhthuongg Huynhthuongg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Huynhthuongg @openai-code-agent @anthropic-code-agent

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

5 issues found across 7 files

Confidence score: 2/5

  • There is a concrete regression risk in artifacts/sandbox-ai/src/App.tsx: public /pricing mounts Pricing while Pricing uses useUser(), which can crash for public-mode users without ClerkProvider.
  • artifacts/sandbox-ai/src/pages/auth-portal.tsx currently points users to /sign-in and /sign-up paths that redirect home in public mode, creating a broken authentication flow versus the page guidance.
  • Accessibility issues in artifacts/sandbox-ai/src/pages/mobile-dashboard.tsx (icon-only toggle without accessible name) and artifacts/sandbox-ai/src/pages/termux-lab.tsx (input without label) introduce user-facing WCAG 2.1 AA compliance and usability risk.
  • Pay close attention to artifacts/sandbox-ai/src/App.tsx, artifacts/sandbox-ai/src/pages/auth-portal.tsx, artifacts/sandbox-ai/src/pages/mobile-dashboard.tsx, artifacts/sandbox-ai/src/pages/termux-lab.tsx - prevent public-mode crashes/broken auth navigation and fix missing accessible names before merge.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread artifacts/sandbox-ai/src/App.tsx Outdated
Comment thread artifacts/sandbox-ai/src/pages/auth-portal.tsx Outdated
Comment thread artifacts/sandbox-ai/src/pages/mobile-dashboard.tsx
Comment thread artifacts/sandbox-ai/src/pages/termux-lab.tsx Outdated
Comment thread artifacts/sandbox-ai/src/App.tsx Outdated

@Huynhthuongg Huynhthuongg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@

@Huynhthuongg Huynhthuongg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Huynhthuongg @anthropic-code-agent @openai-code-agent

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 3 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread artifacts/sandbox-ai/src/config/auth-mode.ts
Comment thread artifacts/sandbox-ai/src/config/auth-mode.ts

@Huynhthuongg Huynhthuongg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Huynhthuongg @anthropic-code-agent @openai-code-agent

@Huynhthuongg Huynhthuongg self-assigned this May 22, 2026
@Huynhthuongg Huynhthuongg added this to the Sandbox milestone May 22, 2026
@Huynhthuongg Huynhthuongg moved this from Todo to In Progress in @Huynhthuongg's untitled project May 22, 2026
@Huynhthuongg Huynhthuongg moved this from In Progress to Done in @Huynhthuongg's untitled project May 22, 2026
@Huynhthuongg Huynhthuongg added bug Something isn't working documentation Improvements or additions to documentation labels May 22, 2026
@Huynhthuongg Huynhthuongg added duplicate This issue or pull request already exists enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers invalid This doesn't seem right question Further information is requested dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code labels May 22, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@artifacts/sandbox-ai/src/components/chat-area.tsx`:
- Line 285: The onSuccess callback currently types its parameter as any
(onSuccess: (conv: any) => ...), losing type-safety when accessing fields like
conv.id; change the parameter type to the real payload type OpenaiConversation
(e.g., onSuccess: (conv: OpenaiConversation) => ...) and add the appropriate
import of OpenaiConversation from `@workspace/api-client-react` so the callback
uses the API client's payload type and restores type safety when reading conv.id
and other properties.

In `@artifacts/sandbox-ai/src/components/chat-sidebar.tsx`:
- Line 106: The callback types are being downcast to any; update onSuccess:
(conv: any) to onSuccess: (conv: OpenaiConversation) to match
useCreateOpenaiConversation's return type, and remove unnecessary any in the
filter from useListOpenaiConversations by using filter((c) => ...) so the
resulting array keeps its OpenaiConversation[] type and you can avoid casting
when calling groupConversations; adjust imports/types so OpenaiConversation is
available in chat-sidebar.tsx.

In `@artifacts/sandbox-ai/src/config/auth-mode.ts`:
- Around line 3-9: The isClerkConfigured check currently uses
Boolean(clerkPubKey) which treats all-whitespace strings as configured; update
the logic to normalize and trim the env value before deciding, e.g. compute
configuration presence from clerkPubKey?.trim() (or clerkPubKey &&
clerkPubKey.trim()) so isClerkConfigured becomes false for blank/whitespace keys
and isAuthEnabled (which depends on authMode and isClerkConfigured) only enables
Clerk when a non-empty trimmed key exists.

In `@artifacts/sandbox-ai/src/pages/auth-portal.tsx`:
- Around line 1-14: The AuthPortal currently always renders sign-in/sign-up CTAs
which become dead-ends when auth is disabled; update the AuthPortal component to
check an isAuthEnabled flag and only render the Link buttons to '/sign-in' and
'/sign-up' when isAuthEnabled is true. Locate the AuthPortal function and add a
conditional around the <Link ... '/sign-in'> and <Link ... '/sign-up'> elements
(or return an alternate UI) using the existing isAuthEnabled source (pass it in
as a prop or import/use the app's auth config/hook), ensuring other content
(title/description) remains visible when auth is off.

In `@artifacts/sandbox-ai/src/pages/mobile-dashboard.tsx`:
- Around line 10-12: The icon-only toggle button (the <button> using setOpen and
reading open to render <X> or <Menu>) lacks an accessible name and state; update
that button to provide a descriptive accessible label and expose its expanded
state by setting an aria-label that changes based on open (e.g., "Open menu" vs
"Close menu") and adding aria-expanded={open}; ensure the same fix is applied to
the other similar icon-only button between lines 18–22 so screen readers receive
both a name and the current open/closed state.

In `@docs_self_healing_process.md`:
- Around line 3-27: Add a blank line after each Markdown heading to satisfy
markdownlint MD022; specifically insert an empty line immediately after the
headings "## Goal", "## 1)", "## 2)", "## 3)", "## 4)", and "## 5)" so each
heading is followed by a blank line before the next paragraph or list item (no
code changes required, just adjust the doc content around those headings).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ea851824-6b82-4124-ab97-96626c48ee4e

📥 Commits

Reviewing files that changed from the base of the PR and between 8a58d37 and e2ed909.

📒 Files selected for processing (12)
  • artifacts/sandbox-ai/src/App.tsx
  • artifacts/sandbox-ai/src/components/chat-area.tsx
  • artifacts/sandbox-ai/src/components/chat-sidebar.tsx
  • artifacts/sandbox-ai/src/config/auth-mode.ts
  • artifacts/sandbox-ai/src/pages/auth-portal.tsx
  • artifacts/sandbox-ai/src/pages/chat-static.tsx
  • artifacts/sandbox-ai/src/pages/health-config.tsx
  • artifacts/sandbox-ai/src/pages/mobile-dashboard.tsx
  • artifacts/sandbox-ai/src/pages/termux-lab.tsx
  • artifacts/sandbox-ai/src/pages/tools-hub.tsx
  • artifacts/sandbox-ai/tsconfig.json
  • docs_self_healing_process.md

Comment thread artifacts/sandbox-ai/src/components/chat-area.tsx
Comment thread artifacts/sandbox-ai/src/components/chat-sidebar.tsx
Comment thread artifacts/sandbox-ai/src/config/auth-mode.ts
Comment thread artifacts/sandbox-ai/src/pages/auth-portal.tsx
Comment thread artifacts/sandbox-ai/src/pages/mobile-dashboard.tsx
Comment thread docs_self_healing_process.md

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 3 files (changes from recent commits).

Re-trigger cubic

@Huynhthuongg Huynhthuongg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Huynhthuongg @anthropic-code-agent @openai-code-agent

…in-public-fallback-sfc4f4

Redirect /pricing to home and route sign-in/sign-up to /auth
…in-public-fallback-nv2thz

Make AuthPortal aware of public mode and adjust public routes/redirects
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working codex dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed invalid This doesn't seem right javascript Pull requests that update javascript code question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

**No issues found** across 1 file **Describe the bug** Sữa lỗi Tính năng

1 participant