feat(runners): add runner_id to db for task#3712
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f31f8fb142
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if tsk == nil { | ||
| continue | ||
| var err error | ||
| tsk, err = taskPool.HydrateTaskRunnerFromDB(job.ID) |
There was a problem hiding this comment.
Reject runner updates for tasks that already left the pool
When a remote task finishes it is removed from TaskPool, so this new HydrateTaskRunnerFromDB fallback also rehydrates already-finished tasks from the database. In that case TaskRunner.SetStatus in services/tasks/TaskRunner_logging.go returns immediately for success/fail/stopped, but this handler still executes LogWithTime and SetCommit, so any delayed or retried runner PUT can append output or overwrite commit metadata on a completed task. This shows up in HA/load-balanced setups where the last progress request lands after the owning node has already stopped tracking the task.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Summary
- Updated
RunnerController.UpdateRunnerto ignore runner progress payloads once the matched task is already in a finished state, preventing delayed log writes or commit metadata updates from mutating completed tasks. api/runners/runners.goL275-L299 - Added a regression test that exercises a late runner update against a finished task and verifies the handler returns
204 No Contentwithout changing the stored commit metadata. api/runners/runners_test.goL27-L87 - Committed the follow-up fix on the current branch as
4cce352and recorded a PR title/body for the new follow-up PR. api/runners/runners.goL280-L287 api/runners/runners_test.goL27-L87
Testing
- ✅
gofmt -w api/runners/runners.go api/runners/runners_test.go - ✅
git commit -m "fix(runners): ignore late updates for finished tasks" - ✅
go test ./pkg/task_logger -run TestDoesNotExist -count=1 ⚠️ timeout 30s go test ./api/runners -run '^$' -count=1 -timeout 20s; echo EXIT:$?— timed out in this environment withEXIT:124.⚠️ timeout 30s go test ./api/runners -run TestUpdateRunnerIgnoresFinishedTaskUpdates -count=1; echo EXIT:$?— timed out in this environment withEXIT:124.
No description provided.