Skip to content

test(#5707): fix missing harness agent fixtures and timeout diagnostics - #5714

Closed
ifireball wants to merge 2 commits into
fullsend-ai:mainfrom
ifireball:fix/5707-harness-agent-timeouts
Closed

test(#5707): fix missing harness agent fixtures and timeout diagnostics#5714
ifireball wants to merge 2 commits into
fullsend-ai:mainfrom
ifireball:fix/5707-harness-agent-timeouts

Conversation

@ifireball

Copy link
Copy Markdown
Member

Summary

  • Behaviour custom harnesses reference agent: agents/triage.md, but scaffold agents were removed in Step 7: Remove scaffold agent fallback infrastructure #5552. Clean pool repos fail at runtime with stat .../.fullsend/agents/triage.md: no such file, upload no artifact, then WaitForHarnessAgent times out opaquely after ~12 minutes.
  • Commit a minimal agent (and policy) fixture under .fullsend/ when registering a custom harness via givenCustomHarness (same helper already used for URL-sourced harnesses).
  • Improve WaitForHarnessAgent: fail fast when a completed non-success workflow run exists after ScenarioStart without a success artifact, and include recent run id/conclusion/URL diagnostics on timeout.

Hypothesis (from main run forensics)

Run https://github.com/fullsend-ai/fullsend/actions/runs/30408887762 leased halfsend-01/test-repo-09. Harness did run (https://github.com/halfsend-01/test-repo-09/actions/runs/30408975596) and failed on missing triage.md; no artifact → opaque behaviour timeout. Most pool repos still have stale leftover agents, so failures are intermittent.

What behaviour CI should confirm

  • Dispatch / fork / URL-local harness scenarios no longer time out on clean repos for missing agents/triage.md.
  • If a harness still fails for another reason, the step error should cite the failed workflow run conclusion/URL instead of only did not complete successfully.

Fixes #5707

Test plan

  • go test ./pkg/behaviourtest/steps/ ./pkg/behaviourtest/drivers/ci/githubactions/
  • staged make lint
  • Behaviour job on this draft PR (needs ok-to-test for fork PRs)

Made with Cursor

…t diagnostics

Behaviour custom harnesses still reference agents/triage.md after scaffold
agents were removed (fullsend-ai#5552). Clean pool repos fail with a silent artifact
timeout. Commit a minimal agent fixture during harness registration, and
fail-fast WaitForHarnessAgent with recent workflow-run diagnostics when a
completed non-success run has no artifact.

Signed-off-by: Barak Korren <bkorren@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Jul 29, 2026

Copy link
Copy Markdown

🤖 Review · ⚠️ Cancelled · Started 1:07 PM UTC · Ended 1:18 PM UTC
Commit: 2b35317 · View workflow run →

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.08955% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...iourtest/drivers/ci/githubactions/githubactions.go 77.35% 6 Missing and 6 partials ⚠️

📢 Thoughts on this report? Let us know!

…-fast

Concurrency cancel-in-progress leaves skipped conclusions while a newer
fullsend run is still in progress. Treat only failure/timed_out/
startup_failure as terminal so WaitForHarnessAgent keeps waiting.

Signed-off-by: Barak Korren <bkorren@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Jul 29, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:19 PM UTC · Completed 1:35 PM UTC
Commit: a628d11 · View workflow run →

@ifireball

Copy link
Copy Markdown
Member Author

Behaviour CI result

  • First run (30454433267): failed — fail-fast treated concurrency skipped conclusions as terminal while a newer run was still in_progress. Fixed in follow-up commit.
  • Second run (30455336937): success — behaviour 12/12 passed (~6m), including previously flake-prone issue-ping, fork-pr-*, local-ping, good-local, url-ping.

Supports the missing-agent hypothesis from #5707 forensics: committing .fullsend/agents/triage.md during custom harness setup unblocks clean pool repos.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Medium

  • [redundant-api-call] pkg/behaviourtest/drivers/ci/githubactions/githubactions.go:474d.listRecentRuns(ctx, owner, repo) is called twice in the fail-fast error path: once as input to selectFailedWorkflowRunAfter, and again inside formatRecentRunsDiag within the same fmt.Errorf. This doubles API load on every fail-fast and introduces a TOCTOU window where the two calls may return different results, making the diagnostic message potentially inconsistent with the decision that triggered it. The same pattern occurs on the timeout path (line 479). The existing latestRuns() helper at line 101 follows the single-call-and-reuse pattern.
    Remediation: Store the result of d.listRecentRuns in a local variable and pass the same slice to both selectFailedWorkflowRunAfter and formatRecentRunsDiag.

Low

  • [edge-case] pkg/behaviourtest/drivers/ci/githubactions/githubactions.go:474selectFailedWorkflowRunAfter operates on all runs returned by ListRecentWorkflowRuns (which spans all workflows in the repo) without filtering by workflow name. An unrelated workflow failure in the same repo could trigger the fail-fast path, causing a false positive harness failure. The existing findCompletedWorkflowRunOnce method uses selectCompletedSuccessRunByName with an agentWorkflowName filter, showing the pattern exists in this codebase.

  • [test-fragility] pkg/behaviourtest/drivers/ci/githubactions/githubactions_test.go:275 — The new tests mutate package-level dispatchWait/dispatchPoll vars (moved from const to var by this PR). This does not race with existing t.Parallel() tests because Go's test runner serializes sequential tests before releasing parallel tests. However, the pattern is inherently fragile — if someone later adds t.Parallel() to these tests, a data race would occur. The inline comment ("Mutates package-level dispatchWait/dispatchPoll — not parallel-safe") documents this intent appropriately.


Labels: PR modifies behaviour test infrastructure (pkg/behaviourtest/) and is linked to issue #5707 which carries component/e2e

@fullsend-ai-review fullsend-ai-review 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.

See the review comment for full details.

}
if failed := selectFailedWorkflowRunAfter(d.listRecentRuns(ctx, owner, repo), after); failed != nil {
return nil, fmt.Errorf("harness agent %q did not complete successfully: workflow run %d concluded with %q%s%s",
agent, failed.ID, failed.Conclusion, formatWorkflowRunRef(failed), formatRecentRunsDiag(d.listRecentRuns(ctx, owner, repo), after))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[medium] redundant-api-call

d.listRecentRuns(ctx, owner, repo) is called twice in the fail-fast error path: once as input to selectFailedWorkflowRunAfter, and again inside formatRecentRunsDiag within the same fmt.Errorf. This doubles API load and introduces a TOCTOU window where the two calls may return different results.

Suggested fix: Store the result in a local variable and pass the same slice to both selectFailedWorkflowRunAfter and formatRecentRunsDiag.

}
if failed := selectFailedWorkflowRunAfter(d.listRecentRuns(ctx, owner, repo), after); failed != nil {
return nil, fmt.Errorf("harness agent %q did not complete successfully: workflow run %d concluded with %q%s%s",
agent, failed.ID, failed.Conclusion, formatWorkflowRunRef(failed), formatRecentRunsDiag(d.listRecentRuns(ctx, owner, repo), after))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] edge-case

selectFailedWorkflowRunAfter operates on all runs returned by ListRecentWorkflowRuns without filtering by workflow name. An unrelated workflow failure could cause a false fail-fast.

assert.Equal(t, 99, run.ID)
}

func TestWaitForHarnessAgent_FailFastOnFailedRun(t *testing.T) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] test-fragility

New tests mutate package-level dispatchWait/dispatchPoll vars. No race with existing t.Parallel() tests (Go serializes sequential tests before releasing parallel tests), but the pattern is fragile if someone later adds t.Parallel().

@ifireball

Copy link
Copy Markdown
Member Author

PR mixes too much stuff together

@ifireball ifireball closed this Jul 29, 2026
@fullsend-ai-retro

fullsend-ai-retro Bot commented Jul 29, 2026

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 3:37 PM UTC · Completed 3:57 PM UTC
Commit: a628d11 · View workflow run →

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #5714 — missing harness agent fixtures and timeout diagnostics

Timeline

  1. Issue #5707 filed (10:36 UTC) — behaviour test harness agent timeouts across all branches after scaffold agents were removed in Step 7: Remove scaffold agent fallback infrastructure #5552.
  2. Triage agent ran successfully (run 30444363748), posted summary to issue.
  3. PR #5714 opened by ifireball (13:05 UTC) — human-authored fix (with Cursor co-authoring) combining two independent changes: (a) committing agent fixture files for custom harnesses, and (b) improving WaitForHarnessAgent with fail-fast logic and diagnostic messages. 6 files, +290/-38.
  4. Review docs: Add agent-compatible code problem document #1 cancelled (run 30454444051) — superseded by a second commit.
  5. Review Add problem areas: Tekton pipeline review, migration path, multi-tenancy #2 succeeded (run 30455358387, 13:17–13:35 UTC) — found 1 medium (redundant API call / TOCTOU), 2 low (unfiltered workflow name, test fragility). Correctly downgraded a false-positive HIGH race condition finding.
  6. Issue #5715 filed by ifireball (13:38 UTC) — narrower issue isolating just the fixture creation bug.
  7. Code agent produced PR #5719 (14:06 UTC) — focused fix, 2 files, +187/-0. Approved by human (14:18 UTC) and review bot (14:20 UTC).
  8. PR test(#5707): fix missing harness agent fixtures and timeout diagnostics #5714 closed without merging (15:34 UTC) — author commented: "PR mixes too much stuff together."

What went well

Evidence for existing issue

  • fullsend#5135 ("Review agent should elevate mixed-scope PR detection from style/low to medium severity"): This retro provides direct evidence. The review agent's orchestrator explicitly recognized the mixed scope in its synthesis reasoning — noting "this PR actually combines two separate fixes ... though they're logically independent changes" — but did not translate this observation into a finding at any severity. The final review contained zero scope-related findings. The human then closed the PR for exactly this reason. This is a stronger failure mode than Review agent should elevate mixed-scope PR detection from style/low to medium severity #5135's original evidence (where the finding was produced at low/style severity): here the detection recognized the issue internally but produced no output at all.

No new proposals

The primary improvement opportunity (surfacing mixed-scope PR detection as an actionable finding) is already tracked by fullsend#5135. The remaining timeout-diagnostics improvement from the closed PR is a product-level concern for the repo maintainers, not an agent workflow gap.

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

Labels

component/e2e End-to-end tests requires-manual-review Review requires human judgment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(behaviour): fork-related harness agent timeouts across all branches

1 participant