Skip to content

chore(agents): teach the test and merge-queue skills about clock-granularity flakes - #93157

Merged
trunk-io[bot] merged 2 commits into
masterfrom
chore/skills-clock-granularity-flakes
Sep 14, 2026
Merged

trunk-io[bot] merged 2 commits into
masterfrom
chore/skills-clock-granularity-flakes

Conversation

@pauldambra

Copy link
Copy Markdown
Member

Problem

Anyone triaging a merge-queue failure, or writing a test that pins "as of" a timestamp, can repeat what happened to #92922 this morning: a warehouse-sources test that depends on two back-to-back writes having distinguishable timestamps failed 3/3 attempts on the queue runner, passed on master at the same base SHA, and Trunk's bisection blamed a cohorts-only PR. The fix is #93155; this PR captures what the skills were missing so the next agent (or person) recognises the shape faster.

Three gaps showed up:

  • /writing-tests warns about frozen clocks but not about deriving a cutoff from a previous write's recorded time, or about libraries that read a different clock than the one you sampled (delta-rs time travel uses commit-file mtimes, not history() timestamps).
  • /fixing-flaky-tests treats "fails every attempt" as a deterministic regression and "doesn't reproduce locally" as the end of empirical validation. An environment-dependent race (Linux coarse mtime clock vs macOS nanoseconds) does both, and can usually be forced locally.
  • /triaging-merge-queue-failures and /debugging-ci-failures describe batch branches as "master plus every PR ahead" and tell the reader the other merge commits are the first suspects. A -bisection branch carries only master plus the one PR, so that heuristic points at the wrong thing there. Neither mentions that products/warehouse_sources/junit-product.xml bypasses the Trunk quarantine gate, so a known flake in that product still reds the shard.

Changes

Skill text only; no code.

  • writing-tests: new determinism rule, "Two writes in a row are not ordered in time", with the delta-rs example and the fix shape (stamp the times explicitly, minutes apart, cutoff between them).
  • fixing-flaky-tests: step 1 gains the "every rerun fails here, master passes the same code" case and the free control a trunk-merge/** PR body provides (its base SHA); step 3 says to ask what the runner has that the laptop lacks and to force the condition before giving up on empirical validation; the step 4 table and the pytest cause list get the clock-granularity row.
  • triaging-merge-queue-failures: Trunk behaviour notes on bisection (and why "failed every attempt" is not evidence either way) and on the warehouse-sources quarantine exclusion.
  • debugging-ci-failures: the bisection exception to "other merge commits are the first suspects".

How did you test this code?

Ran markdownlint-cli2 with the repo config and prettier --check on the four edited files. The guidance itself is what I followed to diagnose #92922, written down after the fact; the evidence for each claim is linked from #93155.

Automatic notifications

  • Publish to changelog?

Docs update

None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code (Fable 5.1), same session as #93155. After the fix, the user asked whether any repo skills needed updating to avoid a repeat; I read the four skills that cover this path and added only what the incident showed was missing. No repo skills were invoked.

🤖 Generated with Claude Code

@pauldambra pauldambra self-assigned this Sep 2, 2026
@trunk-io

trunk-io Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-02T09:57:22.462824Z df08cf4 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

✅ Trunk lane — non-backend lane (agents)

This PR is assigned to the non-backend lane (agents). It does not run backend Python tests and may merge in parallel with PRs in other lanes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df08cf4068

ℹ️ 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".

@pauldambra pauldambra added the stamphog Request AI approval (no full review) label Sep 2, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not approved — escalated to a human reviewer.

Re-add the stamphog label to request another review once you have addressed this.

Documentation-only change with no production risk, but Codex left two unresolved current-head inline comments — one flagging that the new bisection-triage heuristic could wrongly absolve a PR that broke a test via shared code/config rather than an environment race, the other flagging an unverified gh api pagination detail — and neither has been addressed or rebutted.

  • chatgpt-codex-connector[bot] reviewed the current head.
  • Unresolved P1 Codex comment on triaging-merge-queue-failures/SKILL.md: the bisection-triage rule may incorrectly clear a PR that deterministically broke a test through shared code/fixtures rather than an environment race.
  • Unresolved P2 Codex comment on fixing-flaky-tests/SKILL.md: the suggested gh api check-runs command lacks pagination and may miss the relevant shard on SHAs with many checks.
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 0L, 0F substantive, 20L/4F incl. docs/generated/snapshots — within ceiling
tier ✓ T0 auto-approve: T0-deterministic (20L, 4F, single-area, chore)
stamphog 2.0.0b4 .stamphog/policy.yml @ df08cf4 · reviewed head df08cf4

@stamphog stamphog Bot removed the stamphog Request AI approval (no full review) label Sep 2, 2026
…ularity flakes

A warehouse-sources test that pinned a Delta snapshot at the previous write's
history() timestamp failed 3/3 attempts on the queue runner, passed on master
at the same base SHA, and Trunk's bisection blamed an unrelated PR (#92922,
fixed in #93155). The skills covering that path had three gaps: no rule
against deriving a cutoff from an earlier write's recorded time, no
recognition that an environment-dependent race fails every rerun yet passes
elsewhere, and no account of Trunk's bisection branches or of the
warehouse-sources exclusion from the quarantine gate.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@pauldambra
pauldambra force-pushed the chore/skills-clock-granularity-flakes branch from 8566f1d to 8676a09 Compare September 2, 2026 11:21
@pauldambra pauldambra added the stamphog Request AI approval (no full review) label Sep 3, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review did not complete.

Stamphog hit an error and produced no verdict for this commit.

Push a new commit to try again.

# Conflicts:
#	.agents/skills/fixing-flaky-tests/SKILL.md

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Pure documentation edit to four skill guide files describing CI/flaky-test triage heuristics — no code, config, or CI behavior changes, so no risky territory is touched.

Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 0L, 0F substantive, 20L/4F incl. docs/generated/snapshots — within ceiling
tier ✓ T0 auto-approve: T0-deterministic (20L, 4F, single-area, chore)
stamphog 2.0.0b4 .stamphog/policy.yml @ ad11944 · reviewed head ad11944

@trunk-io
trunk-io Bot merged commit 9bde713 into master Sep 14, 2026
197 checks passed
@trunk-io
trunk-io Bot deleted the chore/skills-clock-granularity-flakes branch September 14, 2026 12:19
@deployment-status-posthog

deployment-status-posthog Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-09-14 12:41 UTC Run
prod-us ✅ Deployed 2026-09-14 12:55 UTC Run
prod-eu ✅ Deployed 2026-09-14 13:04 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant