Skip to content

fix(mention): measure queue delay before checkout and setup - #1364

Closed
tend-agent wants to merge 1 commit into
mainfrom
fix/issue-1363
Closed

tend-agent wants to merge 1 commit into
mainfrom
fix/issue-1363

Conversation

@tend-agent

@tend-agent tend-agent commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Compute queue delay rendered after <<checkout(cfg)>> and <<setup>> in the mention template, so the figure it wrote to steps.delay.outputs.seconds was event → (runner allocated + checkout + every setup: step), not event → job start. The prompt then tells the agent "over ~40s means it was queued", so a repo whose setup: does an apt-get, a container pull, or a dependency build has that time reported to every mention session as queue time — a systematic overstatement that neither averages out across runs nor stays comparable between repos.

0.2.14 widened it: sandbox_setup: commands used to run inside the agent step, downstream of the measurement, and config.py now appends them as a setup: step, which moves them upstream of it. A repo that migrated and changed nothing else sees its measured delay grow.

The step reads only EVENT_TS — the event payload or needs.verify.outputs.ts — and its output is consumed further down in agent_step, so it now renders ahead of the checkout and setup blocks. The reaction step stays first so the eyes still go on promptly; its single gh api call is ~1s against a 40s threshold.

What the reorder removes is the repo-variable part. A fixed pipeline cost stays inside the figure and this PR doesn't address it: handle is gated on verify, so the measurement still spans both jobs' runner allocation plus verify's own astral-sh/setup-uv and engagement check, and on the relayed-review arm the tend-mention-relay run as well. On six consecutive tend-mention runs here (2026-09-21) that came to 10–18s from run creation to handle's first step, which leaves headroom under the ~40s threshold but is not the zero the threshold implicitly assumes.

test_mention_queue_delay_measures_to_job_start_not_past_setup generates the mention workflow with a setup: step and asserts the delay step precedes both the checkout and the setup step; it fails before the reorder and passes after. The four [mention] regtest fixtures are regenerated, and their diffs are the step move alone.

Closes #1363 — automated triage

`Compute queue delay` rendered after `<<checkout>>` and `<<setup>>`, so the
number handed to the agent was event -> (runner allocated + checkout + every
`setup:` step) rather than event -> job start. The step has no dependency on
either, so it now renders ahead of both.

Closes #1363
max-sixty added a commit that referenced this pull request Sep 21, 2026
The mention handle job's prompt tells the agent it was queued when the
delay between the triggering event and the job's start exceeds ~40s. The
step that measures it ran after checkout and `setup:`, so the delay
counted the consumer's setup as queue time. In worktrunk, whose setup
installs cargo tools, shells and Nix, two mentions that weren't queued
reported 59s and 44s: their handle jobs started 19s and 13s after the
runs were created
([35614904598](https://github.com/max-sixty/worktrunk/actions/runs/35614904598),
[35611849540](https://github.com/max-sixty/worktrunk/actions/runs/35611849540)).
numbagg's bot review of numbagg/numbagg#831 raised it, since that PR
moved `uv sync` ahead of the step.

The step now runs before checkout, so it measures only the wait for the
job to start, which is what the prompt and CLAUDE.md describe.
`test_mention_handle_has_queue_delay` now generates with a `setup:` step
and asserts the delay step precedes both checkout and that step; the
mention snapshots move the step.

Closes #1363. Supersedes #1364, the same fix.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner

Superseded by #1365, which merged the same reorder with this PR's setup:-step assertion folded into test_mention_handle_has_queue_delay.

This was written by Claude Code on behalf of max-sixty

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.

Compute queue delay runs after checkout and setup:, so setup time is reported to the agent as queue time

2 participants