fix(web): prevent duplicate session creation - #1222
Merged
Merged
Conversation
There was a problem hiding this comment.
Findings
None.
Summary
Review mode: initial
No issues found in the latest diff. Residual risk: tests were not run here because the review security instructions prohibit executing code from PR content; this pass relies on diff/source inspection and the contributor-reported validation.
Testing
Not run (automation/security constraint).
HAPI Bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause
handleCreate()awaitedcheckPathsExists()before calling the TanStack spawn mutation. The mutation'sisPendingflag was therefore still false during directory validation, leaving Create enabled. A second activation started another handler, and both handlers independently reached/spawn.Impact
A double-click/double-tap or repeated activation on a slow connection could start two agent processes. The shared form means this was not Codex-specific even though Codex exposed the report.
Validation
bun typecheck— passbun run --cwd web test --run src/components/NewSession/index.test.tsx— 9 passedgit diff --check— passbun run test— unrelated existing CLI integration/flaky suites fail in this long-running local HAPI environment; the changed web suite passes. CI is the clean-environment full-suite gate.Fixes #1220
AI disclosure: Codex assisted with root-cause analysis, implementation, regression testing, and PR drafting. The diff and test results were manually reviewed.