fix(bots): harden exceptions inbox state and collection store atomicity #48205
Closedkodji7202-code(GitHub profile, opens in a new tab)wants to merge 199 commits into
main fromrefs/pull/48205/headopened View on GitHubtanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- @@ -0,0 +222,21 @@222+ Effect.gen(function* () {223+ yield* fileSystem224+ .remove(filePath(id))225+ .pipe(226+ Effect.mapError((cause) => entityError(`Could not delete the ${input.kind}.`, cause)),227+ );228+ yield* reloadUnlocked;229+ }),230+ );231+ });232+233+ const allocateId = Effect.fn("CollectionStore.allocateId")(function* (name: string) {234+ return yield* mutationLock.withPermits(1)(235+ Effect.gen(function* () {236+ const base = slugify(name);237+ const current = yield* SubscriptionRef.get(state);238+ const reserved = yield* Ref.get(reservedIds);239+ for (let suffix = 0; ; suffix++) {240+ const candidate = suffix === 0 ? base : `${base}-${suffix + 1}`;241+ const decoded = input.decodeId(candidate);242+ if (decoded === undefined) continue;@@ -0,0 +172,21 @@172+ const delivery = shell.activeRunId === null && (hasPullRequest || hasIssues);173+ if (waiting) {174+ const reason =175+ pending !== null && pending.kind !== "auth_refresh"176+ ? pending.kind === "user_input"177+ ? COPY.askingQuestion178+ : COPY.waitingApproval179+ : shell.hasActionableProposedPlan180+ ? COPY.proposedPlan181+ : COPY.guestMessages;182+ items.push(183+ makeItem({184+ ...base,185+ key: `bot_thread:${shell.id}:waiting`,186+ // The pending request's own id is the exception's identity: a new187+ // request resurfaces, unrelated thread movement does not.188+ signature: signatureOf([189+ shell.id,190+ "waiting",191+ pending?.id ?? (shell.hasActionableProposedPlan ? "plan" : null),192+ String(guestCount),@@ -0,0 +74,21 @@74+ * The bot exceptions inbox on the Workflows tab, over the snapshots the screen already holds.75+ * No extra query runs for it, and a dismiss is local to the device and reversible.76+ */77+export function BotExceptionsInboxSection(props: BotExceptionsInboxSectionProps) {78+ const gt = useGT();79+ const messages = useMessages();80+ const preferences = useAtomValue(mobilePreferencesAtom);81+ const enabled = AsyncResult.isSuccess(preferences)82+ ? preferences.value.botExceptionsInboxEnabled === true83+ : false;84+ const [dismissed, setDismissed] = useState<Readonly<Record<string, string>>>({});85+ if (!enabled) return null;86+87+ const items = props.sections.flatMap(({ environmentId, snapshot }) =>88+ snapshot === null89+ ? []90+ : selectBotExceptionsInbox({91+ environmentId,92+ shells: [],93+ bots: [],94+ tasks: [],
Sign in to join this conversation.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
fcc1961ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.