Repository navigation
Speak the upstream runner's protocol: job outputs, per-job logs, gh host, annotations - #34
Conversation
PR Summary by QodoAlign runner protocols for outputs, logs, gh, and annotations
AI Description
Merge Risk
|
|
🤖 Finished Review · ✅ Success · Started 10:44 PM UTC · Completed 10:55 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $5.05 |
Code Review by Qodo
1.
|
|
Risk Assessment: moderate (2/5) DetailsModerate risk change with 13 files and 867 lines touching runner protocol endpoints, balanced by zero protected path changes, no dependency modifications, 31% test file ratio, and alignment with linked tracking issue scope. Previous runRisk Assessment: moderate (2/5) DetailsModerate risk change with 13 files and 867 lines touching runner protocol endpoints, balanced by zero protected path changes, no dependency modifications, 31% test file ratio, and alignment with linked tracking issue scope. Previous run (2)Risk Assessment: moderate (2/5) DetailsModerate risk change with 12 files and 805 lines touching runner protocol endpoints, balanced by zero protected path changes, no dependency modifications, and 33% test coverage. |
ReviewFindingsMedium
Low
Next steps:
Previous run<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJtZWRpdW0iLCJjYXRlZ29yeSI6ImF1dGgtYnlwYXNzIiwiZmlsZSI6InNyYy9hcHAvYXBpL2FjdGlvbnNfZGlzdHJpYnV0ZWRfdGFzay5weSIsImlkIjoiZl8xMWUyMDg0YjQzZjlmOGQzIiwibGluZSI6MTUyNSwiYWN0aW9uYWJsZSI6dHJ1ZSwiZGltZW5zaW9uIjoic2VjdXJpdHkifSx7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJiYWNrd2FyZC1pbmNvbXBhdGlibGUiLCJmaWxlIjoic3JjL2FwcC9hcGkvYWN0aW9uc19kaXN0cmlidXRlZF90YXNrLnB5IiwiaWQiOiJmXzEyNWI1ZDRkOTBjZDVkYWMiLCJhY3Rpb25hYmxlIjpmYWxzZSwiZGltZW5za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M0MjBhZCIsImFjdGlvbmFibGUiOmZhbHNlLCJkaW1lbnNpb24iOiJjcm9zcy1yZXBvLWNvbnRyYWN0cyJ9LHsic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6ImJhY2t3YXJkLWluY29tcGF0aWJsZSIsImZpbGUiOiJzcmMvYXBwL2FwaS9hY3Rpb25zX2Rpc3RyaWJ1dGVkX3Rhc2sucHkiLCJpZCI6ImZfOWI3MjQxNjQyOGZjZjczMCIsImFjdGlvbmFibGUiOmZhbHNlLCJkaW1lbnNpb24iOiJjcm9zcy1yZXBvLWNvbnRyYWN0cyJ9XX0= --> ReviewFindingsMedium
Low
Labels: PR fixes upstream-runner protocol bugs Next steps:
|
|
On the three low notes:
All of this is in the bug notes. |
|
🤖 Finished Review · ✅ Success · Started 11:05 PM UTC · Completed 11:16 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.22 |
jctanner
left a comment
There was a problem hiding this comment.
Approving with nits — with one merge-order requirement: this must land after #31 (or adopt its validate_job_token in _job_from_token_value), because at this head the timeline/log/feed routes still accept forged job tokens while the new plan-events route does verify them. Everything else checks out: plan v8 + jobOutputs + the events resource, per-job logs with real paths, {count, value} timeline answers, GH_HOST mirroring, EnhancedAnnotations, and the job-token lifetime fix (which also resolves #31's long-job expiry finding). Nits: the two event tests the bot asked for are there; consider a follow-up for the bash-PATH lookup having no dedicated test.
58af4a8 to
3ed7592
Compare
|
🤖 Finished Review · ✅ Success · Started 5:23 PM UTC · Completed 5:35 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $4.15 |
The upstream runner evaluates a job's outputs: itself and reports them only in the JobCompleted plan event, so on that path every needs.<job>.outputs.<name> rendered empty: - the job message carried no jobOutputs template; - it declared plan version 1, and the worker raises JobCompleted only from plan version 8 (PlanUtil.GetFeatures); - the plan events resource was neither advertised nor served. Send the declared outputs as a jobOutputs template, declare plan version 8, and serve the plan events resource. JobCompleted, accepted from the job's own token, stores the job's non-secret outputs and then completes the job: at version 8 the listener no longer finishes the job request, so this releases the jobs that need it with the outputs in place. The event route checks the job token's signature and expiry (validate_job_token), and takes the event only for a job in progress: a repeat after completion, or an event for a job queued again, changes neither its outputs nor its result. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
- Find the job from the job token, not from the plan. A plan is the whole
run, so with two jobs running one job's console lines and step states
went to the other, and the first job's log was missing.
- Answer log creation with the log's path and a distinct id. The worker's
TaskLog requires a path, so every step-log upload threw.
- Keep uploaded step logs in their own files beside the job log, which
the console feed already writes, so lines are not doubled.
- Answer timeline updates with {count, value}. The worker reads a
collection wrapper and treated a bare array as a failed update.
Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
gh ignores GITHUB_API_URL, so on the upstream-runner path every gh call in a step went to api.github.com with the emulator's job token and failed with "Bad credentials". Set GH_HOST for every step, and mirror the token the step chose (GH_TOKEN or GITHUB_TOKEN, as the same expression) into GH_ENTERPRISE_TOKEN, which gh reads for any host but github.com. No token is added to a step that named none, and what a workflow sets itself wins. The Python runner already does both. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
The Python runner always used /bin/bash. On macOS that is bash 3.2,
which rejects bash 4 syntax (;;&, ${var,,}) that GitHub-hosted runners
accept. actions/runner resolves bash from PATH; do the same and fall
back to /bin/bash.
Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
actions/runner processes `::notice::` only when the job message turns on DistributedTask.EnhancedAnnotations (ActionCommandManager: "Enhanced Annotations not enabled on the server: 'notice' command will not be processed"). GitHub sends it, and documents notice as a workflow command beside warning and error. The emulator did not, so on the upstream runner a `::notice::text` line stayed raw in the job log instead of `##[notice]text`, while `::warning::` and `::error::` rendered. The emulator's own Python runner already renders all three. The job request message now sets the variable to "true". Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
GitHub's job token is valid until the job ends. Here it expired an hour after it was issued, and from plan version 8 only the JobCompleted event completes a job, so a job that ran longer than an hour reported its completion with an expired token, got 401, and stayed in progress with its runner busy. The token now lives for the job's timeout-minutes (default 360) plus 5 minutes for the completion report, at most 24 hours. The job's timeout is not stored with the job, so the default applies. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
Rebased onto #31, every other job-server route answers 404 for a plan that is not the job's own run; the plan events route now does too. validate_job_token comes from the module-level import #31 added. #31's route-target test counts the per-step log files this change writes, since uploads no longer append to the console log. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
3ed7592 to
d291354
Compare
|
🤖 Finished Review · ✅ Success · Started 6:01 PM UTC · Completed 6:26 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.53 |
#34's plan-events route completed only a job still in progress. A job cancelled while it ran is already completed, so its JobCompleted event returned early and its runner stayed busy for good. A cancelled job now reaches _complete_job too, which keeps the cancelled conclusion and frees the runner; its outputs are left unchanged. A queued job, or a job completed otherwise, still returns early. The report goes through _report_job_end, so it runs under the runner's lock and leaves a job that moved off the runner as it is, as the other report routes do. Test: test_job_completed_for_a_cancelled_job_frees_the_runner, from the combined validation branch. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
|
Review skipped — this PR is already merged. The Posted by fullsend post-review check |
Part of #39
Five fixes that make the upstream actions/runner behave as it does against GitHub. On GitHub this runner gets job outputs, per-job logs, a working
ghand::notice::lines. On the emulator it got none of these. The emulator's Python runner gets one small fix as well.What it fixes
needs.<job>.outputs.<name>carries the value the job setjobOutputstemplate in the job message, plan version 1 (the worker only raisesJobCompletedfrom version 8), and no plan events resourceghin a stepghtalks to the server the job came fromghignoresGITHUB_API_URL, so it went to api.github.com with the job token: "Bad credentials"::notice::##[notice]DistributedTask.EnhancedAnnotationsbashonPATH/bin/bash, which on macOS is bash 3.2 and rejects bash 4 syntaxChanges
src/app/api/actions_distributed_task.py:jobOutputs, declares plan version 8, and serves the plan events resource.JobCompletedstores the outputs and completes the job. The route takes it only with a valid job token for that job (validate_job_token: signature and expiry) and only while the job is in progress;{count, value};GH_HOSTfor every step and mirrors the step's chosen token intoGH_ENTERPRISE_TOKEN. A step that names no token gets none, and a workflow's own value wins;DistributedTask.EnhancedAnnotations.src/runners/emulator/runner.py: resolvesbashfrom the step'sPATH, falling back to/bin/bash.docs/bugs/fixed/, and itsPLAN.mdline.Tests
tests/actions/test_runner_job_outputs.py(10),tests/actions/test_runner_job_logs.py,tests/actions/test_runner_gh_host.py(6). They check routes, fields and variables the old code did not have. The two event tests (a repeatedJobCompleted, a token whose signature does not match) were each run against the code without their check and fail there.tests/actions/test_execution.pychecksGH_HOSTandEnhancedAnnotationsin the job message.PATHbash is/bin/bash.ci.yml).Effect on existing behaviour
ghor::notice::sees no difference, except that its logs now land on the right job.JobCompletedto finish a job, because plan version 8 stops the listener from finishing the job request.