piker/ai/prompt-io/opencode/20260924_ib_idle_timer.md

1.5 KiB
Raw Permalink Blame History

Prompt

The human reported silent IB roaming and requested an immediate fix after investigation found the custom nanosecond timestamps incompatible with ib_async’s datetime-based idle timeout arithmetic.

Response summary

Override NonShittyWrapper._setTimer to accept integer nanosecond packet timestamps while delegating datetime/sentinel states upstream. Keep the packet timestamp unchanged on integer-path expiry, clear the timer before timeoutEvent emission, and preserve reentrant listener rearming. No default heartbeat, reconnect, or idle-timeout arming is introduced.

Files changed

  • piker/brokers/ib/api.py: compatible idle timer arithmetic/lifecycle.
  • tests/test_ib_wrapper_timeout.py: three deterministic offline tests.

Verification

Nineteen tests passed: new wrapper-timeout regressions and existing IB history/method-proxy tests. Restoring the upstream method in memory reproduced datetime-minus-int TypeError. No IB service or live network was contacted; installed dependencies and original user work were unchanged. The isolated worktree index remains unchanged.

Human contributions

The human supplied rfkill/suspend/roam evidence, requested a session health design, and prioritized fixing the discovered timestamp mismatch. The implementation deliberately preserves their nanosecond feed schema. Acceptance and live validation remain pending.