Repository navigation
fix(tests): a model-turn 429 is classified — billing fails, capacity skips; the admission 429s say "capacity" (#2919) - #2977
Merged
Merged
Conversation
…t skip (#2919) Replaces test_non_503_is_a_no_op (which pinned 429 as a no-op) with the three consumer cases the 429 arm has to satisfy. Red for the behaviour: DID NOT RAISE Failed / Skipped, 4 failed, 39 passed. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…kips, unknown fails (#2919) The 429 arm in require_agent_answer, mirroring #2894 one status code over: header first (billing/auth → fail + session cascade; capacity → skip with evidence, never recorded), X-Circuit-Open second, then on a 429 only the source-pinned capacity wording (transport vocabulary is not consulted), else unknown ⇒ FAIL. Verdict gains a trailing-default status; the reason builders name it; capacity_skip_reason is new and stays off the skip-audit allowlist. Gate: 63 → 89 passed. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…e: capacity (#2919) TaskExecutionErrorCode.CAPACITY had zero assignment sites, so a queue-full 429 was recognisable only by the absence of a header plus its prose, while execution.md and the A2A feature flow already listed `capacity` as emitted. Three additive headers= kwargs, bodies byte-identical: - routers/chat.py: the /chat CapacityFull admission 429 (through chat_execution_service._error_code_headers, the one emitter) - _dispatch_async: the CapacityFull (capacity + backlog full) 429 - _map_task_failure: the at-capacity branch decides the status by the result text, so the code it sends now agrees (capacity overrides any result code; none exists on that branch today) task_execution_service.py untouched. Red (backend reverted from scratch copy): 3 failed, 24 passed — assert None == {'X-Trinity-Error-Code': 'capacity'} ×3 Green: test_2889_readiness_classifier + test_2889_error_code_header 92 passed; characterization suites (chat_admission, 946, 2661, 1483) 48 passed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…skips (#2919) _is_503_check → _is_laundered_status_check, keyed on readiness.LAUNDERED_STATUSES (one home for the vocabulary): `==`, `in` list/tuple/set, and an `or` of such checks. Known escapes are written down in its docstring (same limits #2894 accepted). Adds the matcher table and a walk meta-test pinning the four site files inside the guard. Guard widened BEFORE deleting — red listed exactly 18 offenders: test_dynamic_thinking_status.py:203,230,268,334,425,507 test_parallel_task.py:569,630,664,719,794,839 test_agent_chat.py:42,67,432,469,505 agent_server/test_agent_chat_direct.py:35 Each followed require_agent_answer(...), which now skips a capacity 429 and fails a billing/unknown one, so every branch was dead. Deleted; the downstream assert_status(…, 200) is unchanged. Mutation check: restoring test_agent_chat_direct.py's site → guard red with exactly 1 offender. Gate: 104 passed. The 18 integration sites were not run live (Docker down); the four files collect (98 tests). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…2919) - execution.md (header contract's owning area file): the three admission-refusal emitters of `capacity`, and the 429 arm of require_agent_answer; the value list there is now true. - agent-to-agent-collaboration.md: a queue-full 429 carries `capacity`. - STRATEGY.md / tests/README.md: "503 or 429" — capacity skips (unallowlisted), billing fails and arms the session fast-fail, the guard covers `== 429`. Requirements delta: none (no area covers the test harness or the header). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… capacity (#2919) /sync-feature-flows over origin/dev..HEAD: routers/chat.py and chat_execution_service.py map to execution-queue.md (the 429 body it documents) and agent-to-agent-collaboration.md (already updated). One sentence; no new flow, no index change. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ort skipped (#2919) `Skipped` is not a `Failed`, so `pytest.raises(pytest.fail.Exception)` lets a wrongly-skipping helper propagate its skip: mutating require_agent_answer to "skip every 429" (the defect this issue removes) left the unit file at 71 passed / 6 skipped / 0 failed. Route every fail-expecting case through `_must_fail()`, which turns a skip into an AssertionError. Same mutation now: 6 failed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…s was (#2919) `_is_503_check` matched any comparison against 503; the widened matcher accepted only `==`/`in`, silently unguarding `>= 503`, `!= 503` and `not in [503]` on the 503 half. Match the constant regardless of operator (a strict superset of both), pin `>= 429` / `!= 503` / `not in [503]` in the shape table, and correct the "known escapes" list. Mutation: re-adding a `status_code >= 429: pytest.skip` site turns the guard red naming it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…producer's (#2919) `_map_task_failure` picks its 429 by substring ("at capacity") on the result text and was stamping `capacity` over any code the result carried. That code is the producer's structured verdict on a turn that RAN (#2638 `billing`, whose `error` is the agent's own prose) — overriding it would let the new 429 arm SKIP an exhausted subscription whose prose happened to say "at capacity". Prose must not beat the structured code: `capacity` now only fills an absent code (the capacity rejection sets none, so every live at-capacity 429 still carries `capacity`). Red first: `{'X-Trinity-Error-Code': 'capacity'} != {'X-Trinity-Error-Code': 'billing'}`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ts capacity on at-capacity (#2919) — mechanical, doc/comment accuracy Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
vybe
marked this pull request as ready for review
September 23, 2026 09:43
Contributor
|
merge-train: pushed one mechanical commit to this branch — doc/comment accuracy only, no behaviour change:
|
vybe
approved these changes
Sep 23, 2026
vybe
left a comment
Contributor
There was a problem hiding this comment.
merge-train: validated individually (3-member queue, below train size); all checks green incl. pytest + journey-smoke.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2919
Summary
#2894 stopped a bare
503skip from hiding a real failure. Eighteen integration tests still had the same pattern for429: a barepytest.skip("Agent queue full"). That meant a model-turn429caused by an exhausted subscription (billing) was reported as skipped, not failed. This PR closes that gap the same way #2894 did.What changed
tests/testing_utils/readiness.py::require_agent_answermirrors fix(tests): classify a model-turn 503 instead of skipping on it (#2889) #2894. The header is checked first:X-Trinity-Error-Code: billing→ fail,capacity→ skip, a header-less or unknown429→ fail asunknown. The body-marker fallback is pinned to the producer's source text.== 429, and it no longer cares about the operator, as fix(tests): classify a model-turn 503 instead of skipping on it (#2889) #2894's was.429skips deleted:test_agent_chat.py×5,test_dynamic_thinking_status.py×6,test_parallel_task.py×6,agent_server/test_agent_chat_direct.py×1. Every site already callsrequire_agent_answerabove the old skip.X-Trinity-Error-Code: capacity: the/chatqueue-full refusal (routers/chat.py),_acquire_task_capacity's backlog-full refusal, and the_map_task_failure"at capacity" branch (chat_execution_service.py). The backend diff is 3headers=kwargs + 1 import.task_execution_service.pyis untouched. Two docs already said this header was sent (architecture/execution.md,feature-flows/agent-to-agent-collaboration.md); now it actually is.execution.md,agent-to-agent-collaboration.md,execution-queue.md,docs/testing/STRATEGY.md,tests/README.md.Evidence
None == {'X-Trinity-Error-Code': 'capacity'}) before itsheaders=kwarg was added.pytest.raises(pytest.fail.Exception), which lets a skip through. A mutation that makes the classifier "skip every 429" gave 71 passed / 6 skipped / 0 failed beforec4c8a6ac1and 6 failed after it.test_2889_readiness_classifier,test_2889_error_code_header,test_chat_admission,test_946_task_idempotency_on_deny,test_2661_task_timeout_receipt,test_1483_execute_parallel_task_characterization): 156 passed.tests/unit(-n auto): 17803 passed / 46 skipped / 0 failed.dev's required checks run notests/unit, so both runs above were done locally.Deviation from the approved plan
Plan decision #16 said "
capacityoverrides the result code". It was reversed in review (326e33267). Now a code the producer already set wins, andcapacityonly fills in when there is no code. The reason: abillingresult's error text is prose passed through from upstream, and that prose can contain "at capacity". The override would have turned a real exhausted-subscription failure into a capacity skip. No path Trinity writes itself sees a different header today, because no Trinity-written "at capacity" result carries a code. The plan has an amendment recording this.For the human to confirm
test_parallel_task.pyused to tell developers to rerun the test on its own ("Slots still occupied from prior tests — rerun isolated"). That hint is gone along with the skip.Not verified
/verify-localand a live run of the 18 integration sites. Docker was down on the build host. The 4 site files do collect (98 tests) and the import smoke test passes.Follow-ups (listed, not filed)
auto_switchresponse fails its own test without turning on the session fast-fail.test_public_links.py:587andtest_schedules.py:552have the same bare-skip shape. Fix them, then widen the guard's walk to cover them./taskbacklog-full503has no header, so it fails asunknown.client_portal/service.py:3108matches the substring "at capacity", andmcp_auth_service.py:379sends an admission429without a code._error_code_headerspublic. The router calls it through the module object.test-runner.mdcatalog entry (private submodule).🤖 Generated with Claude Code