Repository navigation
Conversation
…tartup The gate now tells a role it could not read (timeout, offline, refused, a sign-in under the read) from a definite no; tomari:open answers reason 'unknown' for the former, and the slot asks again a few times (2, 5, 15, 30, 60 s) — never after a definite no. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HCZRwqpGXuZgGQRpurpGKB
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HCZRwqpGXuZgGQRpurpGKB
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.
概要(オーナー向け)
startup-timeline.logの 0.7.10 の行:会社一覧の取得が最大 6.3 秒)。とまりを出してよいかの確認(会社での役割の読み取り)は5秒で打ち切るため、「分からない」が「出さない」と同じ扱いになり、そのあと誰も聞き直していませんでした。サーバーの記録で 200 が返っているのは、アプリ側が待つのをやめた後にサーバーが答えたためです。Details (English)
Confirmed cause.
tomari:open(→session.open→gate.shown) is asked once when the company comes on screen. The gate reads the role withGET /api/companiescut atROLE_READ_TIMEOUT_MS(5 s). The owner'sstartup-timeline.logfor 0.7.10 shows every server call in that window taking ~6.3 s (api:getCompanies=3x…/max 6274 ms,writeAccess:get max 6379,api:getDepartments 6301, …; the company opened at 8.1 s, the shell at 8.2 s), so the role read aborted →null→{ offered: false, reason: 'not-shown' }, which the slot never asked again (onlykeyEpoch— the settings closing — ortomari:changeddid). The server logged 200 because it answered after the client had aborted. The sign-in race (gate.forget()inonSignedIn) is not the trigger at startup:onSignedInruns insideauth:getSession, before the renderer has a user and so before the slot's first open; it is still covered (a dropped read is now 'unknown').Change.
electron/features/tomari/gate.ts: newanswer(companyId): Promise<boolean | 'unknown'>(shown=answer === true, so every other caller is unchanged). 'unknown' = switch on, signed in, and the role read failed / timed out / was refused / was dropped by a sign-in change. A definite no = switch off (also turned off during the read), nobody signed in, or the server answered without this company.companyRoleFromServernow throws on a non-OK response instead of returning null (a 503 or 401 is "not read", not "not in the company"). An unknown role is still never kept.electron/features/tomari/session.ts:openreturnsreason: 'unknown'for the gate's 'unknown' (still no id); main passestomariGate.answer.shared/tomari-screen.ts:tomariOpenMayAskAgain(only'unknown','signed-out','unreachable') andTOMARI_OPEN_ASK_AGAIN_MS= 2, 5, 15, 30, 60 s.src/features/tomari/hooks/useTomariSlot.tsx: after such a no, one timer at a time re-runs the same open path; reset on a definite answer or an offer, cleared on the subscription's cleanup (company / account / settings change, unmount).chat-and-agents.md("Who sees とまり: one gate") updated.Checklist 1 — invariants. (a) No id from
tomari:openunless the gate answerstruenow — unchanged; the retry only re-asks the same gate. (b) 「とまりを使う」 off is a definite no (also when turned off during the read) and closes everything at once as before. (c) Re-asking is bounded (≤ 5 per subscription, ~2 min) and never follows a definite no or'agent'. (d) An unknown role is never kept. Guarded bytests/tomari-gate.test.ts(new: 'unknown' vs definite no asopen's reason; dropped-by-sign-in → 'unknown'; switched off during a failed read →false; refused → throws) andtests/ui/tomari-talk.spec.ts(new, Playwright clock: a role not read at startup → the box and pinned row come by themselves; never read → exactly 1 + 5 asks then nothing until the settings close; a definite no → asked once). Mutation-checked: disabling the slot's timer, retrying on any no, unbounded retries,openmapping 'unknown' to 'not-shown', the gate returning null for a dropped read, the switch re-check, and!response.ok → nulleach fail a test.Checklist 6 — what cannot be undone. IPC contract:
TomariOpenResult.reasonwas already a free-form string (log only); a new value'unknown'is additive and older screens treat it as before (not offered). No DB, wire format or push-marker change. Permission boundary unchanged (main decides; the renderer only asks again).Checklist 7 — failure, time, concurrency. Stops halfway / runs twice: a retry is just another
tomari:open; concurrent asks share the gate's one in-flight read (reading). Company or account switch during a wait: the subscription cleanup clears the timer, and a late answer for another key is ignored (onScreen.current !== k). Server down for long: 5 extra asks then quiet. Clock: browser timers only; the gate's kept-role clock is unchanged (performance.now()).Reviews.
codex review --base origin/main: no actionable findings. Second opinion (agy, read-only): (1)(2) an oldertomari:openanswering after a newer one (settings closed meanwhile, A→B→A) could overwrite what is held and arm retries on the new subscription — fixed: only the latest open's answer applies (openscounter), test 「an older ask answering late changes nothing」, mutation-checked; (4) the subscription did not re-run when only the account changed — fixed (userIdin its deps). (3) atomari:changedduring a settings reopen can reuse the previous id from the closure — pre-existing and unchanged by this PR; main closes every id at switch-off (session.closeAll), so such an id runs no turn, read or save; left as is.Decisions for the owner
tomari:changedafter sign-in: the cause was a timeout, not a missing sign-in signal, and a signal-only fix would not help. Safe side: bounded, at most 5 extraGET /api/companiesper app start in the bad case.🤖 Generated with Claude Code
https://claude.ai/code/session_01HCZRwqpGXuZgGQRpurpGKB