Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 72 additions & 12 deletions src/activities/tasks/createStandup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const DEFAULT_STANDUP = {
export default async function createStandup({ auth }: Context): Promise<void> {
const prisma = Container.get(PrismaClient);

DEBUG(`Starting createStandup for event ${auth.eventId}`);

const event = (await prisma.event.findFirst({
rejectOnNotFound: true,
where: {
Expand Down Expand Up @@ -68,45 +70,103 @@ export default async function createStandup({ auth }: Context): Promise<void> {
})) as SlackEventWithProjects<SlackMentorInfo & SlackStudentInfo> &
EventWithStandupAndProsper;

DEBUG(
`Loaded event ${auth.eventId} (slackWorkspaceId=${event.slackWorkspaceId}); found ${event.projects.length} candidate project(s) without a standup`,
);

if (event.projects.length === 0) {
DEBUG(
`No projects matched the filter (standupId=null, slackChannelId set, has student with slackId) for event ${auth.eventId} — nothing to do`,
);
return;
}

const client = getClientForEvent(event);
const slack = getSlackClientForEvent(event);

let created = 0;
let skipped = 0;
let failed = 0;

for (const project of event.projects) {
DEBUG(
`Processing project ${project.id} (channel=${project.slackChannelId}, students=${project.students.length})`,
);

try {
await slack.conversations.invite({
const inviteResult = await slack.conversations.invite({
channel: project.slackChannelId!,
users: STANDUP_USER,
});
} catch (ex) {}
DEBUG(
`Invited standup bot ${STANDUP_USER} into channel ${project.slackChannelId} for project ${project.id} (ok=${inviteResult.ok})`,
);
} catch (ex) {
DEBUG(
`Slack invite of ${STANDUP_USER} into ${project.slackChannelId} for project ${project.id} failed (continuing — bot may already be present): %O`,
ex,
);
}

DEBUG(project.students);
DEBUG(`Project ${project.id} students: %O`, project.students);

@augmentcode augmentcode Bot Jun 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project.students includes student email (see SlackStudentInfo / slackEventInfoSelect), so logging it with %O will emit PII whenever debug logging is enabled; consider restricting/redacting logged fields (e.g., counts/IDs only).

Severity: medium

Other Locations
  • src/activities/tasks/createStandup.ts:135
  • src/activities/tasks/createStandup.ts:140

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

const users = project.students
.filter((s) => s.slackId)
.map((s) => ({ userId: s.slackId! }));

DEBUG(
`Project ${project.id}: ${users.length}/${project.students.length} students have a slackId`,
);

if (users.length === 0) {
DEBUG(`Skipping project ${project.id} — no eligible student Slack IDs`);
skipped += 1;
continue;
}

const payload = {
...DEFAULT_STANDUP,
channel: project.slackChannelId,
channelId: project.slackChannelId,
users,
};

try {
const result = await client.createStandup({
...DEFAULT_STANDUP,
channel: project.slackChannelId,
channelId: project.slackChannelId,
users,
});
DEBUG(
`Calling StandupAndProsper.createStandup for project ${project.id} with payload: %O`,
payload,
);
const result = await client.createStandup(payload);
DEBUG(
`StandupAndProsper.createStandup response for project ${project.id}: %O`,
result,
);

if (result.standupId) {
await prisma.project.update({
where: { id: project.id },
data: { standupId: result.standupId },
});
DEBUG(
`Created standup ${result.standupId} for project ${project.id} in channel ${project.slackChannelId}`,
);
created += 1;
} else {
DEBUG(
`StandupAndProsper.createStandup returned no standupId for project ${project.id} — not persisting. Full response: %O`,
result,
);
failed += 1;
}
} catch (ex) {
DEBUG(
`Created standup for project ${project.id} in channel ${project.slackChannelId}`,
`Exception creating standup for project ${project.id} in channel ${project.slackChannelId}: %O`,
ex,
);
} catch (ex) {
DEBUG(ex);
failed += 1;
}
}

DEBUG(
`createStandup finished for event ${auth.eventId}: created=${created}, skipped=${skipped}, failed=${failed}`,
);
}