Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

feat(slack): stamp Slack-origin tasks as kanban cards so done-summary fires e2e

Chaitanya Giri115b4aa126fa
diff --git a/src/renderer/src/hooks/useHive.ts b/src/renderer/src/hooks/useHive.ts
index d00a831f..d41bc401 100644
--- a/src/renderer/src/hooks/useHive.ts
+++ b/src/renderer/src/hooks/useHive.ts
@@ -467,6 +467,39 @@ export function useHive(config: HarnessConfig | null): void {
const withSlackReply = (m: QueuedMessage): string =>
m.slack ? `${m.text}\n\n${slackReplyDirective(slackReplyScript.current, m.slack)}` : m.text;
+ // Promote a genuine Slack-origin work item to a stamped kanban card the first
+ // time it's dispatched to the office. The card carries slack:{channel,thread_ts}
+ // (origin thread) so the main-process done-observer can post its one summary
+ // reply in-thread once the card later reaches 'done'. ADDITIVE + idempotent +
+ // best-effort: a failure here never affects the dispatch that already happened,
+ // and only dispatched work items land here (slash commands/acks never do).
+ type SlackTaskCard = Parameters<typeof window.cth.hiveWriteTasks>[0][number];
+ const ensureSlackCard = async (m: QueuedMessage): Promise<void> => {
+ const slack = m.slack;
+ if (!slack) return;
+ try {
+ const raw = await window.cth.hiveTasks();
+ const existing: SlackTaskCard[] =
+ raw && typeof raw === 'object' && Array.isArray((raw as { tasks?: unknown }).tasks)
+ ? (raw as { tasks: SlackTaskCard[] }).tasks
+ : [];
+ const id = `slack-${slack.thread_ts}-${m.id}`;
+ if (existing.some((t) => t.id === id)) return; // already promoted — no dup
+ const title = m.text.length > 80 ? `${m.text.slice(0, 79)}…` : m.text;
+ const card: SlackTaskCard = {
+ id,
+ title,
+ description: m.text,
+ status: 'todo',
+ dependsOn: [],
+ priority: 1,
+ createdAt: new Date().toISOString(),
+ slack
+ };
+ await window.cth.hiveWriteTasks([...existing, card]);
+ } catch { /* best-effort: card promotion must never sink dispatch */ }
+ };
+
const flush = () => {
const { agents, messageQueues, enrichEnabled } = useStore.getState();
const byId = (id: string) => agents.find((a) => a.id === id);
@@ -489,11 +522,16 @@ export function useHive(config: HarnessConfig | null): void {
const head = messageQueues[GOD_ID][0];
const isCmd = head.text.startsWith('/');
if (isCmd) {
+ // Control command (e.g. /compact) — never a work item: no card (anti-spam).
dispatch(GOD_ID, byId(GOD_ID));
} else if (head.enrich || enrichEnabled) {
- dispatch(GOD_ID, byId(ASSISTANT_ID), (m) => enrichTaskPrompt(m.text, slackReplyScript.current, m.slack));
+ if (dispatch(GOD_ID, byId(ASSISTANT_ID), (m) => enrichTaskPrompt(m.text, slackReplyScript.current, m.slack)) && head.slack) {
+ void ensureSlackCard(head);
+ }
} else {
- dispatch(GOD_ID, byId(GOD_ID), withSlackReply);
+ if (dispatch(GOD_ID, byId(GOD_ID), withSlackReply) && head.slack) {
+ void ensureSlackCard(head);
+ }
}
}
};