Track chart, Polars and EMS follow-ups in Taken

Capture native Qt teardown diagnostics, second-chart order
resurrection and the deferred Polars 2.x qualification. Add the
closed-dialog retention investigation with ledger correlation,
late-callback routing and future dark-order history requirements.

Keep reachable session history distinct from an established leak;
propose bounds only from measured retention and lifecycle evidence.
Preserve source references, existing task states and explicit
live-operation gates.

(this patch was generated in some part by coding harnesses; this
commit msg was generated by `codex` using GPT-6 (`openai`), exact
model ID unavailable)
wkt/federated_project_stores
Gud Boi 2026-10-30 20:12:21 -04:00
parent 4c13012e0c
commit 665da447d3
1 changed files with 260 additions and 0 deletions

View File

@ -491,6 +491,69 @@ tests passed. Production endpoints still use the legacy protocol.
- [ ] Propose a reviewable commit plan for each qualified implementation.
* TODO Diagnose Qt6 chart teardown SIGSEGV with native backtraces
:PROPERTIES:
:ID: piker-qt6-chart-teardown-sigsegv
:CREATED: [2026-10-19]
:CARRIED: 0
:REPO: /home/goodboy/repos/piker
:CATEGORY: piker.ui
:AI_HARNESS: opencode
:TAKEN_APPEND_OP: piker-qt6-chart-253598-20261019-v2
:TAKEN_APPEND_REQUEST: 63f1f80088fcf82fd10a8c9a21fc0d0b7c1f0dcc58610afb4801af0ca29ccbb9
:END:
Find and correct the invalid Qt/PyQt object lifetime during chart exit.
Next action: inspect the saved PID 253598 core with matching PyQt/SIP
debug symbols, then identify the wrapper passed to cleanup_qobject.
[[file:../ai/diagnostics/20261019-chart-253598/README.md][Core identity, native fault stack and capture limitations]]
[[file:../ai/diagnostics/20261019-chart-253598/gdb.txt::886][All-thread GDB capture; fault-thread stack]]
Context:
Human-selected chart core: PID 253598, actor b1326a, SIGSEGV/MAPERR at
2026-10-19 15:29:39 EDT. Command opened MNQ December 2026 and March 2027
contracts on the IB downstream evaluation worktree. Python 3.13.14,
Qtbase 6.11.1, PyQt6 6.11.0, pyqt6-sip 13.10.2; Wayland/qt6ct loaded.
GDB captured 82 threads and shared-library paths. Native fault chain:
Python finalization/atexit -> cleanup_on_exit -> sip_api_visit_wrappers
-> cleanup_qobject -> sip_api_get_address.
Concerns:
The human reports this class of crash since the Qt6 migration. Guest
mode/Qt-loop teardown ordering is a hypothesis, not a proven root cause.
The saved stack places this fault in PyQt/SIP finalization, not directly
inside a running Trio guest tick. Most native libraries lack debug info;
arguments, locals and source lines remain unavailable. The systemd core
can expire; its exact storage path and boot ID are in the report.
Preceding Python output includes MainWindow self-SIGINT/KBI and FSP
cancellation groups. Preserve these as separate observations; daemon
survival and unaffected sibling charts do not prove clean chart exit.
Execution:
- [ ] Preserve the selected core outside systemd expiry and resolve
matching PyQt/SIP/Qt/Python debug symbols without changing live services.
- [ ] Inspect the faulting SIP wrapper and QObject ownership/deletion
state; distinguish use-after-free, repeated cleanup and ABI mismatch.
- [ ] Compare terminal process-group SIGINT, root-only SIGINT, actual
window close and structured QtractorSession shutdown in owned processes.
- [ ] Compare the evaluation lifecycle against wkt/live_chart_qtractor;
account for its dirty test/startup work separately from committed HEAD.
- [ ] Capture ordering of guest completion, Qt deferred deletes,
QApplication lifetime and Python finalization; derive a minimal repro.
Verification:
- [ ] Add a subprocess regression that observes the exit status and
fails on SIGSEGV/native abort; use deterministic lifecycle gates where
needed rather than sleeps or blanket cancellation suppression.
- [ ] Repeat the repro with the focused fix, then qualify real-provider
chart exit and independent daemon/remaining-consumer survival.
- [ ] Retain both baseline and fixed diagnostics; distinguish native
crash repair from cancellation-group/debugger-lock follow-ups.
Handback:
Return the identified failing ownership path, symbolized evidence,
focused patch/regression, exact commands/results and unresolved concerns
to this task. Keep acceptance markers human-owned.
* TODO Qualify chart disconnect and reattach with independent service ownership
:PROPERTIES:
:ID: piker-chart-disconnect-reattach-e2e
@ -649,6 +712,116 @@ Return results to source piker, task piker-chart-disconnect-reattach-e2e:
order authorization, linked to the separate native-crash concern.
Use guarded store updates for evidence. Preserve all human-owned task
and checkbox states; passing tests and commits are not acceptance.
** TODO Reproduce terminal-order resurrection during second-chart bootstrap
:PROPERTIES:
:ID: piker-chart-bootstrap-zombie-order
:CREATED: [2026-10-21]
:CARRIED: 0
:REPO: /home/goodboy/repos/piker
:CATEGORY: piker.testing
:AI_HARNESS: opencode
:TAKEN_APPEND_OP: piker-chart-bootstrap-zombie-order-20261021
:TAKEN_APPEND_REQUEST: d247a9738e0b8b1463a84e9bc8c1e9193d83b72bc63d81b1abef0f64c09e1dfc
:END:
Qualify canonical order-state and graphical convergence when already-live
chart B repeatedly submits and immediately cancels orders while chart C
is bootstrapping against the same independently owned EMS/pikerd.
Next action: after upstream baseline reconciliation, identify real C-side
order snapshot/replay and live-subscription handoff gates. Keep B and EMS
responsive. Do not replace this scenario with cancellation between two
fully-ready charts. No test implementation or order execution is recorded.
Context:
Sibling lander agent supplied the corrected human-observed trigger in
section 7b of the updated QA handoff:
[[file:/home/goodboy/repos/piker/wkts/ib_downstream_pin_eval/ai/plans/20261019-chart-disconnect-e2e-handoff.md::215][7b: second-chart bootstrap submit/cancel race]]
The proposed name test_cancel_during_second_chart_order_bootstrap is not
yet a runnable test node. C was observed to retain an order already
cancelled in B and EMS. Exact causal ordering and whether stale state is
graphical or dialog-local remain unproven; initial retries were elusive.
Execution:
- [ ] Reuse the parent task's independent-daemon/process topology and
record exact Piker/Tractor revisions before reproducing the race.
- [ ] Gate C at actual snapshot/replay and subscription handoff boundaries
with entered/release acknowledgements, leaving B and EMS responsive.
- [ ] Exercise repeated immediate submit/cancel in B with distinct OIDs;
place terminal cancellation before, during and after bootstrap delivery.
- [ ] Add a controlled variant that delivers an older open snapshot after
terminal cancellation. Label this injected ordering as a hypothesis
test, not the established ordering of the manual failure.
- [ ] Cover broker-routed IB paper-account orders and EMS-held dark
orders separately, preserving market-specific dialog routing.
Verification:
- [ ] Compare C's canonical dialog/order state AND graphical items with
the terminal state in EMS; require absent/cancelled state after startup.
- [ ] Deliver deferred replay, duplicate open snapshots and later live
events; prove terminal orders cannot resurrect in state or graphics.
- [ ] Retain OID, broker reqid, market, bootstrap phase and event ordering
in diagnostics. Count canonical records separately from status messages.
- [ ] Preserve separate service-survival and chart-exit outcomes inherited
from the parent task; do not hide teardown errors behind state checks.
Concerns and authority:
Wait for the agreed upstream baseline before implementation. This logging
request authorizes no live IB connection, order submission/cancellation,
history change, commit or human-daemon attachment. Order execution needs
separate explicit authorization even for paper accounts.
[[id:piker-typed-clearing-migration][Coordinate with typed clearing and order-state migration]]
Handback:
Return exact implemented node IDs and gates, observed versus injected
event sequences, baseline/fixed state AND graphics results, remaining
coverage gaps and required backend/order authorization to this task and
[[id:piker-chart-disconnect-reattach-e2e][the parent E2E assignment]].
Preserve all human-owned task and checkbox states.
* TODO Qualify the Polars 2.x upgrade after PR94
:PROPERTIES:
:ID: piker-polars-2-upgrade
:CREATED: [2026-10-21]
:CARRIED: 0
:REPO: /home/goodboy/repos/piker
:CATEGORY: piker.tsp
:AI_HARNESS: opencode
:TAKEN_APPEND_OP: piker-polars-2-upgrade-20261021
:TAKEN_APPEND_REQUEST: 138f0697b83aafef4d1103ad1dd9564949463d52cd383be97e90021d3fcca382
:END:
Upgrade Polars deliberately after the packaging/runtime landing.
Next action: compare the Polars 2.x migration notes against Piker's
actual DataFrame, expression, dtype and NumPy/Arrow boundary usage.
Context:
PR94's Tractor relock initially selected Polars/runtime 2.0.0.
The human requested avoiding that major upgrade during the landing.
The landing worktree now requires polars >=0.20.6,<2.0.0 and locks
polars plus polars-runtime-32 to 1.44.2. The installed test environment
was still on 1.36.0 when 14 logger/startup cases passed; those results
qualify neither 1.44.2 data paths nor 2.x. Keeping exactly 1.36.0 was
rejected by the universal resolver for a Windows target; 1.44.2 resolved.
[[https://pikers.dev/pikers/piker/pulls/94][PR94 packaging/runtime landing]]
[[file:../../land_flake_update/pyproject.toml::55][Current pre-2.0 bound]]
Execution:
- [ ] Inventory affected Polars calls and migration requirements;
distinguish API removal from dtype, schema and null-value changes.
- [ ] Prepare an isolated 2.x environment and intentional lock update,
preserving the working pre-2.0 environment for comparison.
- [ ] Check timestamp units/time zones, OHLCV schemas, empty frames,
joins/grouping and NumPy/Arrow conversions with representative data.
- [ ] Exercise offline storage/history/accounting data paths and add
regressions only for demonstrated changed behavior.
- [ ] Review supported-platform wheel/runtime resolution; do not hide
resolver failures by narrowing platforms without a human decision.
- [ ] Remove or raise the <2 bound only with the qualified migration.
Verification and handback:
Report exact old/new versions, targeted results, compatibility changes,
remaining gaps and any material performance changes. Request separate
authorization for live feeds, account-state mutation or GUI tests.
The PR94 1.44.2 qualification is a separate near-term gate, not acceptance
of this later major upgrade. Keep task/checklist acceptance human-owned.
* TODO Repair Binance invalid-FQME startup and corrected-feed backpressure
:PROPERTIES:
:ID: piker-binance-invalid-fqme-backpressure
@ -716,3 +889,90 @@ Return the root failure, exact reproduction, source commits, baseline
and fixed regression results, live recovery evidence and remaining
limitations to this task. Live feeds, broker operations, commits and
task acceptance need their own authorization. Preserve existing states.
* TODO Trace closed-order retention and dark-order persistence
:PROPERTIES:
:ID: piker-ems-closed-dialog-retention
:CREATED: [2026-10-30]
:CARRIED: 0
:REPO: /home/goodboy/repos/piker
:CATEGORY: piker.clearing
:AI_HARNESS: opencode
:AI_WKT: /home/goodboy/repos/piker/wkts/ib_downstream_pin_eval
:AI_BRANCH: wkt/ib_quote_cache_eval
:TAKEN_APPEND_OP: piker-closed-dialog-retention-20261030-v2
:TAKEN_APPEND_REQUEST: 8e168fad2fe9559229f2c66d626342de147febb789e057e0003af81b585ab457
:END:
Qualify `DarkBook`-lifetime retention of closed dialogs as useful
session history, measure its cost, and relate it to future offline
dark-order storage and accounting-ledger reconciliation.
Next action: run repeated broker-free order lifecycles and trace
distinct retained OIDs, memory growth, late callbacks and release
when the owning `DarkBook` is discarded.
Context and policy:
Commit dae575e1, "Preserve IB order state through notices and late
fills", retains canceled/closed broker dialogs in `DarkBook._closed`.
This includes normally filled live orders and triggered dark orders;
untriggered dark cancellation removes local state without retaining
it in this table. Repeated callbacks update the same OID entry.
The human considers retaining these entries until `DarkBook`
destruction potentially useful for tracing closed orders against
accounting ledgers and future offline dark-order history. Treat this
as intentional reachable retention, not an established leak or an
instruction to introduce TTL eviction now.
`Status` and `brokerd_msg` are mutable latest-state records, not an
append-only event journal. Determine what additional identity and
event history reconciliation or durable dark-order storage needs.
[[file:../../ib_downstream_pin_eval/piker/clearing/_ems.py::152][Closed-dialog retention implementation]]
[[file:../../ib_downstream_pin_eval/piker/clearing/_ems.py::1163][Existing message-flow history/replay TODO]]
Related work and storage references:
[[id:piker-typed-clearing-migration][Coordinate with typed clearing and order-state migration]]
[[file:../../typed_clearing_protocol/plans/opencode/typed-ems-messaging.md::217][Original Order retention and immutable published snapshots]]
[[file:../../typed_clearing_protocol/plans/opencode/typed-ems-messaging.md::849][Accounting/ledger storage is outside that IPC migration]]
[[file:../../ib_downstream_pin_eval/.agents/skills/piker-clearing-expert/SKILL.md::108][Existing trade-ledger persistence contracts]]
[[file:../../ib_downstream_pin_eval/.agents/skills/piker-clearing-expert/architecture.md::27][Current mutable Status is not a history envelope]]
No dedicated offline dark-order storage task was found in the
selected project store or inspected design references. The links
above are related prerequisites, not evidence that dark intent and
cancellation persistence already exists. Link any canonical storage
assignment found during follow-up rather than duplicating its scope.
Execution:
- [ ] Trace writes, reopening and release of `DarkBook._active`,
`DarkBook._closed` and `DarkBook._ems2brokerd_ids`.
- [ ] Compare untriggered cancellation, triggered cancellation,
ordinary completion, late errors/fills and reopened dialogs.
- [ ] Measure per-order retained entries/bytes over long sessions and
verify that discarded books do not remain referenced elsewhere.
- [ ] Map original OID, broker request ID, execution/transaction ID,
account and market identity across retained dialogs and ledgers.
- [ ] Distinguish zero-fill canceled orders from partial/multiple
fills; do not require one ledger transaction per closed order.
- [ ] Propose the session-history/offline-history contract and only
recommend bounds or eviction if evidence shows they are needed.
Verification and concerns:
- [ ] Add deterministic broker-free lifecycle and teardown coverage.
- [ ] Preserve late-fill/error routing and original request identity.
- [ ] Demonstrate intentional growth while a book lives and release
after destruction; report unexpected retention separately.
- [ ] Keep durable execution ledgers distinct from mutable EMS
projections and from a future dark-order intent/event journal.
A canceled/closed status is not a callback-drain acknowledgement.
Any future eviction must define routing/recovery after removal and
must not silently drop fills or recreate `Error(req=None)`.
Live order execution requires separate human authorization.
Handback:
Return retention traces, ledger-correlation findings, links to any
offline dark-order storage assignment, lifecycle tests and proposed
policy to this task. Preserve human-owned task and checkbox states.