Skip to content

feat(v2): nav reorg, Your Team page, chat polish (YC sprint, draft) - #251

Closed
samxu01 wants to merge 9 commits into
mainfrom
sam/v2-rebase
Closed

samxu01 wants to merge 9 commits into
mainfrom
sam/v2-rebase

Conversation

@samxu01

@samxu01 samxu01 commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Status: DRAFT — not for merge yet

This branch is the YC sprint working tree. Merge target review is after the application submits (~2026-05-04). Opening as draft now for backup, visibility, and to invite opinions on direction before formal review.

Summary

Reorgs /v2/* toward a "Your Team" hero shot for solo founders running on AI agent employees. Six commits, additive only — v1 routes still resolve, no backend changes, no DB changes.

What lands

  • Nav rail trimmed from 9 items to 4 (Pods, Agents, Apps, Settings). Feed/Activity/Skills/Digest/Analytics routes still resolve, just not surfaced.
  • /v2/agents reframed as "Your Team" — new V2YourTeamPage.tsx renders a roster of agents installed across your projects (37+ live agents on dev cluster). Old AgentsHub catalog moved to /v2/agents/browse and reached via the indigo + Hire an agent CTA.
  • Pod chat polish: Plan/Execute mode collapsed from 50px banner into a compact header pill; + New Pod button restyled to win specificity vs .v2-root reset; avatar fallback to initials on broken iconUrl; Lead pill removed (was just idx === 0, no semantic).
  • Per-pod displayName rendered in chat: messages from Engineer (Nova) no longer render as raw openclaw-nova; new agentDisplayNames Map mirrors backend's buildAgentUsername convention.
  • Inline file pills via [[file:Name.ext|Size]] tokens (was already in V2MessageBubble; this branch adds matching reactions tokens).
  • Inline reactions via [[reactions:👍 3, 💬 2]] tokens, read-only. No write path. Real reactions backend ships post-YC.
  • Copy cleanups of internal jargon: "Backend supports human↔agent..." → "No direct messages yet"; "Local only — not enforced server-side" → "Discuss and plan with your agents"; etc.
  • scripts/seed-yc-demo.js for deterministic demo pod state.

Known issues to fix before merge

  • Unknown username on optimistic-rendered own messages (message.user is undefined for self-sent messages before backend echoes back). ~15 min frontend-only fix.
  • V2Agent TypeScript shape declares agentName but the registry endpoint returns name — compatibility hack in place; type alignment is its own follow-up.

Test plan

  • Build clean
  • Verified live on app-dev.commonly.me/v2 (multiple deploys via kubectl set image)
  • Verify on a fresh local docker stack
  • Type checks pass (TypeScript)
  • Existing v2 unit tests pass

🤖 Generated with Claude Code

samxu01 added a commit that referenced this pull request Apr 30, 2026
Three pre-existing failures from f6b2072 (the v2 shell mount) that
surfaced as soon as PR #251 ran them through GitHub Actions:

- CodeQL high alerts × 2: localDevLoginService logged the dev-login
  password in cleartext on every successful provision. Email-only log
  now; password lives in LOCAL_DEV_LOGIN_PASSWORD env. Keeps the
  observability without surfacing the secret to pod logs or CI logs.

- useV2Embedded threw 'Cannot read properties of undefined (reading
  startsWith)' under jsdom because window.location.pathname is
  partially-stubbed in some test renderers. Optional chain + typeof
  guard returns false cleanly when the path is unavailable, same intent
  as the typeof window === 'undefined' check just above.

- V2Login test mocked axios with only get/post/patch/delete and missed
  defaults + interceptors. The transitive import chain (Register →
  axiosConfig → axios.defaults.baseURL = …) blew up before the test
  body even ran. Mock now covers defaults and both interceptor channels.

Tests still need a wider sweep before this PR is un-drafted, but these
three were the zero-effort wins blocking the rollup.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Spiderpcc and others added 9 commits April 29, 2026 21:32
…d dev account

Two paired changes so teammates can pull, run the docker dev stack, log
in with shared credentials, and see the new v2 UI at /v2.

V2 UI (additive, only renders under /v2/*):
- New frontend/src/v2/ tree: V2App router + V2Layout/V2NavRail/
  V2PodsSidebar/V2PodChat/V2PodInspector/V2MessageBubble/V2Avatar/
  V2Login/V2FeaturePage components, useV2Api/useV2Pods/useV2PodDetail/
  useV2Pinned/useV2Embedded hooks, avatars/grouping utils, v2.css.
- App.tsx mounts <Route path="/v2/*" element={<V2App />} />, wraps the
  tree in an AppErrorBoundary, and adds a NavigationHandler that
  rewrites v1 paths to /v2 when sessionStorage['commonly.v2.active']
  is set so users who opt in stay inside the v2 shell on nav.
- Legacy feature pages reused inside the v2 shell read useV2Embedded()
  to suppress duplicate page titles, swap legacy Tabs for v2 filter
  bars, and keep navigation SPA-routed: Dashboard, PostFeed,
  DailyDigest, ApiDevPage, PodContextDevPage, GlobalIntegrations,
  AgentsHub, ActivityFeedPage, AnalyticsDashboard, AppsMarketplacePage,
  SkillsCatalogPage, UserProfile. v1 paths render the original UI
  unchanged because useV2Embedded returns false outside /v2.
- v2.css design tokens are scoped under .v2-root and
  .v2-feature__legacy so v2 styles cannot bleed into v1 even after
  navigating between the two shells.

Local dev login (so a team can share a single account against the
docker stack without each engineer registering by hand):
- New backend/services/localDevLoginService.ts ensures a configured
  user exists on Mongo connect when LOCAL_DEV_LOGIN_ENABLED=true.
  Wired in backend/server.ts after mongoose.connection.once('open')
  with try/catch so a failure does not block boot.
- New backend/__tests__/unit/services/localDevLoginService.test.js
  covers the disabled / create / idempotent paths.
- docker-compose.dev.yml: pin Mongo to 8.2 with root + app users, init
  script, and a mongosh ping healthcheck; pin Postgres to 17; backend
  depends_on mongo: { condition: service_healthy }; passes
  LOCAL_DEV_LOGIN_* and DOCKER_MONGO_URI / DOCKER_PG_HOST overrides.
- New docker/mongo-init.js provisions the commonly app user/database
  on first container boot.
- .env.example documents the auth'd Mongo URI, the DOCKER_* overrides,
  and the LOCAL_DEV_LOGIN_* knobs (default [email protected] /
  password123).

V1 UI is intentionally untouched: card / landing-page / boot-splash
restyles and unrelated backend tweaks (PG mirror best-effort, IPv6
rate-limit key) are deliberately excluded from this commit.

Made-with: Cursor
YC-demo prep:

- Nav rail trimmed from 9 items to 4 (Pods, Agents, Apps, Settings).
  Feed/Activity/Skills/Digest/Analytics routes still resolve, just not
  surfaced in the rail. Re-add when each surface earns its slot.

- /v2/agents now renders a new V2YourTeamPage — roster of agents
  installed across the user's projects, with runtime badge and last-
  activity dot. Old AgentsHub catalog moved to /v2/agents/browse and
  is reached via the new "+ Hire an agent" CTA.

- Pod inspector + Plan/Execute mode banner copy cleaned of internal
  jargon ("Backend supports human↔agent...", "Local only — not enforced
  server-side") and replaced with user-facing language.

CSS specificity note: v2.css's .v2-root button reset (specificity 0,2,1)
outweighs new BEM classes. New buttons need .v2-root button.your-class
to win on order. Existing v2 buttons share this debt.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Move Plan/Execute mode toggle from banner state-strip into pod chat
  header pill. Reclaims ~50px of vertical space, matches reference
  prototype, and merges live heartbeat status into the goal subtitle.

- Fix .v2-pods__new-btn against the .v2-root global button reset by
  bumping its selector to .v2-root button.v2-pods__new-btn (matches the
  reset's specificity, source-order wins). "+ New Pod" now renders as
  a styled indigo CTA again.

- V2Avatar: trim incoming src, fall back to seeded background + initials
  on <img onError>. Empty/whitespace iconUrl no longer leaves a blank
  rectangle next to the dot.

- Composer footer copy: "Commands and agent targeting are not enabled
  yet" → "Attach files with the paperclip. @-mention an agent to direct
  your message" (action-oriented, accurate to backend behavior).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- V2MessageBubble: parse [[reactions:👍 3, 💬 2]] tokens out of message
  body and render as a rounded-pill row underneath. Read-only fixture
  rendering — no write path. Real reactions backend ships post-YC; this
  unblocks demo-recording polish without 3+ hours of schema/API work.

  File-pill rendering via [[file:Name.ext|Size]] tokens was already in
  place from earlier v2 work; reactions follow the same convention.

- scripts/seed-yc-demo.js: deterministic seed for the YC demo pod.
  Idempotent (reuses existing project by name), creates the project if
  absent, posts a curated 4-message thread with file pills and reaction
  fixtures so the demo recording is reproducible. Driven by env vars
  (COMMONLY_INSTANCE, COMMONLY_TOKEN, optional pod ID / project name).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
"No messages yet — Be the first to start the conversation in this pod."
→ "Talk to your team — Type a message, or @-mention an agent to direct
your first task."

Anchors the empty pod in the YC demo's framing: the room is your team,
agents are addressable, the user starts by directing work.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Inspector and chat both treated whichever agent was first in the array
as "Lead". Order was install order, so commonly-bot — auto-installed by
the pod-creation flow — always wore the Lead label, regardless of what
the pod actually used it for. The data model has no lead concept; the
pill was a frontend heuristic that misled.

Removed from V2PodInspector and V2PodChat. If a real lead concept
returns later it needs to be a field on AgentInstallation, not a
positional guess.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Right rail roster used per-installation displayName ("Engineer (Nova)")
correctly, but message bubbles still rendered the raw User row username
("openclaw-nova"). Looked broken in the demo pod where every agent has
a custom display name.

V2PodChat now builds a Map<rawUsername, displayName> by mirroring the
backend's AgentIdentityService.buildAgentUsername convention
('<agentName>' when instanceId is 'default' or matches the agentName,
else '<agentName>-<instanceId>'). V2MessageBubble takes the map as a
prop and overrides the rendered author when an installed agent's
username matches.

Side-discovered: the registry agents endpoint returns the field as
`name`, not `agentName` as V2Agent's TypeScript shape declares. Map
construction reads both to survive either source until the type is
realigned. Worth a follow-up to fix V2Agent's shape against the wire.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Three pre-existing failures from f6b2072 (the v2 shell mount) that
surfaced as soon as PR #251 ran them through GitHub Actions:

- CodeQL high alerts × 2: localDevLoginService logged the dev-login
  password in cleartext on every successful provision. Email-only log
  now; password lives in LOCAL_DEV_LOGIN_PASSWORD env. Keeps the
  observability without surfacing the secret to pod logs or CI logs.

- useV2Embedded threw 'Cannot read properties of undefined (reading
  startsWith)' under jsdom because window.location.pathname is
  partially-stubbed in some test renderers. Optional chain + typeof
  guard returns false cleanly when the path is unavailable, same intent
  as the typeof window === 'undefined' check just above.

- V2Login test mocked axios with only get/post/patch/delete and missed
  defaults + interceptors. The transitive import chain (Register →
  axiosConfig → axios.defaults.baseURL = …) blew up before the test
  body even ran. Mock now covers defaults and both interceptor channels.

Tests still need a wider sweep before this PR is un-drafted, but these
three were the zero-effort wins blocking the rollup.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The previous CI-fix commit's edit only matched one of the two identical
console.log calls — the indentation differed (4 spaces inside the if-block,
2 spaces in the new-user branch), so replace_all only swept the first.
This drops the password from the new-user branch too, clearing the last
js/clear-text-logging alert.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@samxu01
samxu01 marked this pull request as ready for review April 30, 2026 04:32
samxu01 added a commit that referenced this pull request Apr 30, 2026
…t polish) (#251)

Two paired changes so the /v2 surface comes online behind the existing
mount, plus the sprint reorg work on top:

V2 UI (additive, only renders under /v2/*):
- New frontend/src/v2/ tree: V2App router + V2Layout/V2NavRail/
  V2PodsSidebar/V2PodChat/V2PodInspector/V2MessageBubble/V2Avatar/
  V2Login/V2FeaturePage components, useV2Api/useV2Pods/useV2PodDetail/
  useV2Pinned/useV2Embedded hooks, avatars/grouping utils, v2.css.
- App.tsx mounts <Route path="/v2/*" element={<V2App />} />, wraps the
  tree in an AppErrorBoundary, and adds a NavigationHandler that
  rewrites v1 paths to /v2 when sessionStorage['commonly.v2.active']
  is set so users who opt in stay inside the v2 shell on nav.
- Legacy feature pages reused inside the v2 shell read useV2Embedded()
  to suppress duplicate page titles, swap legacy Tabs for v2 filter
  bars, and keep navigation SPA-routed.

Local dev login (so a team can share a single account against the
docker dev stack):
- backend/services/localDevLoginService.ts auto-provisions a shared
  dev account from LOCAL_DEV_LOGIN_* env vars at boot. Password is
  read from env only; never logged.
- docker-compose.dev.yml + docker/mongo-init.js + .env.example wire
  the credentials through.

Sprint reorg on top:
- Trim v2 nav rail to Pods · Agents · Apps · Settings.
- Reframe Agents page as "Your team" roster with Hire CTA.
- Pod chat polish: Plan/Execute mode pill in header, removed the
  positional "Lead" pill (it was just idx===0 which made
  commonly-bot look like the lead), warmer empty-pod copy,
  per-pod displayName override for agent messages so chat reads
  "Engineer (Nova)" instead of "openclaw-nova".
- Inline file pill rendering + reactions render (fixture-only —
  agents never react and there's no human write path; Potemkin
  pixels for the YC demo recording. Real reactions backend ships
  post-YC).
- YC demo seed script (scripts/seed-yc-demo.js) for deterministic
  demo pod state.
- Bug fixes for green CI: useV2Embedded jsdom guard,
  V2Login.test.tsx axios mock surface, two CodeQL clear-text-logging
  alerts in localDevLoginService.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@samxu01

samxu01 commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

Squash-merged locally as 241099d on main.

@samxu01 samxu01 closed this Apr 30, 2026
@samxu01
samxu01 deleted the sam/v2-rebase branch April 30, 2026 04:49
samxu01 pushed a commit that referenced this pull request Sep 28, 2026
…oes not drag it (TASK-184)

The minute tick added in 5b86162 re-reads /api/pods, and the rows re-sort by
lastMessage. A message to a pod in view therefore moves a row, and native
scroll anchoring drags the list to preserve that row offset: ux-lead measured
4 of 17 rows staying in view with Everything open and scrolled. Opting the
scroller out holds 16 of 17.

Same property the chat transcript uses for the opposite reason. There,
anchoring is disabled only during a managed history prepend so late media
above the viewport stays stable; these rows are fixed-height text with no
late layout to lose.

The guard in v2-layout-invariants reads the LAST .v2-pods__list block, because
the selector is declared twice (v2.css:1096 from #251 and v2.css:10997 from
#1578) and the later top-level block wins every conflicting declaration. The
first block is fully superseded; that is noted rather than cleaned up here.
lilyshen0722 added a commit to thantiklermcirony/commonly that referenced this pull request Oct 9, 2026
…eam-Commonly#1989)

* fix(v2): the sidebar's minute tick re-reads the row times (TASK-184)

The row time is a datum from the last /api/pods and the tick only recomputed
the label, so a tab left open aged a frozen timestamp and read further from
the truth the longer it stayed open. The tick now re-reads the datum, and so
does becoming visible — the moment a row is actually read.

useV2Pods.refresh takes {silent}, which swaps the data without touching
loading/error: the sidebar renders a spinner while loading, so a non-silent
poll would blink the whole list once a minute, and one failed poll would
replace the last good rows with an error.

Foreground only, so a background tab costs nothing.

Tests: V2PodsSidebar.timestampFreshness (the label moves when the datum
does; a hidden tab does not poll; the tick is a minute) and
useV2PodsSilentRefresh (silent keeps loading false and keeps the last good
rows on failure; the loud default is asserted beside it as the control).

* fix(v2): a successful poll clears a stale error, so a failed mount recovers (TASK-184)

sprint-review's finding, measured end to end: mount fails, so `error` is set and
V2PodsSidebar (:501/:502) renders the message INSTEAD of the rows; the next
silent poll succeeded every 60s, swapped the data, and could not clear the one
state that hides the list. The poll refreshed data nobody could see.

A successful read is positive evidence the stored error is stale, so the success
path clears it in both modes. The invariant that mattered is preserved: a failed
poll still never SETS an error, so a transient failure cannot replace the last
good rows. The complement is tested too — a silent failure does not clear an
error it did not earn.

New cell: V2PodsSidebar.pollRecovery mocks the API LAYER rather than the hook, so
the real useV2Pods and the real sidebar run end to end: error and no rows, then a
successful tick brings the rows back with no reload; and while the poll keeps
failing the error stays and no rows appear.

Also corrected in the PR body: a hidden tab skips the REQUEST, not the work — the
interval still fires and still calls setNow.

* fix(v2): the pod list opts out of scroll anchoring, so a fresh poll does not drag it (TASK-184)

The minute tick added in 5b86162 re-reads /api/pods, and the rows re-sort by
lastMessage. A message to a pod in view therefore moves a row, and native
scroll anchoring drags the list to preserve that row offset: ux-lead measured
4 of 17 rows staying in view with Everything open and scrolled. Opting the
scroller out holds 16 of 17.

Same property the chat transcript uses for the opposite reason. There,
anchoring is disabled only during a managed history prepend so late media
above the viewport stays stable; these rows are fixed-height text with no
late layout to lose.

The guard in v2-layout-invariants reads the LAST .v2-pods__list block, because
the selector is declared twice (v2.css:1096 from Team-Commonly#251 and v2.css:10997 from
Team-Commonly#1578) and the later top-level block wins every conflicting declaration. The
first block is fully superseded; that is noted rather than cleaned up here.

* test(v2): drop an assertion that could never fail

sprint-review's code-delta gate on Team-Commonly#1989 found it and they were right, in
the direction I did not expect: not a false red, an inert line.

`expect(list).not.toBe(ruleBody(v2, '.v2-pods__list'))` was written to pin
the choice of `lastRuleBody` — read the LATER, effective `.v2-pods__list`
block rather than the superseded one — and to force a re-read if the
duplicate were ever de-duped. It could not do either. `lastRuleBody` slices
from the leading `\n`; `ruleBody` slices from `lineStart + 1` and drops it.
The two therefore differ by whitespace whatever the stylesheet contains, so
the assertion is true by construction and can never fire.

Measured both directions rather than reasoned from the helpers:
  - raw compare, superseded block deleted -> 153/153 GREEN (inert)
  - trimmed compare, same deletion        -> 1 failed (it bites)
so the mechanism is the whitespace, and trimming is not a fix: it reds on
the harmless de-dup the original comment claimed to guard against.

Deleted, and the comment now records why not to re-add it. The property is
still carried, in both hazard directions, by the two `toContain`s above:
the declaration missing from the effective block, or the effective block
removed so the lookup falls through to the old one.

118/118 suites, 1034 tests, tsc 0, eslint 0 errors (the file's 6 warnings
are unchanged from base).
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.

3 participants