fix: Task completion result and null duration display bugs
1. task-worker.ts: Pass full result object to completeTask instead of
non-existent result.data property (was causing {} to be stored)
2. WorkersDashboard.tsx: Handle null running_seconds in formatSecondsToTime
(was displaying "nulls" due to JS type coercion)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2249,7 +2249,7 @@ export class TaskWorker {
|
|||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
// Layer 1: Verify DB completion was recorded
|
// Layer 1: Verify DB completion was recorded
|
||||||
const dbVerified = await taskService.completeTask(task.id, { result: result.data });
|
const dbVerified = await taskService.completeTask(task.id, result);
|
||||||
if (!dbVerified) {
|
if (!dbVerified) {
|
||||||
console.error(`[TaskWorker] ${this.friendlyName} task ${task.id} DB COMPLETION VERIFICATION FAILED`);
|
console.error(`[TaskWorker] ${this.friendlyName} task ${task.id} DB COMPLETION VERIFICATION FAILED`);
|
||||||
await taskService.failTask(task.id, 'DB completion verification failed');
|
await taskService.failTask(task.id, 'DB completion verification failed');
|
||||||
@@ -2313,7 +2313,7 @@ export class TaskWorker {
|
|||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
// Use WorkerSession completion but also verify with taskService
|
// Use WorkerSession completion but also verify with taskService
|
||||||
await WorkerSession.completeTask(task.id, this.workerId, { result: result.data });
|
await WorkerSession.completeTask(task.id, this.workerId, result);
|
||||||
|
|
||||||
// Verify output exists for payload-creating tasks
|
// Verify output exists for payload-creating tasks
|
||||||
const outputVerification = await taskService.verifyTaskOutput(task);
|
const outputVerification = await taskService.verifyTaskOutput(task);
|
||||||
|
|||||||
@@ -587,7 +587,8 @@ function StepBadge({ worker }: { worker: Worker }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Format seconds to human readable duration
|
// Format seconds to human readable duration
|
||||||
function formatSecondsToTime(seconds: number): string {
|
function formatSecondsToTime(seconds: number | null | undefined): string {
|
||||||
|
if (seconds === null || seconds === undefined) return '-';
|
||||||
if (seconds < 60) return `${seconds}s`;
|
if (seconds < 60) return `${seconds}s`;
|
||||||
const mins = Math.floor(seconds / 60);
|
const mins = Math.floor(seconds / 60);
|
||||||
const secs = seconds % 60;
|
const secs = seconds % 60;
|
||||||
|
|||||||
Reference in New Issue
Block a user