Skip to content

Fix agent opening on profile - #1218

Merged
vibegui merged 2 commits into
mainfrom
gui/fix-mobile-agent-chat
Sep 11, 2025
Merged

vibegui merged 2 commits into
mainfrom
gui/fix-mobile-agent-chat

Conversation

@vibegui

@vibegui vibegui commented Sep 11, 2025 •

Copy link
Copy Markdown
Contributor

before

CleanShot 2025-09-11 at 15 07 32

after

CleanShot 2025-09-11 at 15 22 45

Summary by CodeRabbit

  • New Features

    • On mobile, the chat panel now opens automatically when no other tab is active.
  • Bug Fixes

    • Enabled horizontal scrolling in tab containers to prevent content clipping.
  • Chores

    • Ignored the .specstory directory in version control and indexing.
    • Dev server now binds to 0.0.0.0 for easier access from other devices.

@coderabbitai

coderabbitai Bot commented Sep 11, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds ignore rules for .specstory, enables horizontal scrolling for a tabs container, changes Docked.handleReady to prefer activating chat on mobile when no active tabs, and sets the Vite dev server host to 0.0.0.0.

Changes

Cohort / File(s) Summary of changes
Repo ignore configs
\.cursorindexingignore, \.gitignore
Add .specstory/** to indexing and Git ignore; .cursorindexingignore includes a comment noting explicit @ references still work.
Web styling
apps/web/index.css
Add .dv-tabs-container .dv-scrollable { overflow-x: auto; } under @layer base to enable horizontal scrolling for the tabs container.
Dock behavior (mobile)
apps/web/src/components/dock/index.tsx
In Docked.handleReady, on mobile reorder/activate panels so non-chat tabs are prioritized, and if no active tabs exist, explicitly activate the chat panel using optional chaining before setOpenPanels.
Dev server config
apps/web/vite.config.ts
Add host: "0.0.0.0" to the Vite server config; keep port and allowedHosts unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User as Mobile User
  participant App as Web App
  participant Dock as Docked.handleReady
  participant Panels as Panels Manager
  participant Chat as Chat Panel

  User->>App: open app
  App->>Dock: handleReady()
  Note over Dock: Mobile-specific ordering & activation
  Dock->>Panels: compute orderedTabs (non-chat first)
  Dock->>Panels: for each tab -> setActive(id)?
  alt no active tabs
    Dock->>Panels: get("chat")?
    Panels-->>Chat: activate (optional)
  end
  Dock->>Panels: setOpenPanels(initialPanels)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks (1 passed, 2 warnings)

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The current PR description contains only before/after screenshots and does not follow the repository template: it omits the required "What is this contribution about?" narrative explaining the changes and rationale and also lacks the "Review Checklist" section, so reviewers lack essential context about scope, files changed, and verification steps. Screenshots are helpful but insufficient on their own, therefore the description is largely incomplete. Please update the PR to match the repository template: add a concise "What is this contribution about?" that summarizes the change and why (mention the mobile dock/tab activation fix and any related CSS, gitignore, and vite config edits), keep the before/after images under "Screenshots/Demonstration", and complete the "Review Checklist" with testing, documentation, breaking-change status, and suggested verification steps or commands.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Fix agent opening on profile" is concise and directly reflects the primary user-facing change in this PR (fixing which agent/chat panel opens on profile), it aligns with the Dock component mobile tab-activation adjustments and the provided before/after screenshots, and it is clear and specific enough for teammates scanning the history.

Poem

I nudge the tabs to gently glide,
A chat pops first on mobile side.
The server listens, open door—
Host bound wide, so devs explore.
SpecStory sleeps outside my trail—hop on, all clean and hale! 🐇✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8dd2f14 and 4adfc73.

📒 Files selected for processing (1)
  • apps/web/src/components/dock/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/components/dock/index.tsx
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gui/fix-mobile-agent-chat

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 11, 2025 •

Copy link
Copy Markdown

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/src/components/dock/index.tsx (1)

168-175: Bug: Set.prototype.isSubsetOf doesn’t exist; equality always throws

This breaks panel tracking on layout changes.

-const equals = (a: Set<string>, b: Set<string>) => {
-  if (a.size !== b.size) {
-    return false;
-  }
-
-  return a.isSubsetOf(b) && b.isSubsetOf(a);
-};
+const equals = (a: Set<string>, b: Set<string>) => {
+  if (a.size !== b.size) return false;
+  for (const v of a) {
+    if (!b.has(v)) return false;
+  }
+  return true;
+};
🧹 Nitpick comments (6)
.cursorindexingignore (1)

2-3: Scope the ignore pattern to repo root for precision

Anchoring avoids accidentally ignoring nested .specstory folders outside the root.

- .specstory/**
+ /.specstory/**
apps/web/index.css (2)

201-205: Add momentum scrolling on iOS Safari

Smoother horizontal scroll on mobile.

 .dv-tabs-container .dv-scrollable {
   overflow-x: auto;
+  -webkit-overflow-scrolling: touch;
 }

107-110: Duplicate rule for .one-tab .dv-scrollable

Same rule appears twice; keep one.

-    .one-tab .dv-scrollable {
-      @apply grow-0!;
-    }

Also applies to: 198-200

apps/web/src/components/dock/index.tsx (2)

150-159: Avoid Array.prototype.findLast for wider browser support

Dockview runs in browsers where findLast may be missing.

-  const targetGroup = api.groups.findLast((group) => !group.locked);
+  const targetGroup =
+    // Safari ≤16 fallback: prefer last unlocked group
+    (api.groups as any)?.findLast?.((g: any) => !g.locked) ??
+    [...(api.groups as any[])].reverse().find((g: any) => !g.locked);

If you target only modern browsers, feel free to skip. Otherwise, confirm your minimum browser matrix.


262-284: Remove ts-expect-error by typing the event listener correctly

Keeps strictness without suppressions.

-    const handleMessage = (event: CustomEvent<Message>) => {
-      const { type, payload } = event.detail;
+    const handleMessage = (evt: Event) => {
+      const { type, payload } = (evt as CustomEvent<Message>).detail;
       const panel = api.getPanel(payload.id);
       if (panel) {
         if (type === "toggle") {
           panel.api.close();
         } else if (type === "open") {
           panel.api.updateParameters(payload.params || {});
           panel.api.setActive();
         }
       } else {
         addPanel(payload, api, isMobile);
       }
     };
-
-    // @ts-expect-error - I don't really know how to properly type this
-    channel.addEventListener("message", handleMessage);
+    channel.addEventListener("message", handleMessage);
 
     return () => {
-      // @ts-expect-error - I don't really know how to properly type this
-      channel.removeEventListener("message", handleMessage);
+      channel.removeEventListener("message", handleMessage);
     };
apps/web/vite.config.ts (1)

27-27: Gate 0.0.0.0 binding via env to reduce accidental exposure

Keeps convenience while avoiding unintended LAN exposure.

-  server: { host: "0.0.0.0", port: 3000, allowedHosts: [".deco.host"] },
+  server: {
+    host: process.env.VITE_DEV_HOST ?? "0.0.0.0",
+    port: Number(process.env.VITE_DEV_PORT ?? 3000),
+    allowedHosts: [".deco.host"],
+  },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b72574e and 8dd2f14.

📒 Files selected for processing (5)
  • .cursorindexingignore (1 hunks)
  • .gitignore (1 hunks)
  • apps/web/index.css (1 hunks)
  • apps/web/src/components/dock/index.tsx (1 hunks)
  • apps/web/vite.config.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
apps/web/**

📄 CodeRabbit inference engine (.cursor/rules/structure.mdc)

Place the main application UI (Vite SPA) under /apps/web

Files:

  • apps/web/index.css
  • apps/web/src/components/dock/index.tsx
  • apps/web/vite.config.ts
{apps/web,packages/ui}/**/*.{tsx,jsx,css}

