Skip to content

The web poller omits a worker-active state that can resume from external events #398

Description

@MicroMilo

Summary

For the repository-owned agent-run state awaiting_events, the canonical worker classifier reports an active run while the web incident-detail poller disables refetching. Because useIncident directly uses that predicate for refetchInterval, an incident page parked in this state will not automatically observe subsequent PR-event-driven resume, status, or transcript updates and can remain stale until another manual or incidental refetch.

Validation source commit: 3f190be0a21732c675c8869b4ec338ff6467b5bd.

Code path

  • apps/web/src/incidents/agent-run-polling.ts:1-33: Web poller claims its state set mirrors the worker ACTIVE_STATES and enables polling for active runs.
  • apps/worker/src/agent-runs/domain.ts:13-38: Canonical worker state classifier includes awaiting_events in ACTIVE_STATES and returns true for it.
  • apps/web/src/api.ts:2549-2559: Product incident-detail query uses the web predicate as its React Query refetch interval.
  • apps/worker/src/agent-runs/queue.ts:108-124: Worker queue dispatches awaiting_events through the resume path.
  • Repository-local validation artifact: Minimized executable differential witness.

Steps to reproduce

This report is based on a source-control-flow validation against the commit above.

  1. Check out the source commit listed in this report.
  2. Inspect the code path and contract anchors listed above.
  3. Exercise the described boundary/state path: The web poller omits a worker-active state that can resume from external events.
  4. Compare the observed behavior with the expected contract below.

Validation note: With the single shared input awaiting_events, the worker observation is {isActiveState:true} while the web observation is {incidentPollIntervalMs:false,pollingEnabled:false}; the claimed equivalence evaluates to false. All validation assertions pass. The existing web polling suite was also run with node --test apps/web/src/incidents/agent-run-polling.test.ts and passed 7/7, confirming the divergence is not reconciled by its tested terminal/dormant policy.

Expected behavior

The implementation should preserve the repository contract described by the documentation, public type, parser, serializer, or sibling implementation anchors above.

Actual behavior

For the repository-owned agent-run state awaiting_events, the canonical worker classifier reports an active run while the web incident-detail poller disables refetching. Because useIncident directly uses that predicate for refetchInterval, an incident page parked in this state will not automatically observe subsequent PR-event-driven resume, status, or transcript updates and can remain stale until another manual or incidental refetch.

Existing coverage

I did not find an existing issue or PR title that appears to cover this exact root cause in the pre-submission check.

Suggested fix

Add awaiting_events to the web poller's canonical active-state mirror.

Suggested tests

  • Add a regression test for: The web poller omits a worker-active state that can resume from external events.
  • Include the boundary value or state transition described above so the old behavior fails before the fix.

Submitted with Codex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions