Skip to content

perf(opencode-claimant): cut poll.py end-to-end latency (parallelize + bound its sequential external reads) #13135

Open

Description

@dezren39

Problem

pm-stack/opencode-claimant/poll.py takes 43–100s wall with only ~2s CPU per run (measured 2026-11-23: 73.8s by the #13112 triage, 55–100s in the #13112 evidence, 74.2s / 43.5s in Lane OI's timed runs). The time is waits on sequential external reads: turso ledger SELECTs via the turso-exec helper, broker queue queries (claimed + handed_off per queue), and the OpenCode server session list over a 28k+ root-session store.

#13112 fixed the starvation symptom by raising claimant.py's gate timeout 30s -> 300s (PR #13134). That leaves the gate budget ~3x the observed worst case, but poll latency itself keeps growing with the session store, and every claimant fire pays it.

Ask

Reduce poll.py's own end-to-end latency so the gate budget has durable margin:

Acceptance

Context

Activity

  1. developing-today commented on Nov 23, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Pickup — xaltha lane taking #13135.

    Plan: parallelize poll.py's independent external reads (ledger bindings SELECTs, per-queue claimed/handed_off, session list, active-id set) and bound each read with an explicit per-read timeout plus a recorded slow-read note, keeping the JSON output contract byte-compatible (pinned #6609 semantics unchanged). Verification: hermetic suite (run_hermetic_tests.py) in the sandbox, then 10 timed runs on the laptop for the p99 < 30s acceptance.

  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    PR opened: #13210 (branch xaltha/13135-poll-latency @ 607e16ece).

    Verification: hermetic suite (pm-stack/opencode-claimant/run_hermetic_tests.py) green via remote dispatch — https://github.com/developing-today/fleet/actions/runs/45159877756 (conclusion: success). The earlier conflicting reports are resolved: no prior dispatch result for this branch was recoverable (no handle recorded), so verification was re-run fresh on the rebased head and passed; no failing tests to attribute to main vs. the change.

    Note: fleet queue dispatch from this seat fails with invalid peer certificate: UnknownIssuer (seat fleet binary predates the platform-verifier fix, code#13122); this run used the documented raw-workflow fallback (gh workflow run fleet-command.yml --repo developing-today/fleet).

    Remaining acceptance items, listed in the PR for post-merge follow-up: laptop p99 timing over 10 runs < 30s (bench_poll_timing.py) and a live claimant fire showing the reduced poll duration.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions