Skip to content

G5: wait for Chromium network idle #204

Description

@SarthakWade

Parent: #54, roadmap backlog G5.

Goal

Add a bounded network-idle predicate to the existing wait command so agents can wait for Chromium page traffic without polling diagnostics or guessing delays.

Contract

  • Add wait --network-idle and a boolean networkIdle protocol parameter.
  • Combine URL, text, settled, and network-idle predicates with logical AND.
  • Preserve current bare wait behavior: it still defaults to --settled.
  • wait --network-idle alone requests only network idle unless --settled is also present.
  • Chromium reports idle only after zero qualifying in-flight requests for a fixed 500 ms quiet window measured from command start or the latest qualifying network event.
  • Track requests from Network.requestWillBeSent through Network.loadingFinished or Network.loadingFailed, including redirects without double-counting request IDs.
  • Do not let persistent WebSocket or EventSource connections block forever. Ordinary fetch/XHR long polling remains qualifying and may time out.
  • Keep the existing 100 through 120000 ms timeout bound and return the existing typed timeout error.
  • WebKit must fail immediately with UNSUPPORTED_CAPABILITY when network idle is requested. It must not approximate this through the page-world diagnostics bridge.
  • Capabilities must declare network-idle wait support separately for each engine.
  • Return the existing bounded page-state result. Do not expose request URLs, headers, bodies, or identifiers.

Required implementation surfaces

  • Architecture decision.
  • CLI parser and help.
  • Protocol validation and generated schema.
  • Shared engine contract and capability matrix.
  • Chromium CDP event tracking.
  • WebKit explicit capability failure.
  • Command reference, phase contract, skill guidance, and backlog entry.
  • Generated SDK schema and clients where required by the repository contract.

Acceptance criteria

  • Parser and validation tests cover the flag, conjunction behavior, bare-wait compatibility, invalid values, and timeout bounds.
  • Deterministic tests cover request start, finish, failure, redirect reuse, persistent-connection exclusion, quiet-window reset, and timeout behavior.
  • Linux E2E proves a delayed page request blocks until the quiet window and then succeeds.
  • macOS E2E proves the predicate fails with UNSUPPORTED_CAPABILITY without waiting for the timeout.
  • Capability and schema drift tests pass.
  • Existing settled, URL, and text waits remain unchanged.
  • No network data is added to command output, logs, flows, or artifacts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:core-protocolHeadlessProtocol: wire protocol, validation, transportarea:linux-hostChromium host (LinuxHost/, CDP)backlogTracked in docs/roadmap/improvements-backlog.mdpriority:highBlocks a roadmap phasestatus:needs-designRequires an architecture-decision entry firsttype:featureNew capability or command

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions