Use the UI accessible-company list for reply parsing

Match the CompanyContext scope rather than the instance-admin directory when determining which issue prefixes the browser links.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-29 23:56:14 -05:00
1 parent 6df66df9d9
commit 980fad261c
1 file changed
+1 -1
@@ -97,7 +97,7 @@ export async function runAgentJourney(id: AgentJourney, context: JourneyContext,
const runs = state.taskRuns.filter(run => run.status === "succeeded");
if (!runs.length || runs.some(run => !Number.isFinite(Date.parse(run.finishedAt)))) throw new JourneyError("failed", "final_run_time_missing");
const run = [...runs].sort((a, b) => Date.parse(a.finishedAt) - Date.parse(b.finishedAt)).at(-1)!;
const companies = await context.api.get<Row[]>("/api/companies");
const companies = await context.api.get<Row[]>("/api/companies?scope=accessible");
if (!Array.isArray(companies) || !companies.some(row => row.id === context.company.id)
|| companies.some(row => typeof row.issuePrefix !== "string" || !row.issuePrefix)) throw new JourneyError("failed", "reply_company_context_missing");
await open(issue);