Skip to content

Commit cab8966

Browse files
Davidson Gomesclaude
andcommitted
fix(chat-bridge): resolve agent file from WORKSPACE_ROOT, not session cwd
Ticket threads pass workspace_path (e.g. workspace/personal/) as the session cwd. loadAgentFile was building the path relative to that cwd, so it looked for .claude/agents/ inside the ticket's folder instead of the workspace root — always failing for every agent. Fix: try WORKSPACE_ROOT/.claude/agents/{name}.md first, fall back to cwd for custom per-directory agents. Affected: kai-personal-assistant, flux-finance, and any ticket with a workspace_path set. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 277adb0 commit cab8966

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

dashboard/terminal-server/src/chat-bridge.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ const NEEDS_APPROVAL = new Set([
4848
* Extracts YAML frontmatter for metadata and the body as the prompt.
4949
*/
5050
function loadAgentFile(agentName, cwd) {
51-
const agentPath = path.join(cwd, '.claude', 'agents', `${agentName}.md`);
51+
// Agent definitions live at the workspace root — cwd varies per ticket session.
52+
const rootPath = path.join(WORKSPACE_ROOT, '.claude', 'agents', `${agentName}.md`);
53+
const cwdPath = path.join(cwd, '.claude', 'agents', `${agentName}.md`);
54+
const agentPath = fs.existsSync(rootPath) ? rootPath : cwdPath;
5255
if (!fs.existsSync(agentPath)) {
5356
console.warn(`[chat-bridge] Agent file not found: ${agentPath}`);
5457
return null;

0 commit comments

Comments
 (0)