Skip to content

feat: auto-reload persona on file change#77

Merged
royosherove merged 1 commit intomainfrom
feat/persona-reload-hook
May 10, 2026
Merged

feat: auto-reload persona on file change#77
royosherove merged 1 commit intomainfrom
feat/persona-reload-hook

Conversation

@royosherove
Copy link
Copy Markdown
Member

Persona files auto-reload when modified. Uses mtime stat check (~0.1ms per turn). No restart needed after agent edits user.md/soul.md. 393 tests green.

Persona files are cached but automatically reloaded when the agent
edits them. Uses cheap stat() mtime check on each turn (~0.1ms).
No restart needed after agent updates user.md or soul.md.
393 tests green.
@royosherove royosherove merged commit 24eb75a into main May 10, 2026
1 check passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e10f499577

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

} else {
// Cheap mtime check — auto-reload if agent edited the files
const currentMtime = getMaxMtime();
if (currentMtime > lastMtime) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reload persona when mtime decreases or file is deleted

The invalidation check only reloads when currentMtime > lastMtime, so deletions or replacements that reduce the max mtime are missed. In this file, removing user.md/soul.md (or restoring an older copy) can change persona content, but injectPersonaSection will keep serving stale cachedPersona indefinitely because the new max mtime is lower and the reload path is skipped. This breaks the advertised “auto-reload on file change” behavior for a common edit flow (rm/rollback).

Useful? React with 👍 / 👎.

royosherove added a commit that referenced this pull request May 10, 2026
1. Escape </persona> in persona content (XML injection prevention)
2. mtime check uses !== instead of > (catches deletions/replacements)
3. mkdirSync before writeSettings (handles fresh installs)
4. /later@BotName suffix stripped in group chats

All from Codex PR review comments on #75, #77, #66, #67.
393 tests green.

Co-authored-by: Loki FastStart <loki@faststart.internal>
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