Repository navigation
fix(execution): only attribute timeout when elapsed reached the configured limit - #2752
Merged
vybe merged 2 commits intoSep 14, 2026
Merged
Conversation
louisss1016
force-pushed
the
feature/2106-timeout-attribution
branch
from
September 13, 2026 09:44
1c6a696 to
277cb78
Compare
vybe
pushed a commit
that referenced
this pull request
Sep 14, 2026
…e is refused (#2767) (#2769) `issue-status-on-merge.yml` ran on `pull_request`, where a PR opened from a FORK gets a read-only `GITHUB_TOKEN`. Every label write was refused with "Resource not accessible by integration", the issue stranded in `status-in-progress` with its fix already on `dev` — and the run reported SUCCESS, because the refusal was a `core.warning`. It only ever bit external contributors, i.e. exactly the PRs nobody is watching the label on (observed 2026-09-14: #2752 merged, #2106 relabelled by hand). Two changes. **`pull_request_target`**, which runs in the base repo's context and so carries the write token the `permissions:` block already asks for. That trigger is the standard privilege-escalation footgun, so the reasoning is written next to it rather than left implicit: the escalation always takes the form "check out the stranger's code, then execute it", and this workflow does neither — no `actions/checkout`, no `run:` steps, and the only untrusted values (`pull_request.title` / `.body`) reach exactly one regex that extracts `\d+`. The residual capability is bounded to what the feature does anyway — a MERGED PR names which issue numbers get relabelled — and `pull_request_target` runs the base branch's copy of the workflow, so a fork cannot edit this file to widen that. **A refused write now fails the job.** Failures are collected rather than thrown at the first miss, so one unlabelable issue cannot strand the others, and `core.setFailed` runs after the loop naming every issue that still needs a manual fix. A `removeLabel` 404 stays a non-failure — an issue that was never picked up simply has no label to remove. `tests/unit/test_2767_issue_status_fork_prs.py` guards both safety properties in the shape of `test_1896_integration_nightly_workflow.py`. Mutation-tested, each caught: reverting the trigger, adding an `actions/checkout`, adding a `run:` step, and downgrading `setFailed` back to `warning`. Note for reviewers of the test: the guards strip comment lines before asserting. Without that, a comment saying "there is NO actions/checkout" satisfies the checkout check and "collected, not thrown" satisfies the throw check — the guard would pass because of the sentence claiming the property instead of the property. Both bit me while writing it. Fixes #2767 Claude-Session: https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This was referenced Sep 14, 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.
Fixes #2106
Problem
execute_tasklabelled everyhttpx.TimeoutExceptionasTask execution timed out after N secondsregardless of elapsed time. Per the issue evidence, 16 of 30 timeout-labelled executions ran nowhere near the configured limit (9 ran ~305s against 2700/3600/2400s limits). The label misdirects operators (raising timeouts that were never hit) and corrupts aggregate failure analysis.Change
_classify_timeout_failure(elapsed_s, timeout_seconds, *, exc)insrc/backend/services/task_execution_service.py.elapsed_s >= timeout_seconds - 30(30s grace, matching the issue's "within 30s" definition). Otherwise the failure is recorded asTask execution aborted after {elapsed}s of {limit} allowedwith aNETWORKerror code and the real exception class name — the configured limit stays as context, not as cause.error_codenow flows from the classifier into the returnedTaskExecutionResult.Tests
tests/unit/test_2106_timeout_attribution.py— 7 tests: classifier unit tests (including the issue's headline case: 305s elapsed vs 2700s limit → NOT a timeout) plus 2execute_taskbranch tests driving both sides of the new branch.Verification
tests/testkit, unavailable in a shallow clone, excluded): 1909 passed, 5 skipped, 0 failures.lint_sys_modules.py,lint_root_test_placement.py): pass.Command (Windows, Python 3.12):
python -m pytest tests/unit/test_2106_timeout_attribution.py --confcutdir=tests/unit -q -p no:cacheprovider