Add issue ancestors, @-mention wakeups on comments
- issueService.getAncestors() walks parent chain, returning up to 50 ancestors - GET /issues/:id now includes ancestors array for context delivery to agents - POST /issues/:id/comments now parses @-mentions and wakes mentioned agents Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,7 +35,8 @@ export function issueRoutes(db: Db) {
|
||||
return;
|
||||
}
|
||||
assertCompanyAccess(req, issue.companyId);
|
||||
res.json(issue);
|
||||
const ancestors = await svc.getAncestors(id);
|
||||
res.json({ ...issue, ancestors });
|
||||
});
|
||||
|
||||
router.post("/companies/:companyId/issues", validate(createIssueSchema), async (req, res) => {
|
||||
@@ -262,6 +263,21 @@ export function issueRoutes(db: Db) {
|
||||
details: { commentId: comment.id },
|
||||
});
|
||||
|
||||
// @-mention wakeups
|
||||
svc.findMentionedAgents(issue.companyId, req.body.body).then((ids) => {
|
||||
for (const mentionedId of ids) {
|
||||
heartbeat.wakeup(mentionedId, {
|
||||
source: "automation",
|
||||
triggerDetail: "system",
|
||||
reason: `Mentioned in comment on issue ${id}`,
|
||||
payload: { issueId: id, commentId: comment.id },
|
||||
requestedByActorType: actor.actorType,
|
||||
requestedByActorId: actor.actorId,
|
||||
contextSnapshot: { issueId: id, commentId: comment.id, source: "comment.mention" },
|
||||
}).catch((err) => logger.warn({ err, agentId: mentionedId }, "failed to wake mentioned agent"));
|
||||
}
|
||||
}).catch((err) => logger.warn({ err, issueId: id }, "failed to resolve @-mentions"));
|
||||
|
||||
res.status(201).json(comment);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user