Skip to content

feat(taskproto): add phase-timestamp markers to the wrapper log (#571) - #574

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/571-wrapper-phase-timing
Sep 5, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/571-wrapper-phase-timing

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Closes #571.

completion.json's started_at/ended_at were the only two timestamps a task had, so stage-in, the Docker install, the image pull, the user command, and stage-out were one opaque interval. Measured on a real task (cookbook-relion-postprocess-r1): a 94s command window contained 25s of actual work and ~69s unattributable to any of the three plausible causes.

spawn_phase() now logs a spawn: [<timestamp>] <phase> line at each real boundary: wrapper start, stage-in start/done, (container tasks only) Docker install start/done and image pull start/done, command start/exit, stage-out start/done. Plain text on command.log's existing stdout rather than a new structured artifact — nothing parses that log today, so this can't break a consumer. The rc= on each "done" marker is also a diagnostic for #566: it shows how far the wrapper got before a failure that produced no completion record at all.

This is the patch attached to #571 by the issue's own reporter — verified byte-for-byte identical to the diff in the issue, already reported as built/gofmt-clean/tested against v0.103.1. This PR adds the three tests the report explicitly left out:

  • TestGenerateWrapper_PhaseMarkersHostPath — every marker present (and Docker-specific ones absent) on the host path, in the correct order
  • TestGenerateWrapper_PhaseMarkersContainerPath — every marker present, including Docker-specific ones, in the correct order
  • TestGenerateWrapper_PhaseMarkersHelperDefinedBeforeFirstUse — spawn_phase() is defined before its first call site

All three verified fail-without/pass-with (reverted wrapper.go via git stash, confirmed all three fail with clear "marker not found" messages, restored, confirmed pass). Full pkg/taskproto suite (41 tests) green, make check clean, docs-gen unchanged (no flag/help text touched), no nested lambda module drift.

completion.json's started_at/ended_at were the only two timestamps a task
had, so stage-in, the Docker install, the image pull, the user command,
and stage-out were one opaque interval. Measured on a real task: a 94s
command window contained 25s of actual work and ~69s unattributable to
any of the three plausible causes.

spawn_phase() now logs a 'spawn: [<timestamp>] <phase>' line at each real
boundary, plain text on command.log's existing stdout rather than a new
structured artifact (nothing parses that log today). The rc= on each
'done' marker also helps diagnose #566: it shows how far the wrapper got
before a failure that produced no completion record at all.

Patch contributed via the #571 issue report, verified byte-for-byte
against the attached diff; this commit adds the three tests the report
explicitly left out (host-path markers, container-path markers including
Docker-specific phases, and the spawn_phase() define-before-use ordering).
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 86c6c48 into main Sep 5, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/571-wrapper-phase-timing branch September 5, 2026 01:18
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.

completion.json has only started_at/ended_at, so a task's setup cost is unattributable: add phase timestamps to the wrapper log (patch included)

1 participant