Files
Ray Xi 6fd2f60802 fix(web): answer an empty wallet on Home before the project hand-off (OPEND-3300, OPEND-3309) (#8240)
* fix(web): answer an empty wallet on Home before the project hand-off

A Home send opened the optimistic project frame on the click tick and only
then ran the OpenDesign Cloud balance gate, so a $0 wallet produced a
"准备中" frame first and the balance dialog seconds later — on a Team
workspace up to ~6s, since the gate forces an authoritative upstream read
with retries (OPEND-3300, OPEND-3309).

The shell already holds the wallet reading it shows in the rail. When that
reading is a definitive $0 for the exact send scope, the dialog now opens on
Home immediately: no frame, no project, no request. One background
confirmation re-reads the wallet; only a fundable answer moves the send onto
the ordinary hand-off, and a dismiss in the meantime wins.

Red specs: EntryShell.amr-pending-handoff (OPEND-3300 cases, red on the
unpatched shell) and e2e/ui/home-amr-pending (blocked case now on Home, plus
the stale-$0-then-fundable case).

* fix(web): wait for the workspace identity read before gating a Home AMR send

A Team member with no billing permission and a $0 Team wallet was shown the
personal upgrade dialog on Home while the project page correctly asked them
to find the owner. Home's balance gate read the shell's exact workspace
identity at the click; while that read was still in flight (cold start, a
switch or a sign-in resolving) it had no scope, fell back to the ACCOUNT
wallet and, with no context to name an audience, chose the owner branch.

`awaitHomeAmrGateWorkspaceContext` now holds the send until the read the
shell already has in flight settles (bounded; a read that never settles
returns the draft with the existing "couldn't confirm balance" notice). Send
still never starts identity discovery, and a shell that has settled without a
workspace identity keeps the legacy account-scoped gate.

Pins: settled Team member → owner dialog + Team scope; identity in flight →
the gate waits and then scopes the Team wallet; never settles → notice, no
gate, no dialog.

* fixer: address PR #8240 follow-up items

Generated-By: looper 0.13.0 (runner=fixer, agent=codex)

* Revert the Home gate identity wait and its test adaptations

Reverts 8ee3a105c1 ("wait for the workspace identity read before gating a Home
AMR send") and 0fdd577c1c (the fixer's test changes on top of it), restoring
the approved state of this PR.

The change rested on an unconfirmed reading of a QA report and altered a
deliberately pinned behavior without a product decision: the existing pin
"starts the team gate from in-memory directory identity when sessionStorage
fails" had to be rewritten into "waits for the team identity before gating"
to make CI pass. Both commits are kept on
fix/opend-3300-home-gate-identity-wait until the tester's runtime readout and
the decision are in.

* fix(web): preserve Team authority in local Home balance gate

Forward the selected workspace type and role to the local context endpoint so a Team member or admin with an empty wallet sees the owner top-up dialog on Home. Cover both roles with a daemon-style context response.

---------

Co-authored-by: Amy <1184569493@qq.com>
2026-09-18 10:27:25 +00:00
..