runs: reconcile uncertain browser launches with a persistent intent key

This commit is contained in:
2026-10-20 15:40:43 +01:00
parent f06281db08
commit 44834e91f0
8 changed files with 146 additions and 9 deletions
+9 -2
View File
@@ -185,12 +185,12 @@ export class PipelinesRepository {
* Starts a fresh run of one pipeline version. `notifyMode` is auto, on or off;
* auto omits the field so the pipeline definition applies.
*/
async runPipeline({ pipelineId, version, prompt, workspace, notifyMode = "auto", title = "" } = {}) {
async runPipeline({ pipelineId, version, prompt, workspace, notifyMode = "auto", title = "", requestKey = newChatOperationId() } = {}) {
const request = {
type: Protocol.RUN_PIPELINE,
pipeline_id: Number(pipelineId),
version: Number(version),
request_key: newChatOperationId(),
request_key: requestKey,
workspace: String(workspace ?? "").trim(),
input: { prompt: String(prompt ?? "") },
};
@@ -204,6 +204,13 @@ export class PipelinesRepository {
return response.run_detail;
}
/** Read-only admission reconciliation after a lost launch response. */
async runByRequestKey(requestKey) {
if (!String(requestKey ?? "").trim()) throw new ProtocolError("A launch request key is required.");
const response = await this.#client.call({ type: Protocol.GET_RUN, request_key: requestKey });
return response.run_detail ?? null;
}
async cancelRun(id) {
const response = await this.#client.call({ type: Protocol.CANCEL_RUN, run_id: id });
if (!response.run_detail) {