agora.fleet.error_router
Scope-bounded error routing — v2.5.
When a test task fails because an upstream task’s output is broken (e.g.
implement_tests fails with ModuleNotFoundError: No module named
'src.url_shortener' pointing at a file owned by implement_core_module),
the framework should return the failure to the owning task instead of letting
the tester keep cycling on something it can’t fix.
This module is the pure-helper layer that the orchestrator composes with the retry machinery. Two functions, no I/O:
extract_failing_paths()— parse a pytest / import failure string and return workspace-relative paths referenced byImportError/ModuleNotFoundErrorentries. Test modules (the file pytest was trying to load) are excluded because those are owned by the tester, not an upstream.find_owning_task()— given a file path and the project’s task list, return the task whose output is that file. Matches against bothtask.output_pathandfile_exists(rel=...)postconditions.
The orchestrator wires them together: on a failed pytest_passes
postcondition, extract the broken paths, look up the owning task, flip it
back to PENDING with structural feedback in its next system prompt.
Functions
|
Parse a pytest failure string; return workspace-relative paths of modules referenced by |
|
Return the task whose output claims |
- agora.fleet.error_router.extract_failing_paths(failure_reason)[source]
Parse a pytest failure string; return workspace-relative paths of modules referenced by
ImportError/ModuleNotFoundErrorin the traceback.Returns an ordered, de-duplicated list. Empty list means: no routable import error was found in this reason string, caller falls back to the normal failure path.
The returned paths include both
foo/bar.pyandfoo/bar/__init__.pycandidates for each dotted module so the owning-task lookup can match whichever form the project actually uses.Test-module import failures (pytest couldn’t load the test file itself — the tester’s own problem) are excluded from the output.
- agora.fleet.error_router.find_owning_task(file_path, tasks)[source]
Return the task whose output claims
file_path, or None.- Matching rules (in order — the first hit wins):
task.output_pathequalsfile_path(normalized slashes).Any postcondition in
task.spec.postconditionswhose name encodes the same relative path (e.g. the predicate factoryfile_exists(rel="src/foo.py")registers a predicate namedartifact_contains_src_foo.py— we re-derive the rel from the name for matching).
Tasks in
tasksare walked in their natural list order, which mirrors the plan’s declared task order. Self-owned lookups (a task routing to itself) are the caller’s responsibility to filter.