Skip to content

feat(ci): split tests.yml integration tests into three parallel shards (p0/p1/p2) - #7293

Merged
cuiyuebing merged 7 commits into
agentscope-ai:mainfrom
yutai78786:feat/tests-integration-split
Aug 26, 2026
Merged

feat(ci): split tests.yml integration tests into three parallel shards (p0/p1/p2)#7293
cuiyuebing merged 7 commits into
agentscope-ai:mainfrom
yutai78786:feat/tests-integration-split

Conversation

@yutai78786

Copy link
Copy Markdown
Collaborator

Description

Split the integration tests in .github/workflows/tests.yml from single-path serial execution into three parallel shards by priority (p0/p1/p2). Only one workflow file is changed; no test code or product code is touched.

Specific Changes

  1. Add shard dimension to integration test matrix:

    • Before: 4 jobs (one per platform)
    • After: 12 jobs (each platform × 3 shards)
    • Platforms: ubuntu (3.11, 3.13), macos (3.11), windows (3.11)
    • Each shard: p0 / p1 / p2
  2. Marker expression selected by shard:

    • Before: integration (full suite)
    • After: integration and p0 / integration and p1 / integration and p2
  3. Artifact naming with shard suffix:

    • Coverage data: .coverage.integration.p0/p1/p2
    • Artifact names: coverage-data-integration-p0/p1/p2
  4. coverage-report adapted for three-shard merge:

    • First merge three integration shards into .coverage.integration
    • Then merge three tiers (unit + contract + integration) into final report

Why This Is Safe (Zero Silent Skip Proof)

Static Audit

  • Three marker expressions integration and pX guarantee the union exactly equals the old single-path full suite
  • Parsing all test files under tests/integration (baseline commit 173c844):
    • integration full suite: 202 tests
    • Three shards select: 73 + 89 + 42 = 204 executions
    • 2 tests have both p0 and p2 markers (run twice), after dedup exactly covers 202 tests
    • No test is missed, no new skips added

Live Verification

  • Fork verification run 32843969334 (completed)
  • Three shards selected 73/89/42, matching exactly
  • 12 integration jobs all green
  • coverage-report merged three shards normally

Performance & Reliability Gains

Duration

Platform Before After (longest shard) Speedup
Windows 52 min 36.2 min 30%
Ubuntu (3.11) 30 min 27.4 min 9%
Ubuntu (3.13) 25 min 17.9 min 28%
macOS 25 min 15.0 min 40%

Resource Consumption

  • Job count: 4 → 12 (3x)
  • But parallel execution, total duration shortened
  • GitHub Actions billed by minute, actual cost increase limited

Feedback Speed

  • PR gate total duration from ~52 min (Windows bottleneck) down to ~36 min
  • Faster developer feedback

Impact on Existing Callers

  • workflow_dispatch input integration_marker preserved, no split when manually specified
  • Other workflows (nightly, pr-preview, e2e-integration) unaffected
  • Artifact name changes only consumed within tests.yml (coverage-report downloads by new name)

Risks & Rollback

  • Risk surface only workflow orchestration layer
  • If rollback needed, restore 1 file to return to single-path mode
  • No data migration, no state residue

Verification Checklist

  • YAML validity verified
  • Static audit: three-shard union = full suite (202 tests)
  • Live verification: 12 integration jobs all green (run 32843969334)
  • Coverage three-shard merge verified
  • test-summary normal judgment

Related

@github-actions

Copy link
Copy Markdown

Welcome to QwenPaw! 🐾

Hi @yutai78786, this is your 72nd Pull Request.

📋 About PR Template

To help maintainers review your PR faster, please make sure to include:

  • Description - What this PR does and why
  • Type of Change - Bug fix / Feature / Breaking change / Documentation / Refactoring
  • Component(s) Affected - Core / Console / Channels / Skills / CLI / Documentation / Tests / CI/CD / Scripts
  • Checklist:
    • Run and pass pre-commit run --all-files
    • Run and pass relevant tests (pytest or as applicable)
    • Update documentation if needed
  • Testing - How to test these changes
  • Local Verification Evidence:
    pre-commit run --all-files
    # paste summary result
    
    pytest
    # paste summary result

Complete PR information helps speed up the review process. You can edit the PR description to add these details.

🙌 Join Developer Community

Thanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page:
https://qwenpaw.agentscope.io/docs/community

We truly appreciate your enthusiasm—and look forward to your future contributions! 😊

We'll review your PR soon.

@lalaliat lalaliat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

yutai78786 added a commit to yutai78786/QwenPaw that referenced this pull request Aug 26, 2026
…e-ai#7293)

Reviewer correctly flagged that 22 integration test functions carry
the integration marker but no p0/p1/p2 priority marker, so the three
shard expressions silently excluded them (browser real-page journeys,
session isolation, token rotation, WS auth, ACP MCP scope, Windows
native host repair).

Fix (both suggested approaches combined):
1. Assign priority markers to all 22 unclassified tests (19 -> p1,
   3 -> p2), so the three priority shards cover the full suite again.
2. Add a fourth 'fallback' shard with expression
   'integration and not (p0 or p1 or p2)': any future unclassified
   test still RUNS (never silently skipped) instead of vanishing.
3. Add a fail-closed guard: the ubuntu fallback shard fails the run if
   it collects anything, forcing new tests to get a priority marker.
4. Tolerate empty fallback: pytest exit 5 (no tests collected) is
   expected there; coverage upload uses if-no-files-found: ignore and
   the combine step picks up whichever shard files exist.

AST audit after fix: 0 unclassified integration tests.

