Skip to content

fix(bots): stop listing precheck-skipped automation runs as chats - #51427

Merged
nwparker merged 1 commit into
stablyai:mainfrom
yohangwak:yohangwak/bot-skipped-runs-chats
Nov 28, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
yohangwak:yohangwak/bot-skipped-runs-chats

Conversation

@yohangwak

@yohangwak yohangwak commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When a bot's scheduled automation has a precheck and the precheck says "nothing to do", the run is skipped and nothing starts. The bot's Chats list still added a row for every skip, named after the automation, with nothing behind it. A frequent automation filled the list with these empty rows. Now those skips are not listed as chats.

What Changed

  • Before: each run skipped before launch (skipped_precheck, and likewise skipped_missed, skipped_unavailable, skipped_needs_interactive_auth) added a title-only row to the bot's right-panel Chats list. A 15-minute automation added dozens a day and pushed real chats down. Clicking one opened the run's details page, not a chat.
  • After: a skipped run that left no launch evidence gets no row. Completed, in-progress and dispatch_failed runs, terminal runs, and skips that did open a terminal are listed as before. Every skip is still in the automation's run history (Automations page, orca automations runs) and in the bot's Activity section.
  • Mechanism: terminalRunChats in src/main/bots/bot-chat-tree-rows.ts lists automation runs that have no chat of their own (meant for terminal-only runs). It now drops a run whose status tone is skipped (getToneForAutomationRunStatus) when it has no launchedAt, no terminalPaneKey and no terminalSessionId. The launch fields are checked first, so launched runs short-circuit before the status check. Older records may lack launchedAt, so the terminal fields still count as evidence.

Why

The precheck fails in runAutomationLaunch before the dispatcher runs, so a skipped run never gets a chatSessionId or a terminal. terminalRunChats only checked for a missing chatSessionId and an existing automation, so it treated each skip like a terminal run.

Alternatives considered:

  • Hide every chat-kind run with no chatSessionId: would also hide runs that failed to start, which are worth seeing, and would leave the same problem for terminal-surface automations with a precheck.
  • Hide every skipped status regardless of launch: a skip that kept a terminal pane or session still has something to open.
  • Filter in the renderer: bots.chatTree also feeds the phone and paired clients, so fixing it on the host covers all of them.

Linked Issue

Fixes #51428

Visual Proof

Same isolated profile and steps on both builds: a new bot with an every-minute automation (precheck false), after 3 scheduled runs ended skipped_precheck. Right-panel Chats tab, cropped to the panel.

Before (main) After
Before: Home Chat plus three News check (1m) rows After: Home Chat only

Testing

  • Real app, macOS (by @yohangwak): built main and this branch with an isolated profile, created the bot and automation through the runtime RPC, waited for 3 skipped_precheck runs and read bots.chatTree. main returned Home Chat plus 3 run:<id> rows; this branch returned only Home Chat, and automation.runs still listed all 3 skips.

  • Re-verified at landing with a scratch vitest against terminalRunChats (old copy from main vs new): skipped_precheck/skipped_missed with no launch evidence are dropped; skips with a terminalPaneKey, terminalSessionId or launchedAt are kept; dispatch_failed, completed and dispatching rows are unchanged; runs with a chatSessionId stay excluded.

  • src/main/bots vitest: 542 passed; the only failures are sharing/bot-package-archive.test.ts, which throw "no system keyring" in this sandboxed environment and do not touch the chat tree.

  • Static gates on the touched file: anti-slop oxlint, code-quality oxlint, ast-grep, changed-code quality gate, oxfmt — all clean.

  • Not run on Linux/Windows; the change is platform-independent main-process logic.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns — N/A, no test added: this is one list rule in a read model, below the repo's bar for unit tests.

Performance

None, because it adds an O(1) field check per automation run already iterated on each bots.chatTree read (main process, not a hot path); no I/O, no new polling, no fan-out across rows. Measured terminalRunChats old vs new: 200 launched runs 12.4 vs 12.2 µs/call; 2000 runs with half precheck-skipped 119 vs 86 µs/call (faster, since skipped rows are no longer built).

Risk

Level: Low

The riskiest part is hiding a row someone relied on: before, clicking a skip's row opened that run's details. Only skips with no launch evidence are dropped, and they stay in run history and the Activity section. Paired phones and SSH hosts get the same list from the host's bots.chatTree. No saved data changes; back out with a plain revert.

