Skip to content

test(session): give the hard-stop fake manager the slot-list reads - #18950

Merged
bolichen97 merged 1 commit into
mainfrom
fix/hard-stop-fake-manager-broadcast
Oct 11, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/hard-stop-fake-manager-broadcast

Conversation

@cruisercohen

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Make the two hard-stop settle tests in test/test_session_control.py pass deterministically on main.

test_a_hard_stop_still_discards_and_settles_what_was_queued_before_it fails intermittently in Backend Tests with:

AttributeError: '_SettlingManager' object has no attribute 'published_queued_depths'

It is red on #18944's own run (Backend Tests (3.12, 4)), whose merge ref is main plus a test-only change to an unrelated file, and green on main's own run for the same tree. It passes locally in isolation.

Why it matters

main is already red on test_approval_decide_owner_bound.py (fixed by #18944). This second failure is timing-dependent, so it can turn #18944, main, and any PR's Backend Tests shard red at random after that fix lands.

Not a goal

What changed (motivation → approach → change)

  • Symptom: the hard-stop test raises AttributeError from _published_queued_by_slot in dashboard/state.py, only on some runs.
  • Root cause: a test double that is missing two methods, plus a timing window. The hard-stop tests (added in fix(chat): keep a send that lands while a hard Stop settles #18822) stand in a fake SubagentManager that only has settle_queued_delivery. stop_slot_turn calls state.push_slots_update(). If the coalescing window has elapsed since the state's last broadcast, that push serializes every slot right away. Serializing calls published_queued_depths() and running_agents_for() on state.subagents. If the window has not elapsed, the push only arms a trailing timer, which never fires before asyncio.run closes the loop. So the test passes when setup is fast and fails when a loaded CI worker makes setup slower than the window.
  • Change (test-only):
    • _SettlingManager now has running_agents_for and published_queued_depths, and both answer "none", as an idle manager does.
    • A new _slots_window_always_open fixture patches _slots_broadcast_clock to a clock that jumps past the window on every read. This is the same seam test_slots_broadcast_byte_pacing.py uses. Both hard-stop tests use the fixture, so every run takes the broadcast path instead of depending on how long the test took.

Backwards compatibility

Compatible: test-only change, nothing in src/ is touched.

Removes nothing: the diff only adds two methods to a test double and one fixture.

Tests

  • test_a_send_that_lands_while_a_hard_stop_settles_stays_queued and test_a_hard_stop_still_discards_and_settles_what_was_queued_before_it now always run through the immediate slots broadcast.
  • Red without the fix: with the fixture applied and the two new methods removed, both tests fail every time with the CI AttributeError. With the fix, both pass.
  • python -m pytest test/test_session_control.py test/test_slots_broadcast_byte_pacing.py: 239 passed. test/test_flake_pattern_ratchet.py: passed.
  • black, isort, flake8 clean on the changed file. The comment-history gate passes.

Manual verification

N/A: test-only change. The unit run above is the evidence.

Related Issues

Refs #18822, #18944

Pattern harvest

Rule candidate: review-prompt
Pattern: a hand-rolled stand-in for a manager or service that a code path also reads through a broadcast or serializer needs every method that path calls, or the test passes only when the coalescing or timing window happens to skip the call.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@cruisercohen
cruisercohen requested review from a team and KiroCrewCaptain as code owners October 10, 2026 21:33
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision ae0f9c2ed9718f41c990dd09be524363f1c253b9 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision ae0f9c2ed9718f41c990dd09be524363f1c253b9 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of ae0f9c2ed9718f41c990dd09be524363f1c253b9 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] ae0f9c2

Description read

[DESCRIPTION-READ] e7f9c0aaba7667a1e255104a34a85b1c26a6bac12a00360e03b09b48c8555f25

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed ae0f9c2ed9718f41c990dd09be524363f1c253b9 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] ae0f9c2

Verdict parsed from the review's SHA-scoped output markers for commit ae0f9c2ed9718f41c990dd09be524363f1c253b9.

False positive or not applicable? A repository writer can comment:
/ai-review override fable ae0f9c2ed9718f41c990dd09be524363f1c253b9: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of ae0f9c2ed9718f41c990dd09be524363f1c253b9 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] ae0f9c2

False positive or not applicable? A repository writer can comment:
/ai-review override gpt ae0f9c2ed9718f41c990dd09be524363f1c253b9: <one-sentence reason>

The two hard-stop settle tests stand in a fake SubagentManager that has only
settle_queued_delivery. stop_slot_turn pushes a slots update, and when the
coalescing window has elapsed that push serializes every slot, which calls
published_queued_depths and running_agents_for on the manager. The fake had
neither, so the tests raised AttributeError whenever setup took longer than
the window, as it does on a loaded CI worker.

The fake now answers both reads as an idle manager does, and both tests run
on a clock that puts every push past the window, so they exercise the
broadcast path every time instead of by timing.
@cruisercohen
cruisercohen force-pushed the fix/hard-stop-fake-manager-broadcast branch from 4c69e57 to ae0f9c2 Compare October 10, 2026 22:02
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 10, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved at head ae0f9c2: PR Readiness is green, no open change requests, and the review lanes passed. (AI-assisted review at bolichen97's request.)

@bolichen97
bolichen97 merged commit 7f9e07e into main Oct 11, 2026
102 checks passed
@bolichen97
bolichen97 deleted the fix/hard-stop-fake-manager-broadcast branch October 11, 2026 01:07
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 11, 2026
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.

2 participants