You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(bots): show "Updated soul applied" on a resumed chat only for a file that changed - #52770
When a bot's agent was stopped for being idle and you wrote to the bot again, the chat said "Updated soul applied · Memory edited outside this chat", even though nobody had touched its files. Now the row shows up on a resumed chat only for a file that really changed since the chat last had it.
What Changed
Before: a resumed agent is sent its SOUL.md and MEMORY.md again, because Orca can't tell what the agent still holds. The row named both files as updated on every resume. A Home Chat woken by a 15-minute automation showed it 10 times in three days, but SOUL.md had been edited only once.
After: the agent is sent exactly what it was sent before. For the SOUL.md and MEMORY.md resent on a resume, the row names only the files that differ from what this chat last had:
Neither file changed: the resend shows no row.
A file was edited or deleted while the agent was stopped: the row names that file.
A change under memory/ can still put Memory in the row, same as on main.
After an Orca restart there are no earlier fingerprints to compare against, so the first accepted turn that carries the files can show both labels, same as on main.
Mechanism: on a resume, launchedBotTurnGiven (bot-turn-given.ts) leaves soul and memory unknown, and plan (bot-turn-context.ts) treated unknown as changed. The launch now also keeps lastHad: the fingerprints the session's previous entry had, carried forward across resumes that were never taken. plan compares against entry.soul ?? entry.lastHad.soul (and the same for memory) to decide what the row names. Nothing else uses lastHad. What gets sent, when it gets sent, and what is recorded as given are all unchanged.
Why
The row says "updated" about a file nobody touched. That sends the owner looking for an edit that never happened, and it buries real edits among the false ones. The root cause is that the row's "changed" check reused the delivery state, which a resume deliberately clears so the files get resent. The fix gives the row its own baseline and leaves delivery alone.
Considered and not done:
Skip resending an unchanged file on a resume. There are too many ways for Orca to wrongly believe an agent still holds the files: an agent that dies after the message is written but before it reads it, a conversation reopened as a new one, or /compact. Missing an edit is worse than resending a small file.
Hide the row whenever the copy is unknown. That would also hide the row for a file that really was edited while the agent was stopped.
Real app on macOS, hidden window, isolated profile, Claude (Haiku) bot, main compared with this branch (captured by @yohangwak). Same steps on both builds: edit both files and send "one" (a real change, so both show the row), let the idle stop end the agent, then send "two" without touching either file.
Before (main)
After
Dark
Light
Still announced on this branch: SOUL.md edited while the agent was stopped, then "three". Only the soul is named.
Testing
Reproduced in a unit probe that goes through the real botSessionInstructions and createBotTurnContext. On main, an idle resume with nothing edited names ['soul', 'memory'], and deleting MEMORY.md while stopped names both files. On this branch they name nothing and ['memory'].
src/main/bots/bot-session-resume.test.ts (new) fails on main at the first resume and passes here. It covers an untaken resume, an edit while stopped, a memory-only edit, and an Orca restart. All of src/main/bots/ passes except sharing/bot-package-archive.test.ts, which fails only because this machine has no system keyring and does not touch these files.
Perf: the resume and plan paths run once per bot turn (main process, not hot). 1000 resume+turn cycles took 1254 ms on both main and the branch, and 1000 steady turns took 45-46 ms on both. Each launch copies two strings and does no new I/O.
Static gates on the touched files: anti-slop oxlint, code-quality native oxlint, ast-grep, and the changed-code quality gate are all clean. oxfmt is clean.
Manual run in the real app on macOS (by @yohangwak; see Visual Proof). Five messages per build, and the bytes sent to the agent matched between builds on every turn. Not run on Windows, Linux, or SSH. The change is main-process state only, with no paths, shells, or wire format.
The change carries SOUL and MEMORY fingerprints across bot-session resumes. Turn planning uses the fingerprints and sent-update flags to identify changed files, then composes updates from nonempty content. Regression tests cover resumes, file edits, untaken turns, and restart behavior.
Severity of issue fixed: Medium
Merge Risk: Low · up to e9aca
After an idle resume, an edit under memory/ may not be named in the "Memory edited" row. The agent still receives the same content, so the impact is a missing label only.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the "Updated soul applied" row on a resumed bot chat now appears only for a file that changed. It is specific, follows the fix(bots) convention, and matches the change…
Description check
The description follows the repository template. It has ELI5, What Changed (before and after), Why (with alternatives considered), a linked issue (Fixes #52771), Visual Proof (before and after images …
Linked Issues check
Issue #52771 requires the update row on a resumed bot chat to name only files that differ from what the chat last had. A file edited while the agent was stopped must still be named. Resending files on…
Out of Scope Changes check
The whole-PR diff touches three files: src/main/bots/bot-turn-given.ts, src/main/bots/bot-turn-context.ts, and the new src/main/bots/bot-session-resume.test.ts. All changes concern the resume ro…
Full details: Title check
Explanation
The title names the main change: the "Updated soul applied" row on a resumed bot chat now appears only for a file that changed. It is specific, follows the fix(bots) convention, and matches the changeset (changedBotFiles, lastHad, and the new test) and the linked issue #52771.
Full details: Description check
Explanation
The description follows the repository template. It has ELI5, What Changed (before and after), Why (with alternatives considered), a linked issue (Fixes #52771), Visual Proof (before and after images in dark and light), Testing with a checklist, Performance, Risk with level and revert path, AI Disclosure, Review, the upstream boundary checkbox, Notes, and the Checklist. Required sections are complete and specific.
Full details: Linked Issues check
Explanation
Issue #52771 requires the update row on a resumed bot chat to name only files that differ from what the chat last had. A file edited while the agent was stopped must still be named. Resending files on resume must stay unchanged. At head, bot-turn-given.ts adds lastHad, filled from the prior launch's fingerprints (prior?.soul ?? prior?.lastHad.soul, same for memory). bot-turn-context.ts computes hadSoul and hadMemory from entry.soul ?? entry.lastHad.soul and entry.memory ?? entry.lastHad.memory. The row names soul only when the current fingerprint differs from hadSoul, and memory only when memoryNow is set and the fingerprint differs from hadMemory, or when topics changed. The updates list still sends the same SOUL and MEMORY text as before, so the resend behavior is unchanged. bot-session-resume.test.ts drives the real botSessionInstructions and createBotTurnContext path. It covers: an unchanged resume with no row, an edit made while stopped that names only soul, a later memory edit that names only memory, and a restart that names both. Discrepancy: the PR summary says changedBotFiles is added to bot-turn-given.ts, but the reviewed diff does not contain that function. The row logic is inline in bot-turn-context.ts. This does not change the verdict, but the description should be corrected. Unverified: the 12 mutation results and the manual app runs are author-reported and were not re-run.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff touches three files: src/main/bots/bot-turn-given.ts, src/main/bots/bot-turn-context.ts, and the new src/main/bots/bot-session-resume.test.ts. All changes concern the resume row fingerprints (lastHad, hadSoul, hadMemory) and the test that checks them. The prior argument passed from createBotTurnContext.launched is part of the same mechanism. No unrelated behavior, UI, schema, or wire-format change appears in the reviewed diff. The change to the empty-plan condition (updates, rules, workNotes) only restructures the existing text assembly and is needed to keep the row logic consistent with the sent text.
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.
…ile that changed
A resumed agent is sent SOUL.md and MEMORY.md again because Orca cannot
tell what it still holds, and the context row named both as updated on
every resume. The launch now keeps the fingerprints the session's prior
entry had (lastHad), and the row names only a file that differs from
them. What is sent to the agent is unchanged.
Fixesstablyai#52771
Co-authored-by: Neil <[email protected]>
Also assert MEMORY.md delivery on unchanged resumes.
The PR objectives require resumed turns to receive both files. This helper checks only SOUL delivery and the status labels. A regression that compares the MEMORY fingerprint against lastHad before generating update text could omit unchanged MEMORY content and still satisfy every assertion here.
Return a separate MEMORY delivery result. Assert that result for the unchanged and untaken resume cases.
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: 8be1e5c5-d13f-41df-9553-58baab1962f4
Commits
Reviewing files that changed from the base of the PR and between 2ed4b1a and e9acad2.
Files selected for processing: 2
src/main/bots/bot-session-resume.test.ts
src/main/bots/bot-turn-context.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Name Memory when a memory/ topic changed while the chat was stopped.
On resume, launched resets the topic baseline and then stores the topics read at launch. A memory/ edit made while the chat was stopped is therefore already in the baseline when plan runs. topicsNow is null, and the Memory label depends on memory !== hadMemory. With MEMORY.md unchanged, that comparison is false. The row omits Memory for the edit. The base showed Memory on every resume, so this change removes a label that should still appear.
Required behavior: a memory/ topic that differs from the snapshot the chat last had must set the Memory label on resume. Keep the topic comparison separate from what the agent is sent. Choose the baseline that drives the label. This change does not decide whether topic text should be sent on resume.
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
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.
ELI5
When a bot's agent was stopped for being idle and you wrote to the bot again, the chat said "Updated soul applied · Memory edited outside this chat", even though nobody had touched its files. Now the row shows up on a resumed chat only for a file that really changed since the chat last had it.
What Changed
Before: a resumed agent is sent its SOUL.md and MEMORY.md again, because Orca can't tell what the agent still holds. The row named both files as updated on every resume. A Home Chat woken by a 15-minute automation showed it 10 times in three days, but SOUL.md had been edited only once.
After: the agent is sent exactly what it was sent before. For the SOUL.md and MEMORY.md resent on a resume, the row names only the files that differ from what this chat last had:
memory/can still put Memory in the row, same as onmain.main.Mechanism: on a resume,
launchedBotTurnGiven(bot-turn-given.ts) leavessoulandmemoryunknown, andplan(bot-turn-context.ts) treated unknown as changed. The launch now also keepslastHad: the fingerprints the session's previous entry had, carried forward across resumes that were never taken.plancompares againstentry.soul ?? entry.lastHad.soul(and the same for memory) to decide what the row names. Nothing else useslastHad. What gets sent, when it gets sent, and what is recorded as given are all unchanged.Why
The row says "updated" about a file nobody touched. That sends the owner looking for an edit that never happened, and it buries real edits among the false ones. The root cause is that the row's "changed" check reused the delivery state, which a resume deliberately clears so the files get resent. The fix gives the row its own baseline and leaves delivery alone.
Considered and not done:
/compact. Missing an edit is worse than resending a small file.Linked Issue
Fixes #52771
Visual Proof
Real app on macOS, hidden window, isolated profile, Claude (Haiku) bot,
maincompared with this branch (captured by @yohangwak). Same steps on both builds: edit both files and send "one" (a real change, so both show the row), let the idle stop end the agent, then send "two" without touching either file.main)Still announced on this branch: SOUL.md edited while the agent was stopped, then "three". Only the soul is named.
Testing
botSessionInstructionsandcreateBotTurnContext. Onmain, an idle resume with nothing edited names['soul', 'memory'], and deleting MEMORY.md while stopped names both files. On this branch they name nothing and['memory'].src/main/bots/bot-session-resume.test.ts(new) fails onmainat the first resume and passes here. It covers an untaken resume, an edit while stopped, a memory-only edit, and an Orca restart. All ofsrc/main/bots/passes exceptsharing/bot-package-archive.test.ts, which fails only because this machine has no system keyring and does not touch these files.mainand the branch, and 1000 steady turns took 45-46 ms on both. Each launch copies two strings and does no new I/O.Original fix by @yohangwak in #52770.