Files
samiandClaude Sonnet 5 6db304a0ae proto: widen error-on-paused for ADR 0013's auto-pause signal (1.3.0)
DAEMON's docs/adr/0013-task-state-machine-ownership.md needs a wire signal
for the difference between a paused task the daemon entered unilaterally
(auth_required, server_file_changed, disk_full) and one that was requested
(user, schedule, queue stop, admission reconcile) -- without it, DAEMON's §3
resume rule ("resume only when the reason matches the event that justifies
resuming") has nothing correctness-preserving to key on, and would have to
guess from timing. CORE has already accepted the ADR; this was the sole
remaining blocker per DAEMON's own status line on it.

No retype, no new field -- error was already TaskError | null on both
event.task.state and TaskSummary, exactly as DAEMON characterized the ask.
Only the *description* of when it is populated widens: previously "failed or
retry_wait", now also "paused, when the daemon entered it on its own
initiative". A deliberate pause still carries error: null. TaskError's own
top-level description gets the same widening, since it previously also said
"failed or retry_wait" and would otherwise contradict the field that embeds
it.

New fixture (event.task.state.auto-paused.json) exercises the case directly:
an auth_required pause with error populated, contrasted in its own
description against download.pause.json's error: null for a requested pause.
The existing event.task.state.json fixture's first assertion was stale
("error is present exactly when failed or retry_wait") and is corrected.

Minor bump, 1.2.0 -> 1.3.0: a description widening on an already-nullable,
already-optional field changes no JSON Schema shape, but it is a real
behavioral commitment change worth a version bump so downstream regenerates
and notices, per the same reasoning ADR 0010 applied to TaskErrorCode.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012fgjnqFCS5h5L7gZTZo3rV
2026-09-10 00:04:35 +04:00

58 lines
2.2 KiB
JSON

{
"name": "event.task.state \u2014 a task fails because the file vanished from the server",
"description": "Carries the summary so the row repaints in full, and the error whenever the new state is failed or retry_wait. Note that error.code is a TaskErrorCode string, not a JSON-RPC code: the RPC that reported this failure succeeded.",
"notification": {
"jsonrpc": "2.0",
"method": "event.task.state",
"params": {
"taskId": "3f7a2b1c-5d6e-4f80-9a1b-2c3d4e5f6071",
"state": "failed",
"previousState": "downloading",
"summary": {
"taskId": "3f7a2b1c-5d6e-4f80-9a1b-2c3d4e5f6071",
"filename": "ubuntu-26.04-desktop-amd64.iso",
"saveDir": "/home/sami/Downloads/Programs",
"url": "https://releases.ubuntu.com/26.04/ubuntu-26.04-desktop-amd64.iso",
"effectiveUrl": "https://releases.ubuntu.com/26.04/ubuntu-26.04-desktop-amd64.iso",
"sizeBytes": 6228541440,
"downloadedBytes": 0,
"state": "failed",
"speedBps": 0,
"etaSeconds": null,
"resumable": true,
"segments": 8,
"categoryId": "programs",
"queueId": null,
"queuePosition": null,
"description": null,
"createdAt": "$isoDate",
"lastTryAt": "$isoDate",
"completedAt": null,
"error": {
"code": "not_found",
"message": "the server returned 404 when resuming; the file is gone",
"httpStatus": 404,
"retryable": false,
"cause": null,
"attempt": 3,
"nextRetryAt": null
}
},
"error": {
"code": "not_found",
"message": "the server returned 404 when resuming; the file is gone",
"httpStatus": 404,
"retryable": false,
"cause": null,
"attempt": 3,
"nextRetryAt": null
}
}
},
"assertions": [
"error is present on every failed or retry_wait transition, and also on a paused transition the daemon entered unilaterally -- never on a paused transition the user or scheduler requested",
"error.code is a TaskErrorCode, never a JSON-RPC ErrorCode \u2014 the two are different spaces",
"retryable false means the scheduler will not pick this up again on its own"
]
}