Skip to content

Move dashboard UI assets under the install dir#1030

Merged
willwashburn merged 3 commits into
mainfrom
feature/dashboard-under-install-dir
Jun 3, 2026
Merged

Move dashboard UI assets under the install dir#1030
willwashburn merged 3 commits into
mainfrom
feature/dashboard-under-install-dir

Conversation

@willwashburn

@willwashburn willwashburn commented Jun 3, 2026

Copy link
Copy Markdown
Member

User description

Summary

Follow-up to #1028. Unifies relay's on-disk footprint: dashboard UI assets now install to and resolve from the install dir (~/.agentworkforce/relay/dashboard) instead of the separate ~/.relay/dashboard.

After the .agentworkforce/relay rename, everything relay-installs lived under ~/.agentworkforce/relay/ (repo, bin/, global data) except the dashboard, which sat off in ~/.relay/. This folds it in.

Changes (coordinated across 4 sites)

  • install.sh writes UI files to $INSTALL_DIR/dashboard (respects AGENT_RELAY_INSTALL_DIR).
  • Broker runtime download/version-check (broker-lifecycle.ts) fetches and version-stamps assets at ~/.agentworkforce/relay/dashboard, re-downloading there on version mismatch.
  • resolveDashboardStaticDir reads the install-dir location first, falling back to ~/.relay/dashboard/out so installs predating this move keep working until assets are re-fetched.
  • Uninstaller already purges ~/.relay/dashboard alongside the install dirs (unchanged), so orphaned old assets are still cleaned.

Migration

Gentle: a user who upgrades the CLI without re-running install.sh keeps serving from ~/.relay/dashboard (resolver fallback) and the broker re-downloads to the new location on next version bump. Old ~/.relay/dashboard is then orphaned and cleaned on uninstall.

Validation

  • npm run typecheck
  • core.test.ts 51 passed — incl. new install-dir dashboard layout and prior ~/.relay dashboard layout (fallback) cases ✅
  • Prettier (repo-pinned 3.8.3) clean ✅

🤖 Generated with Claude Code


CodeAnt-AI Description

Move dashboard UI assets under the install directory and keep old installs working

What Changed

  • Dashboard UI files now install under the relay install directory instead of ~/.relay/dashboard
  • When starting the dashboard, relay looks in the new install-location first and still falls back to the old ~/.relay/dashboard location for existing installs
  • If the dashboard assets are out of date, relay re-downloads them into the new install-location

Impact

✅ One dashboard install location
✅ Smoother upgrades for existing users
✅ Fewer missing-dashboard startup issues

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Unify relay's on-disk footprint: dashboard UI assets now install to and
resolve from `~/.agentworkforce/relay/dashboard` (the install dir) instead of
the separate `~/.relay/dashboard`.

- install.sh writes UI files to `$INSTALL_DIR/dashboard`.
- The broker downloads/version-checks assets at `~/.agentworkforce/relay/
  dashboard` and re-fetches there on version mismatch.
- `resolveDashboardStaticDir` reads the install-dir location first, falling
  back to `~/.relay/dashboard/out` so installs predating the move keep working
  until assets are re-fetched.
- Tests cover both the install-dir layout and the `~/.relay` fallback.

The uninstaller already purges `~/.relay/dashboard` alongside the install dirs,
so orphaned old assets are still cleaned.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@willwashburn willwashburn requested a review from khaliqgant as a code owner June 3, 2026 06:21
@codeant-ai

codeant-ai Bot commented Jun 3, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jun 3, 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: da7306b5-a774-4c3b-9f40-dab42ccfd883

📥 Commits

Reviewing files that changed from the base of the PR and between 9399385 and 3fddde7.

📒 Files selected for processing (3)
  • .agentworkforce/trajectories/completed/2026-06/traj_btwekvdri4hl/summary.md
  • .agentworkforce/trajectories/completed/2026-06/traj_btwekvdri4hl/trajectory.json
  • packages/cli/src/cli/commands/core.test.ts
✅ Files skipped from review due to trivial changes (3)
  • .agentworkforce/trajectories/completed/2026-06/traj_btwekvdri4hl/trajectory.json
  • .agentworkforce/trajectories/completed/2026-06/traj_btwekvdri4hl/summary.md
  • packages/cli/src/cli/commands/core.test.ts

