Skip to content

test(stress): leave a run slot for the reference conversation - #5397

Merged
simonrosenberg merged 1 commit into
mainfrom
fix-stress-run-limit-flake
Oct 2, 2026
Merged

simonrosenberg merged 1 commit into
mainfrom
fix-stress-run-limit-flake

Conversation

@simonrosenberg

@simonrosenberg simonrosenberg commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

HUMAN:

The agent-server stress job started failing intermittently on unrelated PRs (e.g. #5151) after #5350 added run admission. This gives the concurrent-conversations benchmark the one extra run slot it needs.


AGENT:

Why

test_concurrent_conversations_isolated_and_fast runs one reference conversation, then starts n (16) conversations at once. Since #5350 the stress fixture caps the server at exactly max_concurrent_runs=n. The reference run can still hold its run permit for a moment after its status reads FINISHED, so the last of the n concurrent starts is sometimes rejected with ConversationRunLimitExceeded ("Conversation run limit reached").

Seen on #5151's agent-server-stress-tests job (run 36706621324), and reproduced locally on unmodified main: 2 of 3 runs failed.

Summary

  • The stress fixture allows n + 1 concurrent runs, leaving room for the reference conversation. Rejection beyond capacity is still covered by test_run_admission.py.

Issue Number

Related: #5404

How to Test

uv run pytest -m stress tests/agent_server/stress/test_concurrent_conversations.py
  • Before, on main: 2 of 3 runs failed with ConversationRunLimitExceeded.
  • After: 6 of 6 runs pass. The full stress suite (-m stress tests/agent_server/stress) passes, 13 tests.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

Test-only change.

🤖 Generated with Claude Code; updated by OpenHands on behalf of the PR author.


🐳 Agent Server images for this PR — GHCR package, pull/run commands, and all pushed tags (click to expand)

• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python-slim amd64, arm64 python-node-runtime Link
python-minimal amd64, arm64 python-node-runtime Link
python amd64, arm64 python-node-runtime Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:ef5b827-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-ef5b827-python \
  ghcr.io/openhands/agent-server:ef5b827-python

All tags pushed for this build

ghcr.io/openhands/agent-server:ef5b827-golang-amd64
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-golang-amd64
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-golang-amd64
ghcr.io/openhands/agent-server:ef5b827-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:ef5b827-golang-arm64
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-golang-arm64
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-golang-arm64
ghcr.io/openhands/agent-server:ef5b827-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:ef5b827-java-amd64
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-java-amd64
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-java-amd64
ghcr.io/openhands/agent-server:ef5b827-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:ef5b827-java-arm64
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-java-arm64
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-java-arm64
ghcr.io/openhands/agent-server:ef5b827-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:ef5b827-python-amd64
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-python-amd64
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-python-amd64
ghcr.io/openhands/agent-server:ef5b827-python-node-runtime-amd64
ghcr.io/openhands/agent-server:ef5b827-python-arm64
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-python-arm64
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-python-arm64
ghcr.io/openhands/agent-server:ef5b827-python-node-runtime-arm64
ghcr.io/openhands/agent-server:ef5b827-python-minimal-amd64
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-python-minimal-amd64
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-python-minimal-amd64
ghcr.io/openhands/agent-server:ef5b827-python-node-runtime-minimal-amd64
ghcr.io/openhands/agent-server:ef5b827-python-minimal-arm64
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-python-minimal-arm64
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-python-minimal-arm64
ghcr.io/openhands/agent-server:ef5b827-python-node-runtime-minimal-arm64
ghcr.io/openhands/agent-server:ef5b827-python-slim-amd64
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-python-slim-amd64
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-python-slim-amd64
ghcr.io/openhands/agent-server:ef5b827-python-node-runtime-slim-amd64
ghcr.io/openhands/agent-server:ef5b827-python-slim-arm64
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-python-slim-arm64
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-python-slim-arm64
ghcr.io/openhands/agent-server:ef5b827-python-node-runtime-slim-arm64
ghcr.io/openhands/agent-server:ef5b827-golang
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-golang
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-golang
ghcr.io/openhands/agent-server:ef5b827-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:ef5b827-java
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-java
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-java
ghcr.io/openhands/agent-server:ef5b827-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:ef5b827-python-minimal
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-python-minimal
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-python-minimal
ghcr.io/openhands/agent-server:ef5b827-python-node-runtime-minimal
ghcr.io/openhands/agent-server:ef5b827-python-slim
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-python-slim
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-python-slim
ghcr.io/openhands/agent-server:ef5b827-python-node-runtime-slim
ghcr.io/openhands/agent-server:ef5b827-python
ghcr.io/openhands/agent-server:ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4-python
ghcr.io/openhands/agent-server:fix-stress-run-limit-flake-python
ghcr.io/openhands/agent-server:ef5b827-python-node-runtime

About Multi-Architecture Support

  • Each variant tag (e.g., ef5b827-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., ef5b827-python-amd64) are also available if needed

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result: ✅ PASSED

Action log

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
TOTAL468031889760% 
report-only-changed-files is enabled. No changed files were found in the coverage report :)

@all-hands-bot all-hands-bot 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.

This review was posted by an AI agent (OpenHands).

Summary

Single-line change: the stress fixture now caps the server at n_conversations + 1 concurrent runs, leaving a slot for the reference conversation so the 16 concurrent starts are not intermittently rejected with ConversationRunLimitExceeded.