Review

  • Cross-platform: no platform-specific code.
  • SSH/remote and mobile: rule runs on the bot's host; clients just receive fewer rows, so mixed versions are fine.
  • Agent compatibility: agent-independent.
  • UI: rows removed from a list, no layout or style changes.
  • Security: no new inputs or boundaries.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Original fix by @yohangwak in #51427; squashed onto current main with authorship preserved.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The terminal run chat list now excludes runs classified as skipped when they have no launch timestamp, terminal pane key, or terminal session ID. Existing filters for chat sessions and missing automations remain.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 68fc2

Automation runs skipped before launch no longer appear as empty rows in the bot's Chats list. They remain in automation run history. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: bot automation runs skipped by a precheck are no longer listed as chats. It is specific, short, and matches the raw summary, the PR objectives, and linked issue #51428…
Linked Issues check Passed [#51428] Requirement: a run skipped before launch must not appear as a bot Chats row, but must stay in automation run history. At the reviewed head, terminalRunChats in src/main/bots/bot-chat-tree-r…
Out of Scope Changes check Passed The whole-PR diff against the merge base changes one production file, src/main/bots/bot-chat-tree-rows.ts. It adds one import of getToneForAutomationRunStatus and one private helper `skippedBeforeLa…
Description check Passed The description follows the repository template closely and covers the required sections: ELI5, What Changed (before/after and mechanism), Why (with alternatives considered), Linked Issue (Fixes #5142…
Full details: Title check

Explanation

The title names the main change: bot automation runs skipped by a precheck are no longer listed as chats. It is specific, short, and matches the raw summary, the PR objectives, and linked issue #51428. The title uses the conventional fix(scope) form and is 65 characters long.

Full details: Linked Issues check

Explanation

[#51428] Requirement: a run skipped before launch must not appear as a bot Chats row, but must stay in automation run history. At the reviewed head, terminalRunChats in src/main/bots/bot-chat-tree-rows.ts returns no row when skippedBeforeLaunch(run) is true. That function requires launchedAt === undefined, no terminalPaneKey, no terminalSessionId, and getToneForAutomationRunStatus(run.status) === 'skipped'. The tone helper in src/shared/automation-last-run.ts maps every skipped* status to 'skipped'. In src/main/automations/dispatch/automation-launch-runner.ts, the skipped_precheck path returns through ctx.transition before the dispatcher runs and sets no launchedAt or terminal fields. So the reported case is covered. The diff touches only the chat-tree read model. It does not change run persistence, so skipped runs remain in run history. Runs that launched (launchedAt, terminal pane, or terminal session set) and runs with a chatSessionId keep their existing behavior. The issue does not request automated tests, so the absence of a test does not fail this check.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base changes one production file, src/main/bots/bot-chat-tree-rows.ts. It adds one import of getToneForAutomationRunStatus and one private helper skippedBeforeLaunch, and adds that helper to the existing filter condition in terminalRunChats. Every change serves the objective in #51428. No unrelated files or behavior changes appear in the reviewed diff. The raw summary and PR description match the code.

Full details: Description check

Explanation

The description follows the repository template closely and covers the required sections: ELI5, What Changed (before/after and mechanism), Why (with alternatives considered), Linked Issue (Fixes #51428), Visual Proof (before/after images in a table), Testing (manual macOS test plus scratch vitest and static gates), Performance (a concrete justification with measurements), Risk (Level: Low with a back-out plan), Review, and the checklist. The Linked Issue, Visual Proof, Performance and Risk sections are all substantively filled in. The only unchecked item is the test anti-pattern checkbox, which the author explains as N/A because no test was added. The explanation for that is reasonable, so this is a minor gap at most. The AI Disclosure section is left as the template comment, which is acceptable for a maintainer-authored change but could be stated explicitly.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c93544d4-c79f-44ff-90f0-1ecc9b09e09a
Commits

Reviewing files that changed from the base of the PR and between cad6425 and 68fc293.

Files selected for processing: 1

  • src/main/bots/bot-chat-tree-rows.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

A bot automation run skipped before launch (failed precheck, missed,
unavailable, needs interactive auth) has no chat or terminal, but
terminalRunChats listed it as a title-only row in the bot's Chats tree.
Leave out skipped runs with no launchedAt, terminal pane or terminal
session; the skips remain in the automation's run history.

Fixes stablyai#51428
@nwparker
nwparker force-pushed the yohangwak/bot-skipped-runs-chats branch from cad6425 to 68fc293 Compare November 28, 2026 04:38
@nwparker
nwparker merged commit 09d3a4c into stablyai:main Nov 28, 2026
55 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Each precheck-skipped automation run adds an empty row to the bot's Chats list

2 participants