Skip to content

feat(task_step): a run keeps each server's fault log in its context (UGML-1130) - #990

Merged
cikowski merged 6 commits into
mainfrom
arete/tsk_01M8S4DBWXWJVAMXNMNTEZK04D/fault-row-16a-collect-each-serve
Dec 3, 2026
Merged

cikowski merged 6 commits into
mainfrom
arete/tsk_01M8S4DBWXWJVAMXNMNTEZK04D/fault-row-16a-collect-each-serve

Conversation

@cikowski

@cikowski cikowski commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

A verifier or rubric judge sees which faults a run armed (server_config_changes) but not which fired. Servers that keep a fault log serve it at urn:agentenv:get-fault-log/v1 (GET, {"entries", "dropped"}). This PR reads it into the run's context when the agent finishes (UGML-1130, Hub half).

  • prompt_agent (after each conversation, a failed agent task included; a timeout or transport error raises before it) and always_on (in finish) call capture_server_fault_logs beside the trigger state capture, for envs the run configured (server_config_changes or env_trigger_registrations).
  • Each backing server whose card advertises the extension is read with its owner's control token (a multi env's computer with its own). 15 s per read, 60 s per capture; a failure is recorded and never fails the run.
  • metadata["server_fault_logs"][env_id] keeps each server's entry_count and dropped (or error), not_advertised, and the object_url of the full entries, which stay out of the run document. With no advertising server no file is written.
  • Server keys: a name's bare key is the server a named apply_server_config directive of that name configures, found with the step's own lookups: the stored card's child of that name on an env that runs no computers, else legacy_protocol.named_server (its first MCP server, else its first server), which the step now calls too. Every other server is website:<name> (a website) or <name>, numbered from #2 until the key is unused, so no two servers share a key.
  • load_server_fault_logs returns the entries, complete: false when any were dropped, and raises LookupError when nothing was captured. An env deployed twice in one run is recorded as an error, since no record says which deployment was configured. The key is env-keyed for bundles.

Rollout

Additive; unconfigured runs do no reads. Added time at prompt end: 2-3 ms in process against stubs, not measured on deployed servers. After merge: a framework release, then the hosted worker's framework pin bump. Revert: revert this PR.

Validation

Head cee0e110. New: tst/unit/task_step/test_server_fault_logs.py (36 tests); tst/unit/bundle/resolve_test.py gains one fact.

  • Wiring: apply_server_config arms stub SDK servers behind the real gateway card, an SDK agent calls them, and the fired entry sits beside server_config_changes. Removing either hook, the env filter, the budget guard, the key numbering or the control headers fails a test.
  • Keys: tests run the real apply_server_config step on a website and its MCP twin (a named directive alone, with a broadcast, and on a computer, and a twin that serves no card) and on five more server lists; each name's bare key is the server its named directive configured. A check of 38,848 server lists (120,696 named directives, both lookup paths) found no mismatch and no shared key.
  • Unit tier: 4 failed, 22783 passed, 9 skipped: the 3 that fail on clean main 27c255e3 (3 failed, 22748 passed), plus a Playwright driver test that touches nothing here and passed 3 of 3 alone.
  • Integration tier (not slow): 3 failed, 244 passed, 1 error, the same set on clean main. The three slow files that run the capture on a real local gateway: 4 passed.
  • Not run: ruff format and mypy, which this repo's CI does not run.

Quality bar

Gate Ran on Result
Local CI gate (ruff, unit, integration) cee0e110 baseline failures plus one unrelated flake
Clean baseline 27c255e3 the same unit and integration failures
Test review (a failing test per behaviour) cee0e110 PASS
Conformance review (against the approved design) cee0e110 PASS
Adversarial review cee0e110 PASS in the final review (on d953565b it found one major, a website a named directive configures losing its key to an MCP twin with no card, fixed here by the shared lookups above, with a test)
Greptile cee0e110 5/5
CI cee0e110 green
pr_gate.py check cee0e110 exit 0

Every review major is fixed in this PR; none is deferred. Relaxations: none.

Not in this PR

  • The judge's fault_log run context part (UGML-2133).
  • Proof on real servers: needs the server-side log merged and the images registered again.
  • A verifier file for Harbor exports.
  • Known limitations (minors, UGML-2259): server_config_changes does not name the server each change configured (item 18), so the keys repeat the step's lookup rather than read it from the record; the latest capture of an env wins even when it fails, and a failed object store write drops the counts (items 21-22); no key test case yet for a website named like another website's generated key.

