Repository navigation
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
The check, check-test, and check-nix workflows are waiting for fork-run approval. Could a maintainer authorize them when convenient? The PR includes the exact local regression commands and their results. Thank you. |
There was a problem hiding this comment.
Looks correct. I ran the reproduction script from #34853 on both checkouts. On the base, two form replies, a reply plus a cancel, and permission once plus reject all succeed and send conflicting events. With this change, the second caller gets Form.AlreadySettledError / Permission.NotFoundError and only one event goes out. form.test.ts and permission.test.ts pass (160 tests) and tsc is clean. The claim on each request is taken before anything yields, so replies from inline listeners, the reject/always cascades and close() all see it.
Public API: unchanged (same events, error types and service methods; a losing reply just gets the existing error).
Two small failure-path problems are noted inline: the publish/save order for "always", and a duplicate cancel when close()'s own publish fails.
The tests are much larger than the fix needs, about 600 lines for 168 lines of source. The release-signal harness, the polling checks for immediate failure and the scheduler-budget loop (3/8/32) make them hard to follow. Please cut them down to the core cases: two replies, reply vs cancel, a permission reply race, an inline listener replying again, a retry after a failed publish, and close skipping an in-flight reply. Please also drop the unrelated Prettier reflow of the shell-scanner grants data in permission.test.ts.
|
Thank you for reproducing the original races and for the detailed review. 78857fc addresses both failure paths. The tests now use direct races and inline callbacks. I removed the scheduler-budget loop and shared release-signal harness, consolidated overlapping cases, and restored the original Validation: 1,560 focused tests passed; the committed tree also passed 250 related tests and 6 MCP elicitation tests. Both core typecheck commands and focused lint passed. The PR body records the full-workspace check's local dependency limitation. |
There was a problem hiding this comment.
Both earlier points are resolved. permission.ts now saves an "always" approval before publishing permission.replied, so a failed save no longer leaves an extra event on retry. In form.ts, cancels started by close() (and by create after close) make one publish attempt and are not retried in cleanup, while a reply that close skipped is still cancelled by its owner if its publish fails. The tests are trimmed: the scheduler-budget loop is gone and the unrelated shell-scanner reflow is reverted.
I re-ran the #34853 reproduction at this commit: all three cases now settle once, and the loser gets AlreadySettledError / NotFoundError. form.test.ts and permission.test.ts pass (156) and tsc is clean.
Public API: unchanged.
No further concerns.
|
Supplemental hosted-runner validation for
The initial unit failures are retained in the first run. Missing ripgrep caused the same search-test failures on the baseline; the follow-up prepares the repository-pinned ripgrep 15.1.0 before testing and uses The PR source is unchanged, and all source-integrity checks pass. Full results and the verified artifact manifest include all attempts and runner versions. This is supplemental validation of fixed commits while upstream workflow authorization and review remain pending. |
Signed-off-by: liyinlong <[email protected]>
There was a problem hiding this comment.
The new commit only merges current dev into the branch. The Form/Permission changes are identical to the commit I last reviewed, and the earlier points remain resolved. On the merged head the #34853 reproduction still settles once in all three cases, form.test.ts and permission.test.ts pass (156), and tsc is clean.
Public API: unchanged.
No new concerns.
Issue for this PR
Closes #34853
Type of change
What does this PR do?
Claim each Form or Permission request before publishing its settlement event. Concurrent replies, cancels and permission cascades fail or skip immediately, including inline listener re-entry.
alwayssaves approvals before publishing; failed storage keeps requests retryable while the service is open.The owner retains cleanup responsibility when
close()skips an active reply. Shutdown-driven cancellation makes one publication attempt, including when a form is created after shutdown.Follow-up to #52550. Thanks @535628443 (#52550) and @sahiljagtap08 (#44340) for the per-request settlement approach. No feature flag is needed for this bug fix.
How did you verify your code works?
Current head
e3c7b3478ad1d3449fa9375cb77660ab8caca927, based on dev36f559b0c6cb61ebd3431d69d287809bf66acbc5, using Bun 1.4.4 on WSL2/Linux:bun run checkpassed: lint and 35/35 typecheck tasks, with no task-cache hits on the first run.packages/core,bun run test test/form.test.ts test/permission.test.ts: 156 passed, zero failures.The regressions cover concurrent settlements, inline listener re-entry, close/reply races, storage failures, and cleanup after a failed close. Both original failure paths were reproduced before the fix.
Earlier hosted coverage at
78857fca51b85544811616edd82c830e2de22118remains available in the Ubuntu and Windows validation run: all 33 workspace unit tasks passed on each platform; Form/Permission repetition passed 1,560 cases per platform. The artifact manifest records those source revisions and integrity checks. Upstream workflow authorization and review remain pending.Visual
Screenshots / recordings
Core lifecycle fix; UI components are unchanged.
Checklist