Skip to content

Every arq job logs its end and runs in its enqueuer's trace; request lines carry sub - #3280

Merged
FlexOr2 merged 8 commits into
mainfrom
claude/issue-3279-every-job-step-logs-its-end-and-an-arq-j
Nov 18, 2026
Merged

FlexOr2 merged 8 commits into
mainfrom
claude/issue-3279-every-job-step-logs-its-end-and-an-arq-j

Conversation

@FlexOr2

@FlexOr2 FlexOr2 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Work-Item: #3279
Closes #3279

Each arq job and cron is wrapped at registration: one arq_job.ended line (StepTimer: job_function, job_id, duration_ms, outcome), run inside unit_trace. serialize_arq carries the enqueuer's traceparent in the job kwargs. authenticate_request calls set_sub with the account id (the Keycloak subject). The dead structlog contextvar bindings in the jobs and workers are gone.

Co-writer turn: it is an HTTP SSE request (no WebSocket), already inside its request trace, so unit_trace does not fit; nothing to build.

scoring/subprocess_runner.py still binds structlog contextvars in the scorer child (not touched).

Routing: build sonnet/medium; fix sonnet/high; review sonnet/high; test sonnet/medium; gate none; land haiku/low. Fix rounds: 3. Blocking: src/songmaker_cli/music_worker.py:188 → review; music_worker.py:155 → review; song-title-in-generate-log → test; src/songmaker_cli/generation_api.py:308 → ci; SonarCloud Code Analysis → ci

Follow-ups: outcome of failed/cancelled jobs, docs/architecture.md logline paragraph, scorer plain-text tracebacks, co-writer turn trace -> #3254

🤖 Generated with Claude Code

FlexOr2 and others added 8 commits November 18, 2026 00:15
… outcome

The jobs bound structlog context variables that logline's records never carry, so no
job line named its job. The worker registration wraps each job and cron in logline's
StepTimer; the dead bindings go.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
serialize_arq carries the enqueuer's traceparent in the job's keyword arguments; the
job wrapper runs the job inside logline's unit_trace, which detaches when the job ends.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…wrapped method's owner

The explicit cron names changed every cron job's arq id; the default derives from the wrapped method's qualname. The singleton-method pins read __self__, which the logged wrapper does not carry. The arq codec outcome test also runs a job without arguments, which logs no job id.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The title is content; the logline standard keeps content out of logs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…equest

Sonar flagged the request path id and model name in the log call as log
injection. The song id now comes from the loaded song and the model id from
the active model row the request matched.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@FlexOr2
FlexOr2 merged commit 11d319a into main Nov 18, 2026
33 checks passed
@FlexOr2
FlexOr2 deleted the claude/issue-3279-every-job-step-logs-its-end-and-an-arq-j branch November 18, 2026 00:05
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.

Every job step logs its end and an arq job runs in its enqueuer's trace

1 participant