fix(server): route HTTP-submitted job logs into the per-job file#133
Merged
Conversation
JobRunner.submit forks each job with `.forkIn(layerScope)`, so the job inherits `currentLoggers` from the submitting fiber. zio-http request handlers (every `ccas <cmd>` CLI call) run outside ProgressDisplay's `withLoggerScoped` tree, carrying only the default logger — so the job logged via the default logger and `asZLogger` never wrote the per-job FileSink. The file stayed empty, so the CLI's log follow showed nothing after "<slug> submitted: <id>". Scheduler-submitted jobs were fine (their fiber is inside the scope), which is why this only surfaced for membership after #130 made it actually log. Add ProgressDisplay.installLogger (removeDefaultLoggers + withLoggerScoped(asZLogger)) and wrap every job with it in JobRunner.submit, so a job logs through asZLogger into its per-job file regardless of which fiber submitted it. HTTP- and scheduler-submitted jobs now log identically. TestJobRunner's shared layer switches from ProgressDisplay.live to ProgressDisplay.make (no ambient logger), reproducing the HTTP default-logger context; its three per-job-log assertions fail without the fix and pass with it. Closes #132 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ETHm6wCYdzFuB3kNEBayjF
This was referenced Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
HTTP-submitted jobs (every
ccas <cmd>CLI call →POST /api/jobs/*) wrote an empty per-job log (${JOB_LOGS_DIR}/<id>.log), so the CLI's log follow showed nothing after<slug> submitted: <id>.Root cause:
JobRunner.submitforks each job with.forkIn(layerScope); the forked fiber inheritscurrentLoggersfrom the submitting fiber. zio-http request handlers run outside ProgressDisplay'swithLoggerScopedtree, so they carry only the default logger — the job logged via the default logger andasZLogger(the only logger that writes the per-job FileSink) never fired. Scheduler-submitted jobs (ClubData/MatchRef) were unaffected because the scheduler fiber is inside the scope — which is why this only surfaced for membership after #130 made it actually log.ProgressDisplay.installLogger—removeDefaultLoggers + withLoggerScoped(asZLogger), applied inline; forces{asZLogger}onto the wrapped effect and its forked children.JobRunner.submitwraps every job withdisplay.installLogger(...), so HTTP- and scheduler-submitted jobs log identically..ensuringfinalizer extracted as a namedrelease;*>chains converted to for-comprehensions.Fixes
Closes #132 (follow-up to #129/#130)
Testing
TestJobRunnershared layer switchedProgressDisplay.live→ProgressDisplay.make(no ambient logger), reproducing the HTTP default-logger context. The three per-job-log assertions (testSubmitWritesJobLog,testLogStreamReplaysCompletedJob,testLogStreamTailsLiveJob) now guard HTTP-submitted jobs write empty per-job logs — JobRunner forks inherit the request handler's default logger, not ProgressDisplay's #132.sbt test(pre-push): 953 passed, 0 failed.🤖 Generated with Claude Code
https://claude.ai/code/session_01ETHm6wCYdzFuB3kNEBayjF