📝 Walkthrough

Walkthrough

Dashboard UI asset installation and broker discovery were migrated to prefer ~/.agentworkforce/relay/dashboard (and an install-derived root) while retaining legacy ~/.relay/dashboard fallback; installer, broker lifecycle, CLI tests, changelog, and trajectory records updated accordingly.

Changes

Dashboard Asset Directory Migration

Layer / File(s) Summary
Installation script extracts to new directory
install.sh
download_dashboard_ui now extracts dashboard assets to $INSTALL_DIR/dashboard instead of hardcoded $HOME/.relay/dashboard.
Compute dashboard data roots/helpers
packages/cli/src/cli/lib/broker-lifecycle.ts
Adds helper functions to compute an install-derived root, a new home-based root ~/.agentworkforce/relay/dashboard, and a legacy prior root ~/.relay/dashboard.
Resolve ordered candidates for static dir
packages/cli/src/cli/lib/broker-lifecycle.ts
resolveDashboardStaticDir builds an ordered candidate list: install-derived out, new home-based out, then legacy out, and selects the best existing candidate.
Refresh uses computed targetDir for extraction/version
packages/cli/src/cli/lib/broker-lifecycle.ts
refreshDashboardAssetsIfStale computes targetDir from the install-derived root (fallback to new home-based), derives assetsDir and versionFile from that base, and removes the prior hard-coded ~/.relay/dashboard assignment.
CLI tests for install-dir/layout and stale-skip behavior
packages/cli/src/cli/commands/core.test.ts
Adds tests verifying up infers --static-dir from install-dir and custom install-dir layouts (requiring index.html) and a test asserting asset refresh is skipped when stored .version matches binary --version.
Changelog updates
CHANGELOG.md
Changelog documents migration to ~/.agentworkforce/relay/dashboard and clarifies removal of legacy ~/.agent-relay/dashboard startup fallback.
Trajectory records
.agentworkforce/trajectories/completed/*
Adds trajectory summary.md and trajectory.json for PR #1030 with metadata, decision event, and retrospective.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • khaliqgant

Poem

🐰 New paths for dashboard bits I cheer,
From old to fresh they hop right here,
Fallback trails keep safety near,
Tests hum softly, no download fear,
Relay gardens tidy, springtime clear 🌷

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.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 The title accurately describes the main change: moving dashboard UI assets to the install directory, which is the primary objective of this PR.
Description check ✅ Passed The PR description is comprehensive and well-structured, covering summary, changes, migration behavior, and validation results, though it deviates from the template structure provided.
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 feature/dashboard-under-install-dir

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.

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Jun 3, 2026

@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: 96002d36eb

ℹ️ 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".

return pickDashboardStaticDir([standaloneDashboardOutDir], deps);
// Installs place UI assets under the install dir (~/.agentworkforce/relay/dashboard/out).
// ~/.relay/dashboard/out is read as a fallback for installs predating that move.
const installDashboardOutDir = path.join(homeDir, '.agentworkforce/relay', 'dashboard', 'out');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor custom install dirs for dashboard assets

When users install with AGENT_RELAY_INSTALL_DIR set, install.sh now writes the downloaded UI to $INSTALL_DIR/dashboard, but this resolver only probes the default ~/.agentworkforce/relay/dashboard/out plus the old ~/.relay fallback. In that custom-install scenario, especially offline or when the best-effort refresh download fails, agent-relay up starts the standalone dashboard without the assets that the installer just downloaded, so the installed dashboard UI is not served from the chosen install dir. Consider including the configured install dir or deriving the asset path from the installed binary/launcher location.

Useful? React with 👍 / 👎.

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

🧹 Nitpick comments (1)
packages/cli/src/cli/commands/core.test.ts (1)

299-318: ⚡ Quick win

Add a custom install-dir coverage case.

Please add one up test with env: { HOME: ..., AGENT_RELAY_INSTALL_DIR: '/tmp/custom-relay' } and static assets under /tmp/custom-relay/dashboard/out. This closes the contract gap with installer behavior and prevents regressions.

Also applies to: 320-339

🤖 Prompt for 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.

In `@packages/cli/src/cli/commands/core.test.ts` around lines 299 - 318, Add a new
test mirroring the existing "up infers static-dir for install-dir dashboard
layout" case but set env to include AGENT_RELAY_INSTALL_DIR: '/tmp/custom-relay'
and place static assets under '/tmp/custom-relay/dashboard/out'; use the same
helpers (createFsMock, createHarness, runCommand) and assert that
deps.spawnProcess mock receives '--static-dir' pointing to
'/tmp/custom-relay/dashboard/out' (refer to the test name, createHarness,
deps.spawnProcess.mock.calls, and the '--static-dir' assertion to locate where
to add this case).
🤖 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 `@CHANGELOG.md`:
- Line 32: The changelog bullet about agent-relay is too
implementation-detailed; rewrite the entry in the [Unreleased] section to be
concise and impact-first by focusing on user-visible change (e.g., "agent-relay
now installs dashboard UI assets under ~/.agentworkforce/relay/dashboard") and
removing fallback/re-download/uninstall mechanics and parenthetical details;
apply the same concise, impact-first trimming to the other referenced entry
(line 82) so each bullet is a single short user-facing statement.

In `@packages/cli/src/cli/lib/broker-lifecycle.ts`:
- Around line 725-729: The code currently hardcodes
installDashboardOutDir/priorDashboardOutDir to ~/.agentworkforce/relay/... which
ignores a custom install location; update the path construction to respect the
AGENT_RELAY_INSTALL_DIR override (or the existing install-dir config if
available) by resolving baseInstallDir = process.env.AGENT_RELAY_INSTALL_DIR ||
path.join(homeDir, '.agentworkforce', 'relay') and then build
installDashboardOutDir = path.join(baseInstallDir, 'dashboard', 'out') (and
similarly adjust any prior/fallback dir logic if you have a prior-install
env/config), then pass those computed dirs into pickDashboardStaticDir; apply
the same change at the other occurrences mentioned (the blocks around the other
noted locations).

---

Nitpick comments:
In `@packages/cli/src/cli/commands/core.test.ts`:
- Around line 299-318: Add a new test mirroring the existing "up infers
static-dir for install-dir dashboard layout" case but set env to include
AGENT_RELAY_INSTALL_DIR: '/tmp/custom-relay' and place static assets under
'/tmp/custom-relay/dashboard/out'; use the same helpers (createFsMock,
createHarness, runCommand) and assert that deps.spawnProcess mock receives
'--static-dir' pointing to '/tmp/custom-relay/dashboard/out' (refer to the test
name, createHarness, deps.spawnProcess.mock.calls, and the '--static-dir'
assertion to locate where to add this case).
🪄 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: CHILL

Plan: Pro Plus

Run ID: 5999d91f-59a0-4352-99ac-f96a9ae83bfb

📥 Commits

Reviewing files that changed from the base of the PR and between dd0320e and 96002d3.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • install.sh
  • packages/cli/src/cli/commands/core.test.ts
  • packages/cli/src/cli/lib/broker-lifecycle.ts

Comment thread CHANGELOG.md
### Changed

- Relay stores per-project runtime state in `.agentworkforce/relay/` (was `.agent-relay/`), and the global data/log home moves from `~/.agent-relay`, `$XDG_DATA_HOME/agent-relay`, and platform equivalents to `agentworkforce/relay`. The `~/.config/agent-relay` config directory is unchanged.
- `agent-relay` installs and resolves dashboard UI assets under the install dir (`~/.agentworkforce/relay/dashboard`) instead of `~/.relay/dashboard`, unifying the on-disk footprint. The broker still reads `~/.relay/dashboard` as a fallback and re-downloads assets to the new location on version mismatch.

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep these changelog bullets concise and impact-first.

Both entries are accurate, but they include implementation detail that should be trimmed in [Unreleased] (especially the fallback/re-download mechanics and uninstall parenthetical).

Suggested concise rewrite
-- `agent-relay` installs and resolves dashboard UI assets under the install dir (`~/.agentworkforce/relay/dashboard`) instead of `~/.relay/dashboard`, unifying the on-disk footprint. The broker still reads `~/.relay/dashboard` as a fallback and re-downloads assets to the new location on version mismatch.
+- `agent-relay` now stores dashboard UI assets under `~/.agentworkforce/relay/dashboard` and still supports existing installs that use `~/.relay/dashboard`.

-- `agent-relay` drops the legacy `~/.agent-relay/dashboard` static-asset fallback from broker startup. (Uninstall still purges legacy install dirs.)
+- `agent-relay` no longer uses `~/.agent-relay/dashboard` as a broker static-asset fallback.

As per coding guidelines: "Changelog entries should be concise and impact-first, with one short bullet per user-visible change… Omit … internal notes, and implementation details."

Also applies to: 82-82

🤖 Prompt for 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.

In `@CHANGELOG.md` at line 32, The changelog bullet about agent-relay is too
implementation-detailed; rewrite the entry in the [Unreleased] section to be
concise and impact-first by focusing on user-visible change (e.g., "agent-relay
now installs dashboard UI assets under ~/.agentworkforce/relay/dashboard") and
removing fallback/re-download/uninstall mechanics and parenthetical details;
apply the same concise, impact-first trimming to the other referenced entry
(line 82) so each bullet is a single short user-facing statement.

Comment on lines +725 to +729
// Installs place UI assets under the install dir (~/.agentworkforce/relay/dashboard/out).
// ~/.relay/dashboard/out is read as a fallback for installs predating that move.
const installDashboardOutDir = path.join(homeDir, '.agentworkforce/relay', 'dashboard', 'out');
const priorDashboardOutDir = path.join(homeDir, '.relay', 'dashboard', 'out');
return pickDashboardStaticDir([installDashboardOutDir, priorDashboardOutDir], deps);

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Honor custom install dir in runtime dashboard path resolution.

install.sh writes UI assets to $INSTALL_DIR/dashboard (which can be overridden by AGENT_RELAY_INSTALL_DIR), but these paths are hardcoded to ~/.agentworkforce/relay/dashboard here. For custom install-dir users, --static-dir inference and stale-asset refresh can miss the installed assets.

Suggested fix
+function resolveInstallDir(deps: CoreDependencies): string | null {
+  const explicit = deps.env.AGENT_RELAY_INSTALL_DIR?.trim();
+  if (explicit) return explicit;
+  const homeDir = deps.env.HOME || deps.env.USERPROFILE || os.homedir();
+  if (!homeDir) return null;
+  return path.join(homeDir, '.agentworkforce/relay');
+}

 function resolveDashboardStaticDir(dashboardBinary: string | null, deps: CoreDependencies): string | null {
@@
-  const homeDir = deps.env.HOME || deps.env.USERPROFILE || '';
+  const homeDir = deps.env.HOME || deps.env.USERPROFILE || '';
   if (!homeDir) {
     return null;
   }

-  const installDashboardOutDir = path.join(homeDir, '.agentworkforce/relay', 'dashboard', 'out');
+  const installDir = resolveInstallDir(deps);
+  const installDashboardOutDir = installDir ? path.join(installDir, 'dashboard', 'out') : null;
   const priorDashboardOutDir = path.join(homeDir, '.relay', 'dashboard', 'out');
-  return pickDashboardStaticDir([installDashboardOutDir, priorDashboardOutDir], deps);
+  return pickDashboardStaticDir(
+    [installDashboardOutDir, priorDashboardOutDir].filter((p): p is string => Boolean(p)),
+    deps
+  );
 }
@@
-  const homeDir = deps.env.HOME || deps.env.USERPROFILE || os.homedir();
-  const assetsDir = path.join(homeDir, '.agentworkforce/relay', 'dashboard', 'out');
-  const versionFile = path.join(homeDir, '.agentworkforce/relay', 'dashboard', '.version');
+  const installDir = resolveInstallDir(deps);
+  if (!installDir) return;
+  const assetsDir = path.join(installDir, 'dashboard', 'out');
+  const versionFile = path.join(installDir, 'dashboard', '.version');
@@
-  const targetDir = path.join(homeDir, '.agentworkforce/relay', 'dashboard');
+  const targetDir = path.join(installDir, 'dashboard');

Also applies to: 1039-1040, 1062-1062

🤖 Prompt for 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.

In `@packages/cli/src/cli/lib/broker-lifecycle.ts` around lines 725 - 729, The
code currently hardcodes installDashboardOutDir/priorDashboardOutDir to
~/.agentworkforce/relay/... which ignores a custom install location; update the
path construction to respect the AGENT_RELAY_INSTALL_DIR override (or the
existing install-dir config if available) by resolving baseInstallDir =
process.env.AGENT_RELAY_INSTALL_DIR || path.join(homeDir, '.agentworkforce',
'relay') and then build installDashboardOutDir = path.join(baseInstallDir,
'dashboard', 'out') (and similarly adjust any prior/fallback dir logic if you
have a prior-install env/config), then pass those computed dirs into
pickDashboardStaticDir; apply the same change at the other occurrences mentioned
(the blocks around the other noted locations).

return pickDashboardStaticDir([standaloneDashboardOutDir], deps);
// Installs place UI assets under the install dir (~/.agentworkforce/relay/dashboard/out).
// ~/.relay/dashboard/out is read as a fallback for installs predating that move.
const installDashboardOutDir = path.join(homeDir, '.agentworkforce/relay', 'dashboard', 'out');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The new install-dir lookup is hardcoded to ~/.agentworkforce/relay and ignores AGENT_RELAY_INSTALL_DIR, so users who installed to a custom directory will not have their dashboard assets discovered and --static-dir will be omitted. Resolve the install root from the same install-dir override contract used by the installer instead of assuming a fixed home-relative path. [logic error]

Severity Level: Major ⚠️
- ❌ agent-relay up ignores AGENT_RELAY_INSTALL_DIR for assets.
- ⚠️ Dashboard UI served from default path, not install dir.
Steps of Reproduction ✅
1. Configure a custom install directory by setting
`AGENT_RELAY_INSTALL_DIR=/custom/install` and run the installer `install.sh`, which sets
`INSTALL_DIR="${AGENT_RELAY_INSTALL_DIR:-$HOME/.agentworkforce/relay}"` at `install.sh:17`
and downloads dashboard UI into `$INSTALL_DIR/dashboard/out` in `download_dashboard_ui`
(`install.sh:341-36`).

2. After installation, observe that the dashboard UI assets live under
`/custom/install/dashboard/out` (from the installer) and not under
`~/.agentworkforce/relay/dashboard/out`, matching the documented "install dir" contract.

3. Start the CLI with `agent-relay up` (registered in
`packages/cli/src/cli/commands/core.ts:71-104`, which wires the `up` command to
`runUpCommand` in `broker-lifecycle.ts`), leaving `AGENT_RELAY_INSTALL_DIR` set so the
runtime environment still reflects the custom install dir.

4. In the `runUpCommand` path, `startDashboardWithFallback`
(`packages/cli/src/cli/lib/broker-lifecycle.ts:1113-1123`) calls `getDashboardSpawnArgs`
(`lines ~790-821`), which invokes `resolveDashboardStaticDir` (`line 698`). That function
computes `installDashboardOutDir = path.join(homeDir, '.agentworkforce/relay',
'dashboard', 'out')` at line 727 and `priorDashboardOutDir = path.join(homeDir, '.relay',
'dashboard', 'out')` at line 728, then calls `pickDashboardStaticDir` (`lines 660-37`)
without ever consulting `deps.env.AGENT_RELAY_INSTALL_DIR`. As a result, even when the
installer placed assets under `/custom/install/dashboard/out`, the static-dir lookup only
considers `~/.agentworkforce/relay/dashboard/out` and `~/.relay/dashboard/out`. In any
scenario where assets exist only under the configured install dir (for example, if runtime
refresh fails or is disabled), `pickDashboardStaticDir` returns `null`,
`getDashboardSpawnArgs` omits the `--static-dir` flag, and the dashboard server never
points at the UI assets installed under the custom install dir, demonstrating that the
install-dir override is ignored for static asset resolution. This is inconsistent with the
installer and with other components (e.g. `relay-pty-path.ts:213-218`), which do honor
`AGENT_RELAY_INSTALL_DIR`.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** packages/cli/src/cli/lib/broker-lifecycle.ts
**Line:** 727:727
**Comment:**
	*Logic Error: The new install-dir lookup is hardcoded to `~/.agentworkforce/relay` and ignores `AGENT_RELAY_INSTALL_DIR`, so users who installed to a custom directory will not have their dashboard assets discovered and `--static-dir` will be omitted. Resolve the install root from the same install-dir override contract used by the installer instead of assuming a fixed home-relative path.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +1039 to +1040
const assetsDir = path.join(homeDir, '.agentworkforce/relay', 'dashboard', 'out');
const versionFile = path.join(homeDir, '.agentworkforce/relay', 'dashboard', '.version');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Asset refresh now writes cache/version files only under ~/.agentworkforce/relay, which diverges from installs done with AGENT_RELAY_INSTALL_DIR and causes assets to be downloaded/versioned in the wrong location. Use the configured install dir consistently when computing assetsDir, versionFile, and targetDir so refresh targets the actual install location. [logic error]

Severity Level: Major ⚠️
- ❌ Asset refresh writes under wrong home-relative dashboard directory.
- ⚠️ Custom install dir unused for dashboard UI cache.
Steps of Reproduction ✅
1. Install the CLI with a custom install directory by running
`AGENT_RELAY_INSTALL_DIR=/custom/install ./install.sh`. The installer uses
`INSTALL_DIR="${AGENT_RELAY_INSTALL_DIR:-$HOME/.agentworkforce/relay}"` at `install.sh:17`
and downloads dashboard UI into `$INSTALL_DIR/dashboard/out` in `download_dashboard_ui`
(`install.sh:341-36`), so assets end up under `/custom/install/dashboard/out`.

2. Run `agent-relay up` (wired via `registerCoreCommands` in
`packages/cli/src/cli/commands/core.ts:71-104`, which calls `runUpCommand`), ensuring the
dashboard is enabled (default `options.dashboard !== false` at `core.ts:1311`).

3. Within `runUpCommand`, the dashboard start path calls `startDashboardWithFallback`
(`packages/cli/src/cli/lib/broker-lifecycle.ts:1113-1123`), which immediately invokes
`refreshDashboardAssetsIfStale` (`line 1016`) with the resolved dashboard binary.

4. Inside `refreshDashboardAssetsIfStale`, the code computes `homeDir = deps.env.HOME ||
deps.env.USERPROFILE || os.homedir()` (`line 39) and then sets `assetsDir =
path.join(homeDir, '.agentworkforce/relay', 'dashboard', 'out')` and `versionFile =
path.join(homeDir, '.agentworkforce/relay', 'dashboard', '.version')` at lines 1039–1041,
and `targetDir = path.join(homeDir, '.agentworkforce/relay', 'dashboard')` at line 1063.
None of these paths consult `deps.env.AGENT_RELAY_INSTALL_DIR`, even though the installer
and other runtime code (e.g. `packages/utils/src/relay-pty-path.ts:213-218`) treat it as
the source of truth for the install root. Consequently, when
`refreshDashboardAssetsIfStale` decides assets are stale, it deletes `assetsDir`,
recreates `targetDir`, extracts the tarball there, and writes `.version` under
`~/.agentworkforce/relay/dashboard`, while the original assets under
`/custom/install/dashboard/out` are left untouched and unversioned. This means dashboard
asset refresh and version tracking operate against a home-relative directory that may not
match the configured install dir, leading to assets and cache markers being written to the
wrong location whenever `AGENT_RELAY_INSTALL_DIR` is used.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** packages/cli/src/cli/lib/broker-lifecycle.ts
**Line:** 1039:1040
**Comment:**
	*Logic Error: Asset refresh now writes cache/version files only under `~/.agentworkforce/relay`, which diverges from installs done with `AGENT_RELAY_INSTALL_DIR` and causes assets to be downloaded/versioned in the wrong location. Use the configured install dir consistently when computing `assetsDir`, `versionFile`, and `targetDir` so refresh targets the actual install location.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Jun 3, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@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.

1 issue found across 4 files

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

Re-trigger cubic

Comment thread packages/cli/src/cli/lib/broker-lifecycle.ts Outdated
@agent-relay-code

Copy link
Copy Markdown
Contributor

pr-reviewer applied fixes — committed and pushed 9399385 to this PR. The notes below describe what changed.

Reviewed and fixed PR #1030 locally.

Changes made:

  • Dashboard static asset resolution now supports custom install roots by inferring .../dashboard/out from nonstandard .../bin/relay-dashboard-server paths.
  • Dashboard asset refresh now writes/checks .version and out/ under that inferred custom install root when applicable.
  • Added focused tests for custom install-dir static resolution and refresh skip behavior.

Verification run:

  • bash -n install.sh
  • npm --prefix packages/cli run lint (passed with existing warnings)
  • npm run typecheck
  • npx vitest run packages/cli/src/cli/commands/core.test.ts

@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

🤖 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 @.agentworkforce/trajectories/completed/2026-06/traj_btwekvdri4hl/summary.md:
- Line 31: The chapter item "Resolved dashboard assets relative to nonstandard
installed dashboard binaries: Resolved dashboard assets relative to nonstandard
installed dashboard binaries" contains a duplicated description; edit the
summary line in summary.md to either remove the repeated phrase after the colon
so it reads "Resolved dashboard assets relative to nonstandard installed
dashboard binaries" or replace the description after the colon with a brief
clarifying detail (e.g., what was resolved or why nonstandard installation
matters) to avoid verbatim repetition.
🪄 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: CHILL

Plan: Pro Plus

Run ID: aa1b8c06-38d0-4fb9-bbac-08eb36d2c3e6

📥 Commits

Reviewing files that changed from the base of the PR and between 96002d3 and 9399385.

📒 Files selected for processing (4)
  • .agentworkforce/trajectories/completed/2026-06/traj_btwekvdri4hl/summary.md
  • .agentworkforce/trajectories/completed/2026-06/traj_btwekvdri4hl/trajectory.json
  • packages/cli/src/cli/commands/core.test.ts
  • packages/cli/src/cli/lib/broker-lifecycle.ts
✅ Files skipped from review due to trivial changes (1)
  • .agentworkforce/trajectories/completed/2026-06/traj_btwekvdri4hl/trajectory.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/cli/src/cli/lib/broker-lifecycle.ts

@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.

1 issue found across 4 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/cli/src/cli/lib/broker-lifecycle.ts">

<violation number="1" location="packages/cli/src/cli/lib/broker-lifecycle.ts:723">
P2: Dashboard root inference treats many global PATH binaries as custom installs, which can redirect asset refresh to unwritable system directories instead of the home install path.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic


const homeDir = deps.env.HOME || deps.env.USERPROFILE || '';
const resolvedBinaryDir = path.resolve(binaryDir);
const ignoredBinDirs = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Dashboard root inference treats many global PATH binaries as custom installs, which can redirect asset refresh to unwritable system directories instead of the home install path.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/cli/src/cli/lib/broker-lifecycle.ts, line 723:

<comment>Dashboard root inference treats many global PATH binaries as custom installs, which can redirect asset refresh to unwritable system directories instead of the home install path.</comment>

<file context>
@@ -695,6 +695,44 @@ function pickDashboardStaticDir(candidates: string[], deps: CoreDependencies): s
+
+  const homeDir = deps.env.HOME || deps.env.USERPROFILE || '';
+  const resolvedBinaryDir = path.resolve(binaryDir);
+  const ignoredBinDirs = [
+    homeDir ? path.join(homeDir, '.local', 'bin') : null,
+    path.join('/usr/local', 'bin'),
</file context>

@agent-relay-code

Copy link
Copy Markdown
Contributor

⚠️ pr-reviewer push failed (exit 1) — fixes were not applied to the PR. The notes below are advisory and were not pushed.

Reviewed and fixed PR #1030 locally. I addressed the custom AGENT_RELAY_INSTALL_DIR dashboard asset bug flagged by bot reviews, preserved that install dir in generated launchers, added regression tests for the actual installer layout, and cleaned up the changelog plus trajectory wording comments. I also checked the PR discussion on GitHub: #1030

Local validation passed:

  • npx vitest run packages/cli/src/cli/commands/core.test.ts packages/cli/src/install-script.test.ts
  • npm run lint (exit 0, existing warnings only)
  • npm run typecheck
  • bash -n install.sh
  • targeted prettier --check

@agent-relay-code

Copy link
Copy Markdown
Contributor

⚠️ pr-reviewer did not push — the PR branch advanced during the review, so fixes were withheld to avoid overwriting newer commits. Re-trigger the review once the branch settles. The notes below are advisory and were not pushed.

Reviewed and fixed PR #1030 locally.

Fixed:

  • Installer launchers now export AGENT_RELAY_INSTALL_DIR, preserving custom install roots after install.
  • Broker dashboard asset resolution now checks that configured install root for both --static-dir selection and stale asset refresh.
  • Added regressions for launcher-installed custom dashboard assets and stale refresh targeting.

Local validation passed:

  • npx vitest run packages/cli/src/cli/commands/core.test.ts
  • npm run lint
  • npm run typecheck
  • ./install.test.sh

@agent-relay-code

Copy link
Copy Markdown
Contributor

pr-reviewer could not complete review for #1030 in AgentWorkforce/relay.
The review harness exited with code 137.
No review was posted; this needs operator attention.

@agent-relay-code

Copy link
Copy Markdown
Contributor

⚠️ pr-reviewer did not push — the PR branch advanced during the review, so fixes were withheld to avoid overwriting newer commits. Re-trigger the review once the branch settles. The notes below are advisory and were not pushed.

Reviewed PR #1030 and fixed an install-layout breakage: custom AGENT_RELAY_INSTALL_DIR installs now propagate that root through the generated agent-relay launcher, and broker dashboard asset resolution/refresh uses that configured root before falling back to inferred/default/legacy paths.

Added focused CLI tests for the custom install-root with the dashboard binary still in ~/.local/bin, plus refresh-skip behavior for matching .version. Updated the changelog accordingly.

Verification:

  • bash -n install.sh passed
  • node --check on touched TS files passed
  • Prettier check on touched Markdown/TS files passed
  • Conflict-marker scan passed
  • Full Vitest/lint/typecheck could not run locally because npm dependency installation repeatedly left/removed an incomplete node_modules tree in this harness; failures were missing tool/package files, not PR code failures.

@agent-relay-code

Copy link
Copy Markdown
Contributor

⚠️ pr-reviewer did not push — the PR branch advanced during the review, so fixes were withheld to avoid overwriting newer commits. Re-trigger the review once the branch settles. The notes below are advisory and were not pushed.

Reviewed and fixed PR #1030 locally.

Changes made:

  • install.sh now writes relay-dashboard-server.install-dir beside the verified dashboard binary so custom AGENT_RELAY_INSTALL_DIR installs remain discoverable when the binary is in ~/.local/bin.
  • broker-lifecycle.ts reads that hint before falling back to default home/legacy asset paths, so static-dir inference and asset refresh target the correct install root.
  • core-maintenance.ts removes the new hint file during uninstall.
  • Added focused CLI tests for hinted custom install-dir resolution and refresh behavior.

Checks run:

  • bash -n install.sh
  • bash install.test.sh
  • prettier --check on changed TS/Markdown files
  • esbuild parse/bundle checks for touched TS files

I could not run Vitest locally because npm ci was OOM-killed in this container and Vitest could not start without a complete dependency install.

@agent-relay-code

Copy link
Copy Markdown
Contributor

⚠️ pr-reviewer did not push — the PR branch advanced during the review, so fixes were withheld to avoid overwriting newer commits. Re-trigger the review once the branch settles. The notes below are advisory and were not pushed.

Reviewed and fixed PR #1030 locally.

Fixed:

  • Installer now keeps the real relay-dashboard-server under $INSTALL_DIR/bin and writes a $BIN_DIR launcher, matching the new dashboard asset layout.
  • Installed agent-relay launchers now export AGENT_RELAY_INSTALL_DIR, so custom install roots can be recovered at runtime.
  • Broker dashboard static-dir resolution and asset refresh now prefer AGENT_RELAY_INSTALL_DIR, then binary-derived roots, then home/default and legacy fallbacks.
  • Added regression coverage for the actual custom install shape: dashboard launcher in ~/.local/bin, assets in custom $INSTALL_DIR/dashboard.

Verified:

  • bash -n install.sh
  • vitest run packages/cli/src/cli/commands/core.test.ts passed: 55 tests
  • ESLint on edited TS files: no errors; existing warnings only in broker-lifecycle.ts

Full CLI tsc was not useful in this container because workspace deps were not installed and the temporary verifier setup resolved @agent-relay/* from external/global packages instead of local workspace packages.

@willwashburn willwashburn merged commit 916afc5 into main Jun 3, 2026
2 checks passed
@willwashburn willwashburn deleted the feature/dashboard-under-install-dir branch June 3, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant