Scope golden liveness errors to the exact response request

Merged
LA
2mo ago
+158-19

The staging golden gate observed a healthy accepted Responses connection emitting paced chunks every 500 ms, but an unrelated Codex metadata GET returned 502 on another connection. The aggregate observer error count incorrectly invalidated exact-connection liveness and caused a safe rollback.\n\nThis records observer error identities and scopes liveness, turn validation, and summaries to Responses requests while retaining fail-closed behavior for the exact request and all evidence-recording failures.\n\nVerification:\n- regression test fails on the test-only commit and passes with the fix\n- focused observer package tests pass\n- both timing-sensitive failures from the first concurrent full run pass in isolation\n- serialized full suite is running


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Scopes golden observer liveness, validation, and closure to the exact /v1/responses request/connection so unrelated proxy errors don’t trigger false failures. Keeps fail-closed behavior for the affected request and for evidence recording errors.

  • Bug Fixes
    • Store observer errors as events in observerStats and add errorSnapshot().
    • Add observerScopedErrorCount() and observerResponseErrorCount() to filter by path/connection/request.
    • Scope checks in waitGoldenObserverRequestConnectionsClosed (still fails on response errors), waitGoldenConnectionResponseChunkAfter, validateObserverTurns, and summarizeGoldenSession.
    • Add regression tests for liveness, validation, and observer closure: ignore unrelated request errors; still fail on response request errors and recording_error.

Summary by CodeRabbit

  • Bug Fixes

    • Improved observer validation by distinguishing response-related errors from unrelated request errors.
    • Response connection checks now remain valid when errors occur on unrelated requests.
    • Recording errors and errors affecting the response request continue to correctly invalidate validation.
    • Error reporting and session summaries now accurately include relevant errors, including resumed sessions.
  • Tests

    • Added regression coverage for response connection liveness and scoped observer error handling.