Skip to content

feat(gateway): a server_config trigger action arms or clears a server's faults - #1009

Open
cikowski wants to merge 2 commits into
mainfrom
arete/tsk_01M8S4D7EXWE3CRQ1961WP0MKN/fault-row-15-gateway-server-conf
Open

cikowski wants to merge 2 commits into
mainfrom
arete/tsk_01M8S4D7EXWE3CRQ1961WP0MKN/fault-row-15-gateway-server-conf

Conversation

@cikowski

@cikowski cikowski commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

Faults (forced errors, latency) were set once, before the agent starts, so a task could not say "after the first send, mail is down for two hours". A trigger can now call a backing server's advertised config extension (such as urn:agentenv:set-errors/v1) with a server_config action, and a later one clears it with clearing args (error_rate: 0.0).

  • Shape: service (a name, or * for all), uri, templated args, tolerate_unadvertised. Action, state and time triggers, with delay, barrier and unless.
  • Per-server outcomes follow apply_server_config, except: a name the gateway has no server for fails even when tolerated (a typo), and a strict broadcast also fails on a cardless MCP server the env definition does not name.
  • Each server is called at its own address, never through the gateway's /svc routes, which a bundle's lock closes.
  • Each fire writes a server_config event to the env trajectory. fetch_child_card also leaves out a card that is not a JSON object.

Rollout

The gateway advertises a server_config trigger feature; the client's register_env_triggers refuses such a trigger on a gateway without it. Existing triggers are unchanged. Rollback: revert; a task using the action is then refused at registration.

Validation

Head 58cf1ad3f9623d765fe27f92ae77babbf4afd526. 46 new tests:

  • tst/unit/env/gateway/triggers_server_config_socket_test.py: real loopback servers; a notes_save call takes mail down and a time trigger 2h later restores it (sends [ok, fail, fail, ok]), also behind a stand-in guard that 404s every route but /mcp.
  • tst/unit/env/gateway/triggers_server_config_test.py: outcome rules, failures and their events (a redirected reply fails: [redirected] fails on the old >= 400 check), templating, state, unless, refused shapes.
  • tst/unit/task_step/test_register_env_triggers.py: an older gateway is refused.

With src/ reverted to main, 41 of the 46 fail (the other 5 are existing card-omission cases).

Quality bar

Head 58cf1ad3f9623d765fe27f92ae77babbf4afd526. Quality profile: rigorous (eng-standards Q1-Q13).

Gate Ran on Result
Local CI (ruff check, unit tier pytest tst/unit packages/agentenv-protocol/tests) 58cf1ad ruff clean; 23186 passed, 3 failed (the same 3 as the baseline: local environment)
Baseline: same commands on clean origin/main fb5a5a6 ruff clean; 23140 passed, 3 failed (local environment)
Test review: reran the suite and mutated the changed lines 58cf1ad PASS (3 rounds; every mutant named was killed)
Adversarial review: probes for races, crashes and bad input 58cf1ad not run yet: runs last, after the cheap checks
Conformance review: design note, eng-standards and this description's claims 58cf1ad PASS
Greptile 58cf1ad 5/5
CI 58cf1ad running; the website-image integration jobs are red on main too until #1005 lands
pr_gate.py check 58cf1ad pending

Relaxations: none.

For the docs

The trigger page should cover the server_config action: its fields (service or *, uri, templated args, tolerate_unadvertised; service and uri are literal; verify, as and to are refused), the per-server outcomes and the two differences from apply_server_config, clearing by args, the server_config trajectory event, and the server_config trigger feature register_env_triggers checks.

Not in this PR

  • reveal_tools in an extension's reply; control tokens for computer children.
  • invoke_extension (the setup step's path) still treats a 3xx reply as applied; a separate change.
  • A release, the worker pin bump, and runs on a hosted env and in a locked bundle.

🤖 Generated with Claude Code

Confidence Score: 5/5RetriggerView in Greptile

The PR appears safe to merge; no new actionable issues were found.

Summary

Adds server_config trigger actions to arm or clear faults on backing servers and record each server's outcome.

  • Triggers can turn a backing server’s faults on or off.
  • Trigger registration checks support for server configuration actions.
  • Gateway child cards must be JSON objects.

Diagram

sequenceDiagram
    participant T as Trigger engine
    participant G as Gateway
    participant S as Backing server
    T->>G: Run server_config
    G->>S: Read advertised extensions
    G->>S: Call config endpoint directly
    S-->>G: HTTP response
    G-->>T: Per-server outcomes
    T->>G: Record trajectory event
Loading

Reviews (6) · Last reviewed commit: "fix(gateway): a redirected config call f..." · Reviewed by Greptile

…'s faults

A trigger can now call a backing server's advertised config extension (for
example set-errors/v1 or set-latency/v1) with args, so a call to one tool, a
point in virtual time or a state change can take another server down and a
later trigger can bring it back by sending clearing args.

- server_config action: service (a server's name, or * for every server),
  uri, args (templated like a tool action's), tolerate_unadvertised. Each
  server's outcome (applied, skipped or failed) follows apply_server_config;
  a name the gateway has no server for fails even when tolerated.
- The gateway calls each server at its own address, read from its card, so
  the action still works once a bundle's lock has closed every route but /mcp.
  A broadcast tries every server before the action fails.
- Each fire writes a server_config event to the env trajectory with each
  server's outcome.
- Cards advertise the server_config trigger feature, and
  register_env_triggers refuses an older gateway that lacks it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cikowski
cikowski requested a review from a team as a code owner December 4, 2026 19:09
Comment thread src/agent_env/env/gateway/gateway.py Resolved
Comment thread src/agent_env/env/gateway/gateway.py Resolved
…plied

Greptile round 1 on #1009:
- The client does not follow redirects, so a 3xx reply means the config
  handler never ran: any reply but 2xx now fails that server.
- The reply excerpt and detail lengths are named class constants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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