署名:秦琼·CIOps@QPQAT
@yutai78786
yutai78786 deployed to maintainer-approved August 26, 2026 08:09 — with GitHub Actions Active
@yutai78786
yutai78786 requested a deployment to maintainer-approved August 26, 2026 08:47 — with GitHub Actions Waiting
yutai78786 added a commit to yutai78786/QwenPaw that referenced this pull request Aug 26, 2026
…e-ai#7293)

Reviewer correctly flagged that 22 integration test functions carry
the integration marker but no p0/p1/p2 priority marker, so the three
shard expressions silently excluded them (browser real-page journeys,
session isolation, token rotation, WS auth, ACP MCP scope, Windows
native host repair).

Fix (both suggested approaches combined):
1. Assign priority markers to all 22 unclassified tests (19 -> p1,
   3 -> p2), so the three priority shards cover the full suite again.
2. Add a fourth 'fallback' shard with expression
   'integration and not (p0 or p1 or p2)': any future unclassified
   test still RUNS (never silently skipped) instead of vanishing.
3. Add a fail-closed guard: the ubuntu fallback shard fails the run if
   it collects anything, forcing new tests to get a priority marker.
4. Tolerate empty fallback: pytest exit 5 (no tests collected) is
   expected there; coverage upload uses if-no-files-found: ignore and
   the combine step picks up whichever shard files exist.

AST audit after fix: 0 unclassified integration tests.

署名:秦琼·CIOps@QPQAT
@yutai78786
yutai78786 force-pushed the feat/tests-integration-split branch from e177052 to 854225e Compare August 26, 2026 10:11
@yutai78786
yutai78786 deployed to maintainer-approved August 26, 2026 10:12 — with GitHub Actions Active
yutai78786 and others added 7 commits August 26, 2026 20:05
Split the integration test job into three parallel shards by priority
(p0/p1/p2) to reduce overall runtime, especially on Windows which has
grown to 52 minutes.

Changes:
- Add 'shard' dimension to integrated-tests matrix (p0/p1/p2)
- Job name now includes shard suffix
- Marker expression selects by shard: 'integration and p0/p1/p2'
- Coverage data files named with shard suffix (.coverage.integration.p0/p1/p2)
- Coverage artifacts named with shard suffix (coverage-data-integration-p0/p1/p2)
- coverage-report combines three shards before combining all tiers

Expected impact:
- Windows: 52 min → ~20 min (3x parallel)
- Ubuntu: 25-30 min → ~10 min
- macOS: 25 min → ~10 min
- Total job count: 4 → 12 (3x more jobs, but parallel execution)

The three shards' union exactly equals the original full suite:
- Static audit: 202 integration tests, 73+89+42=204 executions (2 tests
  have both p0 and p2 markers, run twice, covering all 202 tests)
- No tests are skipped or missed

署名:秦琼·CIOps@QPQAT
The health endpoint may return 404 immediately after channel config PUT
because schedule_agent_reload triggers an async background reload. The
fixture waits for WS connection, but channel registration in
channel_manager may lag slightly behind.

Add a retry loop (30s timeout, 0.5s interval) to wait for the channel
to become available in channel_manager before asserting 200.

Fixes flaky failure (~10% rate across all 4 platforms).

署名:鬼谷子·Integrator@QPQAT
pre-commit trailing-whitespace hook flagged line 491.
Auto-fixed by pre-commit, committing the fix.

署名:秦琼·CIOps@QPQAT
The --data-file flag must come before the file list in coverage combine.
Previous syntax caused 'Couldn't combine from non-existent path' error.

署名:秦琼·CIOps@QPQAT
…e-ai#7293)

Reviewer correctly flagged that 22 integration test functions carry
the integration marker but no p0/p1/p2 priority marker, so the three
shard expressions silently excluded them (browser real-page journeys,
session isolation, token rotation, WS auth, ACP MCP scope, Windows
native host repair).

Fix (both suggested approaches combined):
1. Assign priority markers to all 22 unclassified tests (19 -> p1,
   3 -> p2), so the three priority shards cover the full suite again.
2. Add a fourth 'fallback' shard with expression
   'integration and not (p0 or p1 or p2)': any future unclassified
   test still RUNS (never silently skipped) instead of vanishing.
3. Add a fail-closed guard: the ubuntu fallback shard fails the run if
   it collects anything, forcing new tests to get a priority marker.
4. Tolerate empty fallback: pytest exit 5 (no tests collected) is
   expected there; coverage upload uses if-no-files-found: ignore and
   the combine step picks up whichever shard files exist.

AST audit after fix: 0 unclassified integration tests.

署名:秦琼·CIOps@QPQAT
GitHub Actions runs bash with -e, so the pytest exit 5 (no tests
collected, expected for the fallback shard) aborted the step before
the tolerance logic ran. Capture the exit code via || PYTEST_RC=$?
instead of a bare command followed by $?.

署名:秦琼·CIOps@QPQAT
Upstream merged agentscope-ai#7283 (b22f3e5) after this branch cut, adding
test_backup_sse_idle_timeout_ab with only the integration marker.
The fail-closed fallback guard correctly flagged it; assign p1 so the
test joins the p1 shard instead of being left unclassified.

署名:秦琼·CIOps@QPQAT
@yutai78786
yutai78786 force-pushed the feat/tests-integration-split branch from 854225e to 6be70bb Compare August 26, 2026 12:13
@yutai78786
yutai78786 deployed to maintainer-approved August 26, 2026 12:13 — with GitHub Actions Active

@cuiyuebing cuiyuebing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@cuiyuebing
cuiyuebing merged commit dcc821d into agentscope-ai:main Aug 26, 2026
42 of 43 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in QwenPaw Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants