Skip to content

provider limits: visible parks, delegate-child fail-fast, cap ends the run - #4

Merged
IEatCodeDaily merged 2 commits into
fix/provider-reset-probe-parkfrom
feat/provider-limit-park-policy
Nov 15, 2026
Merged

IEatCodeDaily merged 2 commits into
fix/provider-reset-probe-parkfrom
feat/provider-limit-park-policy

Conversation

@IEatCodeDaily

Copy link
Copy Markdown
Owner

Extends #2 (provider-reset probe-park) with Raisal's explicit limit-handling policy. Base is the #2 branch — this diff shows only the new work; GitHub retargets when #2 merges.

Policy (2026-11-12, via Terminus chief of staff)

1. Top-level parks are visible. First park of an episode emits exactly one warning: Stuck on provider limit: <provider>/<model>, resets ~HH:MM WIB; auto-retrying every 5 min. Recovery emits exactly one Resumed at HH:MM after N min parked (hooked on the turn loop's success path). Episode state lives on TurnRetryState.provider_limit_episode — probe parks within an episode never re-announce. ~300s + jitter probe and the 6h total cap unchanged.

2. Cap expiry fails the run. Was: fall through to ordinary retries (looping). Now: terminal verdict provider_limit_wait_cap with provider/model/next-reset in the error.

3. Delegate children never park. In-process delegate_task children (delegation marker) and T3 ACP sessions stamped t3_delegated fail immediately with one structured line: provider_limit: provider=… model=… kind=… reset_at=… [scope=… limit_code=…] so delegate_task surfaces it to the parent thread and the parent agent decides (retry later / switch model / take over).

4. T3 child detection. The ACP relay reads its own thread through the thread-bound MCP credential (acp-mcp-call t3_thread_read) and passes t3_delegated on session.create when relationshipToParent == 'subagent'. The mark rides the frozen launch config (same config_json marks pattern as desktop_local) and is re-stamped on cached agents every turn. Detection failure fails open to the visible top-level park. New CanonicalCreateParams.t3_delegated contract field.

5. Structured limit info. 9router's upcoming code + reset_at + scope body fields pass through error_context (_structured_limit_context); reset_at already flows the existing _RESET_FIELDS body scan. The current text grammar already parses reset after Xh Ym; a response with no reset info remains an ordinary error (no park, no special casing).

Tests

Focused regressions extended in tests/agent/test_provider_reset_wait.py: cap expiry terminal verdict, both child fail-fast paths (delegation marker + gateway-stamped attr, structured error contents, zero sleeps), exactly-once park + resume notices, structured passthrough. Gate: branch-only workflow provider-limit-park-policy.yml (same focused set as the #2 lane). Local verification: py_compile all touched files + a plain-python logic smoke (grammar, passthrough, notice-once, resume-once, child predicate).

Raisal limit-handling policy (extends the probe-park backstop): visible exactly-once park/resume notices; cap expiry fails the run; delegate children (delegation marker or gateway-stamped t3_delegated) fail fast with a structured provider/model/kind/reset_at error; T3 detection via the relay's thread-bound MCP credential and the frozen launch config; structured 9router limit fields pass through error_context.
@IEatCodeDaily
IEatCodeDaily merged commit 5275184 into fix/provider-reset-probe-park Nov 15, 2026
1 of 3 checks passed
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.

1 participant