Skip to content

jobs: a refused job keeps its refusal as data (error_detail) - #107

Merged
thorwhalen merged 2 commits into
mainfrom
feat/refusal-detail
Oct 13, 2026
Merged

thorwhalen merged 2 commits into
mainfrom
feat/refusal-detail

Conversation

@thorwhalen

@thorwhalen thorwhalen commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

GenreOpRefused takes an optional detail mapping. A job that raises it records it as Job.error_detail (JSON round-tripped; durable across a runtime reset; on to_dict and summarize). Only a refusal carries one.

Why: reeleehq/reelee#570. reelee's spend cap refuses a queued job when it starts, and reelee-web currently recognises that by matching the operator sentence in error and parsing the figures out of it.

Tests: test_a_refused_job_keeps_its_refusal_as_data, test_only_a_refusal_carries_a_detail, plus doctests.

Adversarial review: FIX-FIRST, fixed. (1) a key echoed into detail was persisted unredacted: error_detail_of now redacts every string of the detail with the job's secrets (test test_a_refused_job_never_persists_a_key_quoted_in_its_detail, negative-controlled); (2) NaN/inf passed the round trip and would make every response carrying the job unserialisable: strict JSON (allow_nan=False) drops such a detail. Also: a non-mapping detail is ignored instead of raising in the constructor, and the read path takes only the redacted detail the worker recorded.

🤖 Generated with Claude Code

thorwhalen and others added 2 commits October 13, 2026 15:47
GenreOpRefused takes an optional detail mapping; a job that raises it
records it as Job.error_detail (JSON round-tripped, durable, on to_dict and
summarize), so a host reads a refusal's figures without parsing the
sentence in error. First customer: reelee's spend cap (reeleehq/reelee#570).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nore a non-mapping detail (review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thorwhalen
thorwhalen merged commit 0fb927a into main Oct 13, 2026
12 checks passed
@thorwhalen
thorwhalen deleted the feat/refusal-detail branch October 13, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant