feat(connector): add Telegram /uta panel for pending trade approval - #1142
Conversation
Ask Alice and Auto Quant already leave committed UTA operations waiting for a human push. Approve/Reject now exists as a Telegram inline form the same way /settings does, so the owner does not have to open Trading as Git for every commit. Connector still does not talk to UTA. /uta enqueues a bounded review, push, or reject action; Alice drains it through UTAManagerSDK, honors lite/readonly, and posts a directed presentation back. Callback data stays page-local. Discord and Slack keep a placeholder.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
luokerenx4
left a comment
There was a problem hiding this comment.
Blocking audit feedback — please do not merge until these items are addressed.
The owner-only Telegram state machine and the Alice/Connector/UTA separation are a solid direction. However, this surface can authorize live broker writes, and two approval-integrity gaps need to be closed before merge.
Required changes:
-
Make pending-hash validation atomic at the UTA write boundary. The current Alice-side status/check followed by a separate push/reject request is vulnerable to a check-to-use race. Extend the UTA push/reject API and SDK to carry an expected pending hash, validate it inside the same UTA request immediately before mutation, and return a typed conflict without executing when it differs. Connector push/reject requests should require the reviewed hash rather than treating it as optional.
-
Never enable approval for operations the Telegram panel did not disclose. The review currently serializes only the first eight staged operations, while push executes the complete staging area. Either paginate all operations before enabling confirmation, or disable remote push/reject for oversized commits and direct the owner to Trading as Git. The UI must clearly show the exact total and whether any operations are hidden.
-
Add regression coverage for both boundaries:
- more than eight staged operations cannot be approved from a partial presentation;
- a hash change between review and push/reject produces conflict and makes no mutation;
- missing expected hash cannot reach push/reject;
- readonly still rejects push at both Alice and UTA boundaries;
- duplicate/stale Telegram callbacks cannot cause a second write.
-
This change touches order writes/UTA permissions, so complete the repository's live-paper acceptance lane using a confirmed demo/paper account, exercise the linked Telegram flow, and record that positions/orders were flat after cleanup. Also exercise readonly and stale-hash behavior. Do not use a real-money account.
The focused unit suite is currently green (45/45 locally), and the main CI build/test jobs are green; this is an approval-correctness block rather than an existing test failure.
Note: this is submitted as COMMENT only because GitHub does not allow the PR author account to submit REQUEST_CHANGES on its own PR. Treat the findings as merge-blocking.
Pending-hash checks now happen inside the same UTA push/reject request. HTTP wallet writes require expectedPendingHash; mismatch or absence is 409 and does not mutate. Connector push/reject also require the reviewed hash. Commits larger than the Telegram page are not remotely actionable. Telegram confirm is one-shot (consumed). Trading as Git and AI push pass the pending hash through the same UTA boundary.
|
Review fixes are in 3e92219.
|
|
Follow-up approval-integrity fix pushed in Additional invariant closed after re-audit:
Verification on this commit:
Live-paper and linked Telegram acceptance were not run because this worktree has no operator-confirmed demo/paper account or linked bot. That residual gate remains explicit; no real-money account was touched. |
Why
Pending UTA commits still required a click in OpenAlice → Trading as Git. Telegram already has an inline-button form for
/settingsand/inbox;/utashould be the same kind of owner control for the approval wall.What
/utaplus autacapability./utaopens a review panel. Pending accounts show Approve / Reject, with a confirm step before a live push. Refresh reloads the snapshot. Callback data is page-local (u:a:0), never a raw account id.review | push | reject) is drained by the existing action bridge. Writes go throughUTAManagerSDKso lite mode, readonly mode, and pending-hash conflicts stay on the Alice/UTA boundary. Connector never talks to UTA./inbox.Out of scope
Verification
npx tsc --noEmitcd ui && npx tsc -bpnpm -F @traderalice/connector-protocol typecheckpnpm test— 563 files / 4780 testsLive Telegram delivery still needs a linked bot; CI does not send a real DM.