🤖 Generated with Claude Code

Confidence Score: 5/5RetriggerView in Greptile

The PR appears safe to merge; no new actionable issue was found.

Summary

The PR saves configured servers’ fault logs after agent work. Counts stay in the run context; full entries go into object storage.

  • Finished runs capture advertised server fault logs in their context.
  • Each server's fault log gets a distinct key that matches its config target.
  • Bundle context paths for fault logs follow environment renames.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Agent finishes] --> B[Find configured environments]
  B --> C[Choose distinct server keys]
  C --> D[Read advertised fault logs]
  D --> E[Store full entries]
  E --> F[Keep counts and object URL in context]
Loading

Reviews (9) · Last reviewed commit: "fix(task_step): fault log keys use apply..." · Reviewed by Greptile

…UGML-1130)

When the agent finishes (prompt_agent's conversation, always_on's finish), every env the run configured
(server_config_changes or env_trigger_registrations) has each backing server that advertises
urn:agentenv:get-fault-log/v1 read with its owner's control token. Per env, context.metadata["server_fault_logs"][env_id]
keeps each server's entry count and dropped count (or its read error), the servers that keep no log, and the object
URL of the full entries; load_server_fault_logs reads them back and marks a log that dropped entries incomplete.
Reads take 15 s each and 60 s in all, and never fail the run.

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 2, 2026 19:43
cikowski and others added 2 commits December 2, 2026 19:51
…eys its file by a safe segment (UGML-1130)

An env with two deployments in the run is recorded as an error naming their deploy steps, since no record says which
one was configured, and neither is read. The stored file's key uses key_segment for the env id, so an id too long for
a file name still stores. The error detail and id lengths are named constants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hares a name (UGML-1130)

Two backing servers of one name and kind (a multi env's gateway MCP server and
an app its computer lists, or two such websites) both got the same key in
services, so one log was dropped. The first keeps the key, as a named
directive picks it; each later one is keyed <key>#2, #3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cikowski and others added 3 commits December 2, 2026 21:15
…already has (UGML-1130)

A server literally named like a generated key (mail#2) collided with the key
given to a later server of the same name, so one log was overwritten. Every
server's own key is now reserved first, and a later server takes the first
free number.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ve configures (UGML-1130)

The bare key of a name now goes to the server a named apply_server_config
directive of that name targets (the name's first MCP server, else its first
server). Every other server is keyed website:<name> or <name>, numbered from
#2 until no server's name or earlier key has it, so keys cannot collide and a
server literally named like a generated key keeps its own name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ookups (UGML-1130)

A named apply_server_config directive on a plain env finds its server by
name on the stored card (child_env_card), not in backing_servers, so a
website the card lists is configured even when the definition also names
a card-less MCP server of that name. The bare key went to that card-less
server, filing the website's log under website:mail.

The keys now call the step's own lookups instead of a copy of them: by
name on the stored card for an env that runs no computers, else the
broadcast's pick, now legacy_protocol.named_server, which
_expand_directives calls too (no change to what it picks).

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

@agutmanstein-scale agutmanstein-scale 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.

Approving. Nothing existing breaks:

  • apply_server_config. legacy_protocol.named_server is an exact extraction of the lookup the step already did (the MCP server of a name, else the first of it), so every directive configures the same server. The module is imported inside the function, as before.
  • Capture hooks. prompt_agent and always_on gain one capture_server_fault_logs call after the trigger-state persist. It returns at once unless the run configured an env, gathers its reads with return_exceptions, and is capped at CAPTURE_BUDGET_SECONDS, so it never fails a run.
  • Run document. server_fault_logs is a new env-keyed metadata key, and the entries go to the object store.

Deploy: a framework release, then the hosted worker's pin bump. Non-blocking: a configured run's prompt end can wait up to the 60 s budget when a server's fault-log endpoint is slow.

@cikowski
cikowski merged commit 71eaaac into main Dec 3, 2026
37 checks passed
@cikowski
cikowski deleted the arete/tsk_01M8S4DBWXWJVAMXNMNTEZK04D/fault-row-16a-collect-each-serve branch December 3, 2026 01:52
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