fix(cli): resolve local skill sources against the persona JSON directory#226
Conversation
Relative local skill sources (./skills/foo.md) were passed through the loader verbatim and only resolved at install time against process.cwd(). For personas installed into a project (or loaded from a configured persona dir), that path points at the launch directory, not the persona package — the generated `cp` fails, and because skill installs run as a single `&&` chain, the failure aborts the harness spawn AND prevents the skill cache marker from being written, forcing every subsequent spawn to re-download all prpm skills from scratch. Resolve local skill sources at load time, mirroring sidecar handling: against the declaring JSON's directory, falling back to the package root above it (persona-pack layout keeps skills/ next to personas/) and cwd (the installer's rewritten __assets convention). Missing files now warn and drop the skill instead of aborting the launch, matching the missing-sidecar semantics. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request adds support for resolving relative local skill sources (non-URL paths ending in .md) against the persona JSON directory, with fallbacks for persona-pack layouts and cwd-relative paths. It also ensures that missing local skill files produce warnings and are gracefully dropped instead of throwing an error. The feedback suggests adding a defensive check in resolveLocalSkillSources to verify that each skill element is a valid object before accessing its properties, preventing potential runtime TypeErrors from malformed user JSON.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| return skills.flatMap((skill) => { | ||
| const source = skill.source; |
There was a problem hiding this comment.
Since skills is parsed from user-provided JSON files, its elements are not fully validated to be objects at parse time. If any element in the skills array is null, undefined, or not an object, accessing skill.source will throw a runtime TypeError. Adding a defensive check for skill being a valid object prevents potential crashes.
return skills.flatMap((skill) => {
if (!skill || typeof skill !== 'object') {
return [];
}
const source = skill.source;|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughPersonas now resolve local skill file sources during spec creation: relative ChangesLocal skill source resolution in persona overrides
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 `@packages/cli/src/local-personas.ts`:
- Around line 939-976: resolveLocalSkillSources currently falls back to
process.cwd() when resolving relative skill paths, ignoring the loader-provided
cwd; change its signature to accept a cwd parameter (e.g., cwd: string |
undefined) and replace resolvePath(process.cwd(), source) with resolvePath(cwd
?? process.cwd(), source). Update callers (e.g., loadLocalPersonas and any other
callers of resolveLocalSkillSources) to pass the loader's options.cwd so
resolution uses the supplied cwd context.
🪄 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: 2dd9ada2-71f2-4d1f-841a-1b46376e8e3d
📒 Files selected for processing (2)
packages/cli/src/local-personas.test.tspackages/cli/src/local-personas.ts
|
Implemented a scoped fix for the PR. Changed:
Addressed comments
Advisory Notes
Validation run locally:
All passed. The root |
…dy; repair installed persona skill paths (#223) * feat(factory): software factory pipeline — ready-for-agent → scope → team spawn → implement Adds the complete software factory pipeline so issues marked `ready-for-agent` flow automatically through scoping, team spawning, and implementation: - writeRemoteFile IPC: renderer/agents can now create/update Linear issues - ready-for-agent 4th band in Attention Inbox (expanded by default) - spawnTeamForIssue: spawns codex-impl + claude-review pairs with task prompts - issue-scoping module: detectRepo, suggestTeamSize, labelIssueWithRepo - board-steward persona: proactive agent that watches and drives the pipeline Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: apply pr-reviewer fixes for #222 * chore: apply pr-reviewer fixes for #222 * chore: add linear-dispatcher + repo-router personas to refresh script Install @agentworkforce/persona-linear-dispatcher and @agentworkforce/persona-repo-router, and append both to the personas:refresh npm script so all personas stay current via one command. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * chore: remove board-steward persona board-steward overlaps with the linear-dispatcher + repo-router pair — both poll ready-for-agent Linear issues and spawn impl/review teams, so running them together double-dispatches. Keep linear-dispatcher (board watcher) + repo-router (per-issue routing) as the single dispatch path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(broker): fail fast when a persona worker exits before harness-ready; repair installed persona skill paths A workforce CLI that dies during setup (e.g. a failed skill install calls process.exit) previously burned the entire 120s PERSONA_HARNESS_READY_TIMEOUT_MS before surfacing an error. The harness-ready wait now rejects as soon as the worker is gone: it watches agent_exit/agent_exited/agent_released events and runs a 2s listAgents liveness poll as a catch-all for exits that slip past the event stream (e.g. between spawn and subscription). Also repairs the installed linear-dispatcher and repo-router personas, which carried raw `./skills/*.md` sources from an installer version without skill-asset support. The cp for those paths resolved against the project root, failed, aborted every spawn, and kept the workforce skill cache marker from being written — forcing a full prpm re-download on each attempt. Skill files now live under __assets/<id>/skills/ with sources rewritten to the convention the fixed installer emits (AgentWorkforce/workforce#226). Do not re-run personas:refresh until a CLI with that fix is published and the agentworkforce dep is bumped — npx prefers the local 3.0.52 binary, which would regenerate the broken JSONs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: agent-relay-code[bot] <agent-relay-code[bot]@users.noreply.github.com>
|
Implemented a scoped fix for the remaining valid review finding. Changed:
Addressed comments
Advisory Notes
Validation:
All passed. The root GitHub currently reports PR #226 as closed and merged, so I am not marking it READY. |
The 4.0.2 release carries the workforce-side fixes this branch depends on: the persona loader resolves local skill sources against the persona JSON's directory (AgentWorkforce/workforce#226), and the installer copies local skill assets into __assets/ with rewritten sources. - bump agentworkforce + @agentworkforce/deploy ^3.0.51 -> ^4.0.2 - update the AGENTWORKFORCE_CLI_VERSION npx fallback pin to match - re-run personas:refresh with the 4.0.2 installer; it reproduced the hand-repaired linear-dispatcher/repo-router JSONs byte-for-byte and picked up the published slack-comms permissions field Smoke-tested: `agentworkforce show` now resolves local skill sources to absolute existing paths; typecheck and 120/120 tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…224) * chore: bump agentworkforce to ^4.0.2 and refresh installed personas The 4.0.2 release carries the workforce-side fixes this branch depends on: the persona loader resolves local skill sources against the persona JSON's directory (AgentWorkforce/workforce#226), and the installer copies local skill assets into __assets/ with rewritten sources. - bump agentworkforce + @agentworkforce/deploy ^3.0.51 -> ^4.0.2 - update the AGENTWORKFORCE_CLI_VERSION npx fallback pin to match - re-run personas:refresh with the 4.0.2 installer; it reproduced the hand-repaired linear-dispatcher/repo-router JSONs byte-for-byte and picked up the published slack-comms permissions field Smoke-tested: `agentworkforce show` now resolves local skill sources to absolute existing paths; typecheck and 120/120 tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore: apply pr-reviewer fixes for #224 --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: agent-relay-code[bot] <agent-relay-code[bot]@users.noreply.github.com>
Problem
Personas that declare local skills with relative paths (e.g.
./skills/persona-relayfile-mount.md, aspersona-linear-dispatcherandpersona-repo-routerdo) break when spawned from anywhere other than the persona package root. The loader passes the source through verbatim and it's only resolved at install time againstprocess.cwd(), so the generatedcplooks for the file in the launch directory:Because all skill installs run as one
&&-chained shell command, this single failingcphas two compounding effects:runInstallexits non-zero), surfacing downstream as pear's 120s "Timed out waiting for Workforce persona … to prepare its harness".Fix
Resolve local skill sources at persona load time in
local-personas.ts, mirroring the existing sidecar (claudeMd/agentsMd) handling:__sourceDir) first.skills/next topersonas/).__assets/...convention).Resolution happens where skills enter a resolved spec (
standaloneSpecFromOverride/mergeOverride), which is unambiguous because skills replace wholesale per cascade layer; inherited skills were already resolved when the base layer was built.Testing
node --test dist/local-personas.test.js: 44/44 pass.~/.agentworkforce/workforce/config.json, because the suite isn't isolated from the developer's persona-dir config — run withAGENT_WORKFORCE_HOMEpointed at an empty dir.🤖 Generated with Claude Code