📄 CodeRabbit inference engine (.cursor/rules/structure.mdc)

Use Tailwind CSS v4 for styling

Files:

  • apps/web/index.css
  • apps/web/src/components/dock/index.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/data-flow.mdc)

**/*.{ts,tsx}: MCP tools must use Zod schemas for input and, when applicable, output validation
Register tools with server.registerTool providing description, inputSchema.shape, and optional outputSchema.shape
In every MCP tool handler, perform authorization checks first and then call context.resourceAccess.grant() before business logic
Name tools using the {RESOURCE}_{ACTION} pattern (e.g., AGENTS_CREATE, THREADS_LIST)
Group related tools into typed collections (e.g., GLOBAL_TOOLS, WORKSPACE_TOOLS) and export them as const
Always check workspace/team access before executing operations that touch workspace resources
Return proper authorization errors and handle forbidden operations explicitly

**/*.{ts,tsx}: Use functional and declarative programming patterns; avoid classes
Favor iteration and modularization to adhere to DRY and avoid duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Organize files so each file contains only related content (components, subcomponents, helpers, static content, types)
Favor named exports for functions
Prefer interfaces over types for object shapes
Avoid enums; use maps instead for better type safety and flexibility
Use the function keyword for pure functions to benefit from hoisting and clarity

Files:

  • apps/web/src/components/dock/index.tsx
  • apps/web/vite.config.ts
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/data-flow.mdc)

