Skip to content
Merged
Show file tree
Hide file tree
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
55 changes: 55 additions & 0 deletions docs/api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3874,6 +3874,17 @@
"string",
"null"
]
},
"waiting_on": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/RunWaitingOn",
"description": "Set while the run is `needs_input`: what it waits for from a person\n(its questions, or a named action such as reviewing its pull\nrequest). A run never waits on a person for nothing."
}
]
}
},
"required": [
Expand Down Expand Up @@ -4382,6 +4393,50 @@
],
"type": "object"
},
"RunWaitingOn": {
"description": "What a run waiting on a person (`needs_input`) is waiting for: the\nquestions to answer, or one named action.",
"properties": {
"action": {
"description": "What to do, in plain words.",
"examples": [
"Review pull request #318"
],
"type": "string"
},
"detail": {
"description": "Why, or what is still open. May be empty.",
"examples": [
"Open on the pull request: the link check couldn't reach /pricing. Mark it ready once that is dealt with, push a fix or comment on it, and CoderHelm picks it up from there."
],
"type": "string"
},
"since": {
"description": "When the wait started (RFC 3339).",
"examples": [
"2026-10-22T14:15:25Z"
],
"type": [
"string",
"null"
]
},
"url": {
"description": "Where to do it (the pull request, the ticket), when known.",
"examples": [
"https://github.com/acme/web/pull/318"
],
"type": [
"string",
"null"
]
}
},
"required": [
"action",
"detail"
],
"type": "object"
},
"RunsPage": {
"description": "A page of runs.",
"properties": {
Expand Down
26 changes: 26 additions & 0 deletions infra/lib/monitoring-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,32 @@ export class MonitoringStack extends cdk.Stack {
metricName: "RunLoopStopped",
metricValue: "1",
});
// Each run the stuck-run sweep found waiting on a person with nothing
// asked (services/common/src/run_wait.rs): the worker can no longer
// write one, so any is a bug, and an alarm says so.
const cleanupLogs = logs.LogGroup.fromLogGroupName(
this,
"StuckRunCleanupLogs",
`/aws/lambda/${prefix}-stuck-run-cleanup`
);
const unaskedMetric = new logs.MetricFilter(this, "RunWaitingUnaskedFilter", {
logGroup: cleanupLogs,
filterPattern: logs.FilterPattern.literal('"run_waiting_unasked"'),
metricNamespace: "CoderHelm/Runs",
metricName: "RunWaitingUnasked",
metricValue: "1",
}).metric({ period: cdk.Duration.hours(1), statistic: "Sum" });
const unaskedAlarm = new cloudwatch.Alarm(this, "RunWaitingUnaskedAlarm", {
alarmName: `${prefix}-run-waiting-unasked`,
alarmDescription:
"A run waited on a person with nothing asked. The stuck-run sweep named its wait and notified the team; find the write that set needs_input without one.",
metric: unaskedMetric,
threshold: 1,
evaluationPeriods: 1,
comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
treatMissingData: cloudwatch.TreatMissingData.NOT_BREACHING,
});
unaskedAlarm.addAlarmAction(new actions.SnsAction(alertTopic));
const modelRequeuedMetric = new logs.MetricFilter(this, "ModelErrorRequeuedFilter", {
logGroup: workerLogs,
filterPattern: logs.FilterPattern.literal('"model_error_requeued"'),
Expand Down
4 changes: 4 additions & 0 deletions infra/lib/worker-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,14 @@ export class WorkerStack extends cdk.Stack {
// The last pass a stuck run reached when its record names none.
TRACES_TABLE_NAME: props.tracesTable.tableName,
CHECKPOINTS_TABLE_NAME: props.checkpointsTable.tableName,
// A run waiting on a person: its reminder, and the notice for a
// wait the sweep named, go to the worker as `run_waiting`.
TICKET_QUEUE_URL: props.ticketQueue.queueUrl,
},
});

runsTable.grantReadWriteData(cleanupFunction);
props.ticketQueue.grantSendMessages(cleanupFunction);
props.tracesTable.grantReadData(cleanupFunction);
props.checkpointsTable.grantReadData(cleanupFunction);
// The runs table is CMK-encrypted; grantReadWriteData on a fromTableName
Expand Down
Loading
Loading