Skip to content

fix(bots): show "Updated soul applied" on a resumed chat only for a file that changed - #52770

Merged
nwparker merged 1 commit into
stablyai:mainfrom
yohangwak:yohangwak/bot-soul-resend
Nov 30, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
yohangwak:yohangwak/bot-soul-resend

Conversation

@yohangwak

@yohangwak yohangwak commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • 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.

Linked Issue

Fixes #52771

Visual Proof

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 before-dark after-dark
Light before-light after-light

Still announced on this branch: SOUL.md edited while the agent was stopped, then "three". Only the soul is named.

after-edit

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.

Original fix by @yohangwak in #52770.

@greptile-apps

greptile-apps Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; no actionable new issue was found.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no actionable new issue was found.

Summary

Resumed bot chats still receive their files again. The row now names only files that differ from what the chat last had.

  • Resumed bot chats name only files that changed since the chat last had them.

Reviews (2) · Last reviewed commit: "fix(bots): show "Updated soul applied" o..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed 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 Passed 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.

Share

…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.

Fixes stablyai#52771

Co-authored-by: Neil <[email protected]>
@nwparker
nwparker force-pushed the yohangwak/bot-soul-resend branch from 2ed4b1a to e9acad2 Compare November 30, 2026 00:42

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Nitpick comments: 1

src/main/bots/bot-session-resume.test.ts: 1

60-61: Trivial · Maintainability & Code Quality · Quick win

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.

...(soul !== entry.soul ? ['soul' as const] : []),
...(memoryNow || topicsNow ? ['memory' as const] : [])
...(soul !== hadSoul ? ['soul' as const] : []),
...((memoryNow && memory !== hadMemory) || topicsNow ? ['memory' as const] : [])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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.

@nwparker
nwparker merged commit 13c4886 into stablyai:main Nov 30, 2026
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]: A bot chat resumed after an idle stop says "Updated soul applied" for files that did not change

2 participants