**/*.tsx: Use the shared KEYS object to construct consistent React Query keys
Use useSuspenseQuery for critical data fetching hooks
Implement optimistic updates for mutations and provide rollback on error via onMutate/onError
After successful mutations, update relevant caches with setQueryData (e.g., entity detail and list keys)
Leverage React Query’s built-in request deduplication instead of manual throttling
Use parallel queries where appropriate to reduce total load time

**/*.tsx: Use functional React components with TypeScript interfaces
Prefer using UI components from @deco/ui (packages/ui) instead of custom duplicates
Memoize expensive computations in components using useMemo
Memoize objects and arrays (e.g., defaultValues) to keep stable references
Use useDeferredValue for search inputs to keep typing responsive
Follow MCP data-access patterns (e.g., useAgents, useIntegrations) with proper loading/error states
Always use design-system form components from @deco/ui when building forms
Prefer react-hook-form with schema validation (e.g., zod) over useState for form state
Avoid prop drilling in forms; share via context/provider pattern
Apply Single Responsibility Principle: split monolithic components into focused subcomponents
Design for composability and reusability of UI components
In hooks’ dependency arrays, ensure stable references; avoid inline object/array/function literals
Memoize options/objects used in dependencies (e.g., via useMemo)
Handle loading, error, and empty states consistently for data-driven views
Extract complex conditional/rendering logic into components instead of IIFEs inside JSX

Files:

  • apps/web/src/components/dock/index.tsx
{apps/web,packages/ui}/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/structure.mdc)

Build UI components with React 19

Files:

  • apps/web/src/components/dock/index.tsx
apps/web/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (apps/web/.cursor/rules/posthog-integration.mdc)

apps/web/**/*.{js,jsx,ts,tsx}: Use each feature flag in as few places as possible; if a flag must appear at multiple callsites, explicitly flag this for careful developer review
Gate any flag-dependent code behind checks that verify the flag’s values are valid and expected
If a custom person or event property is referenced in two or more files or at two or more callsites in the same file, centralize the keys in an enum (TS) or const object (JS)

Files:

  • apps/web/src/components/dock/index.tsx
  • apps/web/vite.config.ts
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/.cursor/rules/posthog-integration.mdc)

In TypeScript, store feature flag names in an enum with members written UPPERCASE_WITH_UNDERSCORE and use a consistent naming convention

Files:

  • apps/web/src/components/dock/index.tsx
  • apps/web/vite.config.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/data-flow.mdc)

Log authorization failures to aid debugging and auditing

Files:

  • apps/web/vite.config.ts
apps/web/vite.config.ts

📄 CodeRabbit inference engine (.cursor/rules/structure.mdc)

Configure and maintain the Vite build setup for the web app in apps/web/vite.config.ts

Files:

  • apps/web/vite.config.ts
