Skip to content

Commit 2ca09af

Browse files
author
StackMemory Bot (CLI)
committed
fix(conductor): resolve team name→UUID, surface poll errors
- Team name/key (e.g. "Stackmemoryai" or "STA") now resolved to UUID via getTeams() - UUID team IDs passed through unchanged - Initial poll failure now logs actual error message to console - Root cause of silent failures: 401 from expired LINEAR_API_KEY
1 parent d9e1ac4 commit 2ca09af

1 file changed

Lines changed: 39 additions & 11 deletions

File tree

src/cli/commands/orchestrator.ts

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -736,18 +736,44 @@ export class Conductor {
736736
// Initialize Linear client
737737
this.client = await this.createLinearClient();
738738

739-
// Auto-detect team ID if not provided
740-
if (!this.config.teamId && this.client) {
739+
// Resolve team — name/key → UUID, or auto-detect if not provided
740+
if (this.client) {
741741
try {
742-
const team = await this.client.getTeam();
743-
this.config.teamId = team.id;
744-
logger.info('Auto-detected Linear team', {
745-
id: team.id,
746-
name: team.name,
747-
key: team.key,
748-
});
742+
if (this.config.teamId) {
743+
// Check if teamId is a UUID (skip resolution) or name/key (needs resolution)
744+
const isUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(this.config.teamId);
745+
if (!isUuid) {
746+
const teams = await this.client.getTeams();
747+
const needle = this.config.teamId.toLowerCase();
748+
const match = teams.find(
749+
(t) =>
750+
t.name.toLowerCase() === needle ||
751+
t.key.toLowerCase() === needle
752+
);
753+
if (match) {
754+
logger.info('Resolved team name to ID', {
755+
name: this.config.teamId,
756+
id: match.id,
757+
key: match.key,
758+
});
759+
this.config.teamId = match.id;
760+
} else {
761+
logger.warn('Team not found by name/key, will try as ID', {
762+
team: this.config.teamId,
763+
});
764+
}
765+
}
766+
} else {
767+
const team = await this.client.getTeam();
768+
this.config.teamId = team.id;
769+
logger.info('Auto-detected Linear team', {
770+
id: team.id,
771+
name: team.name,
772+
key: team.key,
773+
});
774+
}
749775
} catch (err) {
750-
logger.warn('Failed to auto-detect team', {
776+
logger.warn('Failed to resolve team', {
751777
error: (err as Error).message,
752778
});
753779
}
@@ -778,7 +804,9 @@ export class Conductor {
778804
try {
779805
await this.poll();
780806
} catch (err) {
781-
logger.error('Initial poll failed', { error: (err as Error).message });
807+
const e = err as Error;
808+
logger.error('Initial poll failed', { error: e.message, stack: e.stack });
809+
console.error(`[conductor] Initial poll failed: ${e.message}`);
782810
}
783811

784812
// Schedule recurring polls

0 commit comments

Comments
 (0)