Skip to content

Guard bot item updates against stale reads - #49816

Merged
brennanb2025 merged 5 commits into
mainfrom
brennanb2025/outdated-question-633
Nov 27, 2026
Merged

brennanb2025 merged 5 commits into
mainfrom
brennanb2025/outdated-question-633

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

A bot could read an item, then bring back an old question after you had answered it. Now a bot can tell Orca to save its update only if the item has stayed the same since it read it. If the item changed, Orca refuses the update and tells the bot to read again.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54
Prod 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​111 $\color{#cf222e}{\Huge{\mathbf{−}}}$​12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​99

What Changed

bot item show displays the version from the same database snapshot as the activity. bot item set --expected-version checks it before copying files and again during the save. Bot instructions show when to use the check.

Why

A second chat can still update an item after reading it. If another update arrives first, the stale request creates no activity or mail.

Linked Issue

Maintainer change tracked internally.

Visual Proof

Seeded before and after

The same development build ran the control without the version check and the updated flow with it.

Without the version check, the old question becomes current again
With the version check, the Orca terminal refuses the old update
Bot guidance from seeded turns and a labeled mock of the unanswered-question reminder

Testing

  • Seeded Linux app and CLI exercised stale, current, and unchecked writes from a second bot chat.
  • Store test checks status, activity, and mail on refusal. Race replays verified the read snapshot, zero copies on early refusal, and a concurrent winner's file remaining readable.

Performance

A checked write requests host capabilities and compares versions on existing item reads. Showing an item loads its row and activity together. The host advertises the CLI capability without increasing the phone bundle size.

Risk

Level: Low. An older host refuses a checked CLI write with an update message. If an item changes during file copying, Orca refuses the update and may retain unused copies for as long as the item chat exists. Revert the PR to restore the previous behavior.

AI Disclosure

Review

Check that a refused update preserves the owner's answer and that files used by saved activity stay readable.

Agent skill upstream boundary

  • No upstream skill-installer source is involved.

Notes

The new flag is optional. The JSON output already includes the item version.

Checklist

  • Behavior, compatibility, risk, and revert documented.
  • Before and after evidence attached.
  • CI covers cross-platform checks.

@brennanb2025
brennanb2025 marked this pull request as ready for review November 26, 2026 11:40
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Bot item show now displays the item version and retrieves the item view with its event page. Bot item set accepts an optional expected version. The CLI validates the value and checks runtime capability before sending a versioned write. The runtime checks the expected version before updating and rejects stale writes. Bot guidance and command help now describe reading and supplying the version.

Merge Risk: Minimal · up to 4c39c

Bot item updates can now carry an optional version check that refuses stale writes, and item show displays the version. No concrete merge-blocking risk was found in the supplied changes. Older hosts refuse checked CLI writes, as the author describes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Guard bot item updates against stale reads" matches the main change: optional version checks via --expected-version that refuse bot item set writes when the item has changed since it was re…
Description check Passed The description follows the template sections (ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill upstream boundary, Notes, Checklist) …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Guard bot item updates against stale reads" matches the main change: optional version checks via --expected-version that refuse bot item set writes when the item has changed since it was read. It is specific and concise, and it does not describe anything absent from the changeset.

Full details: Description check

Explanation

The description follows the template sections (ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill upstream boundary, Notes, Checklist) and explains the mechanism, the user-facing before/after, and the risk and revert path. The Risk level is filled in as Low. Gaps: the Linked Issue section says only "Maintainer change tracked internally" and has no issue reference, the Testing section does not state which automated test commands ran, the Testing checkbox for manual testing is unchecked, the Performance section does not state a measured impact, the AI Disclosure section is empty, and the Review section is not a required template field. Because the description is mostly complete, the check passes, but these items should be reviewed.

  • 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: 3981ff5b-9e07-4043-a963-6a2650366ec7
Commits

Reviewing files that changed from the base of the PR and between 87d0a04 and 4c39c0f.

Files selected for processing: 1

  • src/shared/rpc-contract/bots-items-params.ts

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

@brennanb2025
brennanb2025 marked this pull request as draft November 26, 2026 11:49
@brennanb2025
brennanb2025 marked this pull request as ready for review November 26, 2026 12:31
@brennanb2025
brennanb2025 marked this pull request as draft November 27, 2026 02:03
@brennanb2025
brennanb2025 marked this pull request as ready for review November 27, 2026 02:05
@brennanb2025
brennanb2025 merged commit 524b036 into main Nov 27, 2026
94 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.

1 participant