The technical fix is correct and well-scoped. I verified the root cause in the workspace: RunSlot.acquire (openhands-agent-server/openhands/agent_server/event_service.py:133) raises immediately when semaphore.locked(), and the fixture previously set max_concurrent_runs to exactly n. test_run_admission.py independently covers rejection beyond capacity, so raising the fixture's cap does not lose that coverage. The agent-server-stress-tests job passes on this head, and my local runs started all 16 concurrent conversations with no run-limit rejection.

Blocking: required check Validate PR description is failing

Validate PR description fails on this exact head (run 36707537856). The failure is the linked-issue gate in .github/scripts/check_pr_description.py:

Linked issue(s) (#5350) carry neither ready-for-dev nor a pre-rollout creation date.

#5350 is not an issue — it is a closed pull request referenced from the ## Issue Number section (N/A (CI flake introduced with #5350)). The validator extracts that bare #5350 as a linked issue, fetches it, and since it carries no ready-for-dev label the check fails. This is the only failing check on the head, and it makes the PR unmergeable.

Fix: reword the ## Issue Number section so the #5350 reference does not resolve as a linked issue — e.g. N/A, moving the "introduced with #5350" context into ## Why (the validator only scans the ## Issue Number section for bare references), or Fixes #NNN for a real ready-for-dev issue.

Non-blocking observation

test_concurrent_conversations_isolated_and_fast still fails intermittently in my environment on step 5's wall-time budget (concurrent_wall ~0.62s vs ref_wall × 4.0 ~0.6s), independently of this change: the reference run's wall time is too small for a 4x budget to be robust. Not introduced by this PR and not the flake this PR targets, but worth tracking since it will keep this job noisy.

The code change itself is correct. This review is conditional only on the failing required description check being resolved.

🔄 CHANGES REQUESTED

Comment thread tests/agent_server/stress/conftest.py Resolved
@simonrosenberg

Copy link
Copy Markdown
Member Author

@OpenHands fix all CI and issues and rebase main

@openhands-ai

openhands-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown

I'm on it! simonrosenberg can track my progress at all-hands.dev

The concurrent-conversations benchmark runs one reference conversation
and then n more at once, against a server capped at exactly n runs. The
reference run can still hold its permit briefly after reporting FINISHED,
so the last concurrent start was intermittently rejected with
ConversationRunLimitExceeded.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Co-authored-by: openhands <openhands@all-hands.dev>

@all-hands-bot all-hands-bot 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.

This review was posted by an AI agent (OpenHands).

Summary

Test-only, single-line change: the stress fixture now caps the server at CONCURRENT_CONVERSATIONS.n_conversations + 1 concurrent runs, leaving one slot for the reference conversation so the 16 concurrent starts are not intermittently rejected with ConversationRunLimitExceeded.

I re-established the current state for this head (ef5b8274):

  • The root cause holds in the workspace. RunSlot.acquire (openhands-agent-server/openhands/agent_server/event_service.py:133) raises as soon as semaphore.locked() (an atomic check-and-acquire on the event loop), so a fixture capped at exactly n leaves no room when the reference run still holds its permit briefly after reporting FINISHED.
  • The fix is well-scoped. Rejection beyond capacity stays covered: tests/agent_server/test_run_admission.py builds its own ConversationService with max_concurrent_runs of 1 and 2 and does not consume the stress fixture, so raising the stress cap loses no admission coverage. No other stress test depends on the cap.
  • The targeted flake is addressed. With the change, all 16 concurrent conversations start with no run-limit rejection. (In my environment the test still fails on step 5's pre-existing wall-time budget, concurrent_wall ~0.80s vs ref_wall * 4.0 ~0.64s; I reproduced the identical wall-time failure on the unmodified base 048c9be7 with no run-limit rejection, so that is the unrelated timing flake, not this PR's target.)
  • Current-head CI is green on the required gates: agent-server-stress-tests, pre-commit, and Validate PR description all pass. The earlier Validate PR description failure is resolved now that the ## Issue Number section reads Related: #5404 (a real ready-for-dev issue) rather than a bare reference to the closed PR #5350.
  • Linked issue #5404 is open with ready-for-dev and priority:low; this test-side mitigation is consistent with that issue continuing to track the underlying permit-release bug.

No material correctness, security, or compatibility findings on the current head.

✅ APPROVED

@all-hands-bot
all-hands-bot requested a review from neubig October 2, 2026 15:49
@simonrosenberg
simonrosenberg merged commit 8034b0d into main Oct 2, 2026
59 of 60 checks passed
@simonrosenberg
simonrosenberg deleted the fix-stress-run-limit-flake branch October 2, 2026 15:51
@openhands-ai

openhands-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown

PR #5397 is complete and merged: #5397

  • Rebased onto current main (048c9be76)
  • Final PR head: ef5b8274bd3851f44a6fed5fb10ef8d37fc6fbe4
  • Merge commit: 8034b0dbc3f695f2c7c375e1ad4d352166f1ac75
  • Fixed PR validation by linking the matching ready issue, Release conversation run permit before publishing terminal status #5404
  • Resolved 1 review thread and received current-head approval from all-hands-bot
  • CI: 51 passed, 0 failed, 0 pending
  • Local verification passed:
    • uv run pytest -m stress tests/agent_server/stress/test_concurrent_conversations.py
    • uv run pre-commit run --files tests/agent_server/stress/conftest.py
  • Flaky reruns used: 0

The PR was merged by simonrosenberg.

VascoSch92 pushed a commit that referenced this pull request Oct 3, 2026
Co-authored-by: openhands <openhands@all-hands.dev>
(cherry picked from commit 8034b0d)
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