Skip to content

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions apps/api/src/handlers/artifacts/upload-complete.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Context } from 'hono';

import { db, eq, taskArtifacts } from '@roomote/db/server';
import { notifyFastAgentParentOnArtifact } from '@roomote/sdk/server';

import type { Variables } from '../../types';
import {
Expand Down Expand Up @@ -52,5 +53,30 @@ export async function markArtifactUploadComplete(
})
.where(eq(taskArtifacts.id, artifactId));

const notification = await notifyFastAgentParentOnArtifact({
id: artifact.id,
taskId: artifact.taskId,
runId: artifact.runId,
path: artifact.path,
version: artifact.version,
contentType: artifact.contentType,
uploaded: true,
});
if (notification === 'failed') {
return c.json(
{ error: 'Artifact published, but parent notification failed' },
503,
);
}
if (notification === 'in_progress') {
// Another request is mid-delivery; 503 keeps the worker retrying until
// that delivery settles instead of reporting success while it can still
// fail and release its claim.
return c.json(
{ error: 'Artifact published; parent notification is in progress' },
503,
);
}

return new Response(null, { status: 200 });
}
2 changes: 0 additions & 2 deletions apps/api/src/handlers/slack/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ export const SLACK_EVENT_DEDUP_PREFIX = 'slack:event:';
export const SLACK_WORKFLOW_COMPLETION_PREFIX = 'slack:workflow-completion:';
export const SLACK_WORKFLOW_COMPLETION_TTL_SECONDS = 24 * 60 * 60;
export const ROUTING_LOCK_TTL_SECONDS = 60;
export const FAST_AGENT_LOCK_TTL_SECONDS = 600;
export const SLACK_WELCOME_MESSAGE_CHANNEL_LIMIT = 3;
export const SLACK_ROUTING_LOCK_PREFIX = 'slack:routing-lock:';
export const SLACK_FAST_AGENT_LOCK_PREFIX = 'slack:fast-agent-lock:';
export const SLACK_SETUP_SUGGESTION_LOCK_PREFIX =
'slack:setup-suggestion-reaction:';
export const LEADING_FAST_COMMAND_MENTION_PATTERN = /^\s*<@[^>]+>[\s,:;.-]*/;
Expand Down
110 changes: 101 additions & 9 deletions apps/api/src/handlers/slack/events/fast-agent-processing.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading