Skip to content
Source
Sign inSign up
pingdotgg/t3code

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 intomain fromrefs/pull/48205/headopened View on GitHub

    1. chatgpt-codex-connector[bot](GitHub profile, opens in a new tab)commented
      Codex Review Summary: ✅ Completed

      This comment shows the latest Codex review activity on this pull request.

      ReviewStatusCommitReview trigger
      📝 Code Review✅ Completed 2026-12-03T11:23:54.126542Zfcc1961PR opened
      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review" or "@codex security review".

      Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    2. tanstack-source added labelsbug

    3. Opened against the wrong repository by mistake (meant for a fork). Sorry for the noise.

    4. Macroscope skipped reviewing this pull request. Per-review cost limit exceeded (workspace setting).

      This review would cost an estimated $17.57, which exceeds your per-review limit of $15.00.

      The top 3 files driving up this estimate:

      FileDiff SizeEstimate
      scripts/rebrand.ts60.66KB$2.43
      apps/server/src/bots/import/sources.ts40.47KB$1.62
      apps/web/src/components/bots/BotsPage.tsx39.40KB$1.58

      Tip

      To get this pull request reviewed, you can:

      1. Comment @macroscope-app on this PR to request a manual review (monthly spend limits still apply).
      2. Exclude the file(s) above from review by adding a pattern to your .macroscope/ignore.md — note that creating this file replaces Macroscope's built-in default ignores rather than extending them.
      3. Raise your cost limit in your workspace billing settings.
      [Turn off this reminder going forward](https://app.macroscope.com/pingdotgg/settings#Personal)
    5. This PR changes the test suite by +213 test cases (browser +70, unit -49, server +192).

      New browser test files: apps/web/src/components/bots/BotDeliverablesPanel.browser.test.tsx, apps/web/src/components/bots/BotEventConnectorPanel.browser.test.tsx, apps/web/src/components/bots/BotExceptionsInboxPanel.browser.test.tsx, apps/web/src/components/bots/BotMemoryMarkdownEditor.browser.test.tsx, apps/web/src/components/bots/BotMemoryProposalsPanel.browser.test.tsx, apps/web/src/components/bots/BotProceduresPanel.browser.test.tsx, apps/web/src/components/bots/BotRunReportsPanel.browser.test.tsx, apps/web/src/components/bots/BotUnattendedProfileSection.browser.test.tsx, apps/web/src/components/bots/BotsPage.browser.test.tsx, apps/web/src/components/bots/BotsSidebar.browser.test.tsx, apps/web/src/components/bots/PipelineEditorDialog.browser.test.tsx, apps/web/src/components/bots/VerificationReportCard.browser.test.tsx, apps/web/src/components/chat/DecisionCardList.browser.test.tsx, apps/web/src/components/in-flight/InFlightPanel.browser.test.tsx, apps/web/src/components/settings/DowntimeRecoveryPanel.browser.test.tsx, apps/web/src/components/settings/TelegramNotificationSettings.browser.test.tsx. Each browser test file costs CI seconds of module loading before its first test runs; a unit test costs milliseconds.

      Keep tests that would fail for a real reason, and test logic below the UI where it can be. See Testing.

    6. Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — The comparison adds "schemaClassMissingBrand": "off" in tsconfig.effect.json, disabling an Effect static-analysis diagnostic. That suppression requires explicit human review.

      Needs human approval because:

      • Per-review cost limit exceeded (workspace setting). Approvability relies on correctness review in order to determine eligibility
      Review your spending limits in [Billing settings](https://app.macroscope.com/pingdotgg/settings/billing), or comment `@macroscope-app review this PR` to bypass the limit and review now. You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    7. Closing this: Thanks for opening #48205, but this is repository noise rather than a change to review. The pull request has an empty summary and a repository-wide unrelated diff, and you confirmed that it was opened against the wrong repository by mistake.

      Please open the intended change against the correct fork or repository if you still want it reviewed.

    8. 💡 Codex Review

      Here are some automated review suggestions for this pull request.

      Reviewed commit: fcc1961319

      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review".

      If Codex has suggestions, it will comment; otherwise it will react with 👍.

      Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

      @@ -0,0 +222,21 @@
      222+ Effect.gen(function* () {
      223+ yield* fileSystem
      224+ .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;
      chatgpt-codex-connector[bot](GitHub profile, opens in a new tab)commented

      P1 Badge Bound the slug search when IDs exceed the schema limit

      When an existing entity has a slug near the 48-character ID limit, the next suffixed candidate is rejected by decodeId, and this unbounded loop keeps trying overlong candidates forever. Because the loop is synchronous and runs under mutationLock, creating a duplicate long team or pipeline name can peg the server's event loop and block further requests; reserve space for the suffix or fail when it cannot be decoded.

      Useful? React with 👍 / 👎.

      @@ -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.askingQuestion
      178+ : COPY.waitingApproval
      179+ : shell.hasActionableProposedPlan
      180+ ? COPY.proposedPlan
      181+ : 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 new
      187+ // 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),
      chatgpt-codex-connector[bot](GitHub profile, opens in a new tab)commented

      P2 Badge Include plan and guest-message identity in dismiss signatures

      When no runtime request is pending, the plan component is the literal "plan" and guest waits are identified only by their current count. If a user dismisses and resolves a plan or guest message, then a new one appears with the same boolean or count, it has the same key and signature and remains hidden. Include a changing plan/message identity or clear the dismissal when the previous item resolves.

      Useful? React with 👍 / 👎.

      @@ -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 === true
      83+ : 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 === null
      89+ ? []
      90+ : selectBotExceptionsInbox({
      91+ environmentId,
      92+ shells: [],
      93+ bots: [],
      94+ tasks: [],

      P2 Badge Include bot-thread and task data in the mobile inbox

      On mobile, WorkflowsScreen.tsx:226-234 supplies only workflow snapshots, and this call hardcodes shells, bots, and tasks to empty. The opt-in inbox therefore cannot display pending or failed bot threads or failed scheduled bot runs, even though the shared selector and web inbox support them; load those sources or scope the mobile feature copy to workflows.

      AGENTS.md reference: AGENTS.md:L56-L59

      Useful? React with 👍 / 👎.

Sign in to join this conversation.