Skip to content

fix(job): fetch log tail for nested jobs by job id, not dotted runId (#787) - #788

Merged
soustruh merged 3 commits into
mainfrom
claude/issue-787-nested-job-log-tail
Sep 25, 2026
Merged

soustruh merged 3 commits into
mainfrom
claude/issue-787-nested-job-log-tail

Conversation

@padak

@padak padak commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

What

job detail --log-tail-lines N and the serve job log stream now return events for nested jobs (jobs inside a flow, child row jobs of a row-based component). Before, they came back with logTail: [].

Why

A nested Queue job has a dotted runId (<parent>.<child>.<job id>, e.g. 56452146.56453149.56453151). GET /v2/storage/events?runId=<dotted> returns zero events, while the plain job id (56453151) returns the job's events. kbagent sent runId first and assumed runId == id, which only holds for top-level jobs.

How

  • New shared helper resolve_events_run_id(job) in services/job_service.py: the job's own id first, else the last segment of a dotted runId, else "". It keeps the defensive empty return when neither exists.
  • Used by _safe_fetch_log_tail and by the serve SSE log stream (server/routers/jobs.py), the only two callers of fetch_job_events.
  • client.fetch_job_events is unchanged. It still sends the value as the runId filter. Its docstring now says to pass the job id and explains why.
  • gotchas.md: new entry tagged (since vNEXT), and the raw-API hint now says to query by job id.

How tested

  • New unit tests (TestSafeFetchLogTailNestedJobs) cover four cases: dotted runId plus id fetches by id; only a dotted runId uses its last segment; a top-level job with runId == id is unchanged; neither key returns [] with no call.
  • Two existing tests used a synthetic runId ("702-run") that differs from id. Their assertions now expect the job id.
  • Checks run individually with the venv binaries: ruff check, ruff format --check, ty, and the version-gate, command-sync, error-code, sentinel, file-size and changelog checks all pass. Unit suite: 6871 passed. test_build_hook fails only because the local system uv is older than required-version, which is unrelated to this change.
  • Not verified against a live project.

Fixes #787


Devin Review

padak and others added 2 commits September 25, 2026 07:29
…787)

Nested Queue jobs (inside a flow, child row jobs) carry a dotted runId
(<parent>.<child>.<id>) that matches zero Storage events, so logTail came
back empty. Resolve the events key via a shared resolve_events_run_id():
job id first, else the last segment of a dotted runId. Used by the
job service log tail and the serve job log stream.
Two test comments still said that the runId is the lookup key. The
assertions below them expect the job id. The gotcha said that job run
--wait failure tails were affected. job run starts only top-level
jobs, where the runId equals the job id, so they were not affected.
@soustruh
soustruh marked this pull request as ready for review September 25, 2026 20:04

@keboola-pr-reviewer-bot keboola-pr-reviewer-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: auto_approve (risk 2/5) · profile keboola-mcp-server

Well-tested bug fix; correct and low-risk.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +4774 to +4776
## `logTail` was empty for nested jobs

Fixed (since vNEXT). A job inside a flow, or a child row job of a row-based component, has a

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Update the job-debugging playbook

The debugging guidance still suggests a plain job detail followed by job run for logs. Plain detail omits logs; a tail-enabled detail now retrieves them from the existing nested job without rerunning it.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

The keboola-expert tool matrix told agents to start a new run of a
failed job to see its logs. A new run repeats the work, and a writer
can send its data again. job detail --log-tail-lines reads the logs
of the finished job. With this PR it also works for jobs inside a
flow.
@keboola-pr-reviewer-bot
keboola-pr-reviewer-bot dismissed their stale review September 25, 2026 22:24

Dismissing prior approval — a new commit was pushed and this review was for an earlier SHA. Run @keboola-pr-reviewer-bot review to get a fresh verdict.

@keboola-pr-reviewer-bot

Copy link
Copy Markdown

New commit on b494c5a — dismissed 1 stale bot approval. Comment @keboola-pr-reviewer-bot review when you want a fresh review.

@soustruh soustruh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Checked on a real project: for a failed job inside a flow, job detail --log-tail-lines 20 returned 0 events on 0.95.0 and 20 events on this branch, including the failure reason. CI is green.

@soustruh
soustruh merged commit 2342bba into main Sep 25, 2026
4 checks passed
@soustruh
soustruh deleted the claude/issue-787-nested-job-log-tail branch September 25, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

job detail --log-tail-lines returns an empty log for nested jobs (events queried by dotted runId)

3 participants