fix(files): keep file-read observations within their conversation by rudycelekli · Pull Request #3810 · zhayujie/CowAgent · GitHub
Skip to content

fix(files): keep file-read observations within their conversation - #3810

Open
rudycelekli wants to merge 1 commit into
zhayujie:masterfrom
rudycelekli:fix/file-observations-by-conversation-20261021
Open

rudycelekli wants to merge 1 commit into
zhayujie:masterfrom
rudycelekli:fix/file-observations-by-conversation-20261021

Conversation

@rudycelekli

Copy link
Copy Markdown
Contributor

File staleness observations are currently shared by path across the entire process. If conversation A reads a file, an outside edit changes it, and conversation B reads/writes the new version, B refreshes A's recorded observation. A can then write from its old view without the existing warning. Conversely, an unread conversation can receive a warning based on another conversation's read.

Scope each remembered observation to the ambient Agent/user/session identity and resolved file path. Preserve the same bounded global LRU, realpath handling and informational warning behavior. Exclude run id so an observation remains valid across turns in the same conversation; a fresh read/write still refreshes that conversation's own view.

Validation: real public Read/Edit/Write operations, real files and explicit native mtimes reproduce nine failures on unchanged upstream, with two controls passing. The final 74-test file-tool suite passes, including previous backward-time restore, atomic edit/write, concurrent edit and memory-notification controls. Tests cover another conversation or Agent reading/writing, unread-conversation false warnings, same-conversation rereads and cross-turn observations. Both changed files pass Ruff, the new test passes Black and diff checks pass. Production ChatChannel uses RuntimeIdentity(agent_id, session_id) around message handling. No model/provider, account or external-system operations; no full app/browser run. This keeps warnings advisory and does not introduce write blocking or cross-process coordination. Rollback is a single commit revert.

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>

This branch has not been deployed

No deployments
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