🧠 Learnings (1)
📚 Learning: 2025-09-02T13:58:26.946Z
Learnt from: CR
PR: deco-cx/chat#0
File: .cursor/rules/structure.mdc:0-0
Timestamp: 2025-09-02T13:58:26.946Z
Learning: Applies to apps/web/vite.config.ts : Configure and maintain the Vite build setup for the web app in apps/web/vite.config.ts

Applied to files:

  • apps/web/vite.config.ts
🔇 Additional comments (2)
apps/web/index.css (1)

201-205: LGTM: horizontal scrolling enabled for tabs

This should improve mobile tab navigation.

.gitignore (1)

42-43: LGTM: ignore SpecStory artifacts

No runtime impact; helpful to keep the repo clean.

Comment thread apps/web/src/components/dock/index.tsx Resolved
@vibegui

vibegui commented Sep 11, 2025

Copy link
Copy Markdown
Contributor Author
CleanShot 2025-09-11 at 15 30 34

@vibegui
vibegui merged commit 263b5c8 into main Sep 11, 2025
@vibegui
vibegui deleted the gui/fix-mobile-agent-chat branch September 11, 2025 20:27
viktormarinho added a commit that referenced this pull request Aug 3, 2026
Stale editor config from 2024 (last touched in #1218); the paths it excluded
no longer exist in the repo.
viktormarinho added a commit that referenced this pull request Aug 3, 2026
…5579)

* chore: delete the dead auth-config.json tail and the stray EFS RFC

Auth moved to AUTH_* environment variables (auth-env.ts) — core/config.ts even
warns that a config-file 'auth' key is ignored. Nothing reads auth-config.json
anymore, but its tail survived everywhere:

- auth-config.json at the repo root: snuck in via #5575 (a sandbox-daemon PR),
  tracked ever since, read by nothing. Deleted.
- apps/api/auth-config.example.json, tests/resilience/auth-config.test.json:
  referenced by nothing. Deleted.
- .github/workflows/e2e.yml wrote the file before every run — for nothing.
  Step deleted.
- .cursor/worktrees.json copied a file that does not exist. Line deleted.
- apps/api/src/auth/index.ts's header claimed the exact opposite of reality
  ('file-based, not environment variables'). Fixed, with the .gitignore entry,
  the AGENTS.md config line, and config.example.json's pointer.
- deploy/helm/studio/README.md documented a configmap-auth.yaml template that
  does not exist in templates/. Section removed, following ones renumbered.

efs-spec.md (an L2 golden-cache RFC draft) also landed at the root in #5575.
Deleted — it was never referenced by anything in the repo.

Not touched: decostudio-alias/ stays at the root on purpose — it is the
published npm alias (decostudio → decocms) with its own publish workflow, and
it must stay OUT of the workspaces globs so its 'decocms': '*' dependency
resolves against the registry instead of being workspace-linked. spec/001.md's
auth-config mentions are a historical design document and were left alone.

* docs(helm): stop documenting authConfig values the chart renders to nothing

The chart has had no template consuming .Values.configMap.authConfig or
secret.authConfigSecretName since configmap-auth.yaml was deleted (#3048,
env-var auth) — but the README and examples/secrets-example.yaml kept
documenting both, including a second Secret with camelCase keys
(googleClientId, resendApiKey) the server never reads. This is an active
trap: the real prod values in deco-apps-cd carry a full authConfig block
(google, resend, magic-link) that renders to nothing — auth there actually
works because the ExternalSecret feeds AUTH_* keys via envFrom.

README now shows the real mechanism (AUTH_* in meshConfig/Secret, schema in
apps/api/src/auth/auth-env.ts) and the example Secret carries AUTH_* keys.

* chore(api): delete apps/api/spec — a stale v1 design document

001.md described the file-based auth-config.json design that #3048/#5120
replaced with AUTH_* env vars, plus a pre-split architecture; nothing links to
it except its README entry and one step of the add-mcp-tools skill, both
removed (the skill's 'Document in Spec' step told contributors to document new
tools in a file that described a system that no longer exists).
monitoring-share-plugin.md was referenced by nothing at all.

* chore: delete .cursorindexingignore

Stale editor config from 2024 (last touched in #1218); the paths it excluded
no longer exist in the repo.
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.

2 participants