Q1: keep other work's chat mentions out of task prompts
Every mention already wakes the agent through its own chat-wake task, so ordinary tasks no longer inject the org-wide mention inbox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b07eedbaa7
commit
77505aab8d
3 files changed
+72
-37
No files matched your search
@@ -15,7 +15,6 @@ import {
|
||||
buildAgentInstructions,
|
||||
buildTaskPrompt,
|
||||
type ChatContextBlock,
|
||||
type InboxContextBlock,
|
||||
type GoalRow,
|
||||
type ProjectRow,
|
||||
type SkillRuntimeSnapshotRow,
|
||||
@@ -142,7 +141,6 @@ export class TaskExecutionService {
|
||||
workspace: workspace ? { id: workspace.id, localPath: workspace.local_path, writeAccess: task.requires_filesystem === 1 } : null,
|
||||
};
|
||||
const chatContext = this.loadChatContext(orgId, isolation);
|
||||
const inboxContext = chatContext ? null : this.loadInboxContext(orgId, agent.id);
|
||||
// The CEO is the c_suite role — the same predicate the grant system
|
||||
// enforces — not "has no manager", which any board hire can match.
|
||||
const isCeo = agent.role_level === "c_suite";
|
||||
@@ -179,7 +177,6 @@ export class TaskExecutionService {
|
||||
hasReports,
|
||||
managerName: this.agentName(orgId, agent.manager_agent_id),
|
||||
chatContext,
|
||||
inboxContext,
|
||||
priorCompletedRuns: this.completedRunCount(task.id, runId),
|
||||
}),
|
||||
toolContext,
|
||||
@@ -555,26 +552,6 @@ export class TaskExecutionService {
|
||||
};
|
||||
}
|
||||
|
||||
private loadInboxContext(orgId: string, agentId: string): InboxContextBlock | null {
|
||||
const messages = this.db.prepare(`
|
||||
select m.body_md,
|
||||
coalesce(a.name, e.display_name, m.sender_type) as sender_name,
|
||||
s.name as channel_name
|
||||
from chat_mentions cm
|
||||
join chat_messages m on m.id = cm.message_id
|
||||
join chat_spaces s on s.id = m.space_id
|
||||
left join agents a on a.id = m.sender_id and m.sender_type = 'agent'
|
||||
left join employees e on e.id = m.sender_id and m.sender_type = 'employee'
|
||||
where cm.target_type = 'agent' and cm.target_id = ? and m.org_id = ? and m.deleted_at is null
|
||||
order by m.created_at desc
|
||||
limit 10
|
||||
`).all(agentId, orgId) as Array<{ body_md: string; sender_name: string; channel_name: string }>;
|
||||
if (messages.length === 0) return null;
|
||||
return {
|
||||
transcript: messages.reverse().map((m) => `[${m.sender_name} in #${m.channel_name}]: ${m.body_md}`).join("\n"),
|
||||
};
|
||||
}
|
||||
|
||||
private completedRunCount(taskId: string, excludingRunId: string): number {
|
||||
const row = this.db.prepare("select count(*) as n from task_runs where task_id = ? and state = 'completed' and id <> ?")
|
||||
.get(taskId, excludingRunId) as { n: number };
|
||||
|
||||
Reference in new issue
Block a user