# NousResearch/hermes-agent · Run failure events and auth error handling fixes

## Open now

- 1 issue, 2 PRs open on GitHub.
- #57899: Provider auth errors should be retryable (failed, not delivered)
- PR #57910: fix(gateway): mark proxy failures as failed runs
- PR #57975: fix: add failed flag to provider auth error response (#57899)

Multiple fixes addressing incorrect or missing \`run.failed\` event emission, particularly for authentication errors and non-retryable client failures in the gateway and API server. Changes ensure runs with errors are properly marked and reported rather than silently misclassified.

## TL;DR

- 7 member(s): 1 open issue(s), 1 closed issue(s), 2 open PR(s), 1 merged PR(s), 2 PR(s) closed without merging.
- A fix was merged to main in PR #19706. Verify it addresses your case.
- **Recommended:** read PR #19706 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `unresolved`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_PARTIAL`): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
- Members outside that structural core may belong to a different underlying problem.
- Pairwise link density `0.26`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Open related issues

- #57899: Provider auth errors should be retryable (failed, not delivered)

## Closed / duplicate issues

- #15561: Gateway emits run.completed for runs that failed with a non-retryable client error (no run.failed)

## Prior & competing PRs

- **#19706: fix(api_server): emit run.failed when run_conversation returns failed=True**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `gateway/platforms/api_server.py`
  - fix hunks:
  - `gateway/platforms/api_server.py`

    ```diff
    @@ -2578,21 +2578,39 @@ def _run_sync():
                         return r, u
     
                     result, usage = await asyncio.get_running_loop().run_in_executor(None, _run_sync)
    -                final_response = result.get("final_response", "") if isinstance(result, dict) else ""
    -                q.put_nowait({
    -                    "event": "run.completed",
    -                    "run_id": run_id,
    -                    "timestamp": time.time(),
    -                    "output": final_response,
    -                    "usage": usage,
    -                })
    -                self._set_run_status(
    -                    run_id,
    -                    "completed",
    -                    output=final_response,
    -                    usage=usage,
    -                    last_event="run.completed",
    -                )
    +                # Check for structured failure (non-retryable client errors like
    +                # 401/400 return failed=True instead of raising, so the except
    +                # block below never fires — issue #15561).
    +                if isinstance(result, dict) and result.get("failed"):
    +                    error_msg = result.get("error") or "agent run failed"
    +                    q.put_nowait({
    +                        "event": "run.failed",
    +                        "run_id": run_id,
    +                        "timestamp": time.time(),
    +                        "error": error_msg,
    +                    })
    +                    self._set_run_status(
    +                        run_id,
    +                        "failed",
    +                        error=error_msg,
    +                        last_event="run.failed",
    +                    )
    +                else:
    +                    final_response = result.get("final_response", "") if isinstance(result, dict) else ""
    +                    q.put_nowait({
    +                        "event": "run.completed",
    +                        "run_id": run_id,
    +                        "timestamp": time.time(),
    +                        "output": final_response,
    +                        "usage": usage,
    +                    })
    +                    self._set_run_status(
    +                        run_id,
    +                        "completed",
    +                        output=final_response,
    +                        usage=usage,
    +                        last_event="run.completed",
    +                    )
                 except asyncio.CancelledError:
                     self._set_run_status(
                         run_id,
    ```
- **#15564: fix(api_server): emit run.failed when run_conversation returns failed=True**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#19706`
- **#57910: fix(gateway): mark proxy failures as failed runs**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`
  - files: `gateway/run_turn.py`, `tests/gateway/test_run_error_result_contract.py`
- **#57975: fix: add failed flag to provider auth error response (#57899)**. open
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#57910`, `#57899`, `#57910`
  - files: `gateway/run_turn_runner.py`, `tests/gateway/test_provider_auth_error_failed_contract.py`
- **#97136: fix(gateway): mark provider auth resolution failures failed**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#57975`, `#57899`

## Fix status

- Merged to main in PR #19706 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-05-04`.
- Subsystem: `gateway`
