{"record":{"id":"23c4858c6584f80a","repo":"can1357/oh-my-pi","slug":"overall-trial-deadline-exceeded-math-round-dead","errorCode":null,"errorMessage":"Overall trial deadline exceeded (${Math.round(deadlineMs / 1000)}s)","messagePattern":"Overall trial deadline exceeded \\((.+?)s\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/tb/trial.ts","lineNumber":91,"sourceCode":"\tlet client: RpcClient | null = null;\n\tlet deadlineExpired = false;\n\tlet usage: TrialUsage = { ...EMPTY_USAGE };\n\tlet finalMessage = \"\";\n\tlet agentMs = 0;\n\tlet verifierMs = 0;\n\tlet agentTimedOut = false;\n\n\tconst deadline = setTimeout(() => {\n\t\tdeadlineExpired = true;\n\t\tvoid client?.stop().catch(() => {});\n\t\tvoid vm?.rm();\n\t}, deadlineMs);\n\tdeadline.unref();\n\n\tconst checkDeadline = () => {\n\t\tif (deadlineExpired || performance.now() - wallStartedAt >= deadlineMs) {\n\t\t\tdeadlineExpired = true;\n\t\t\tthrow new Error(`Overall trial deadline exceeded (${Math.round(deadlineMs / 1000)}s)`);\n\t\t}\n\t};\n\tconst beforeDeadline = <T>(operation: Promise<T>): Promise<T> =>\n\t\tPromise.race([\n\t\t\toperation,\n\t\t\tnew Promise<T>((_, reject) => {\n\t\t\t\tconst remainingMs = deadlineMs - (performance.now() - wallStartedAt);\n\t\t\t\tif (remainingMs <= 0) {\n\t\t\t\t\treject(new Error(`Overall trial deadline exceeded (${Math.round(deadlineMs / 1000)}s)`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst timer = setTimeout(\n\t\t\t\t\t() => reject(new Error(`Overall trial deadline exceeded (${Math.round(deadlineMs / 1000)}s)`)),\n\t\t\t\t\tremainingMs,\n\t\t\t\t);\n\t\t\t\ttimer.unref();\n\t\t\t\tvoid operation.finally(() => clearTimeout(timer)).catch(() => {});\n\t\t\t}),","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/tb/trial.ts#L73-L109","documentation":"runTrial enforces an overall wall-clock deadline via a timer plus checkDeadline, called before each awaited stage. If the deadline timer fired or elapsed real time exceeds deadlineMs, further work is aborted with this error so a hung task cannot block the harness indefinitely.","triggerScenarios":"checkDeadline (invoked from runTrial at stage boundaries via beforeDeadline) finds deadlineExpired true or performance.now() - wallStartedAt >= deadlineMs — i.e. the trial (agent session, microVM run, etc.) exceeded the configured --deadline/--timeout budget.","commonSituations":"Task genuinely too slow for the configured deadline; microVM or gateway hung causing beforeDeadline's race to lose; deadline set too low for large/long tasks; agent stuck retrying API calls.","solutions":["Increase the deadline (--deadline / config deadlineMs) and rerun","Investigate what hung: check vmond/microVM and gateway logs for the stalled stage","Split the workload into smaller tasks or reduce task scope so it fits the budget"],"exampleFix":"// before\ntb run --deadline 300   # heavy task needs ~20min\n// after\ntb run --deadline 1800","handlingStrategy":"try-catch","validationCode":"// estimate per-task budget before submitting\nconst estMs = estimateTrialDuration(task);\nif (estMs >= deadlineMs) throw new Error(`Task ${task.name} likely exceeds deadline ${deadlineMs}ms`);","typeGuard":null,"tryCatchPattern":"try {\n  await runTrial({ task, deadlineMs });\n} catch (err) {\n  if (String(err.message).startsWith(\"Overall trial deadline exceeded\")) {\n    logger.warn(\"Trial deadline exceeded; rerun with a larger --deadline or inspect for hangs\", { task: task.name });\n  } else throw err;\n}","preventionTips":["Set deadlines generously above worst-case task duration","Monitor vmond/microVM health to catch hangs early","Track per-stage timings to right-size deadline budgets"],"tags":["timeout","deadline","trial"],"backgroundTag":"deadline-exceeded","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}