Repository navigation
templates/openagents: correct why channel history is lost, and drop the Scope section - #264
Merged
Merged
Conversation
…he Scope section Reading the mod rather than trusting the write-up that shipped with 1.0.0: _save_message_history has two call sites, not one. It runs from shutdown, and it runs every _save_interval messages, which is 50. The storage helper dumps on dump_interval_minutes as well, which is 10. The verification behind 1.0.0 posted a single message and restarted a few minutes later, so neither threshold fired, nothing was ever written, and the storage directory came back with no history file at all rather than an empty one. The claim that shipped, that the mod writes only on shutdown and that channel history never survives, is wrong. What is true is narrower: whatever arrived since the last flush is in memory only. alwaysOn: true still earns its place, because scale-to-zero on a quiet network drops that tail with nobody having restarted anything, but the manifest comment now says so in terms of the batching. The Scope section comes out and its two caveats go back into the body, the channel one corrected and the MCP one as it stood, which is where a reader meets them in context rather than in a list of warnings. Worth reporting upstream and not worked around here: shutdown clears message_history and files before calling the two save helpers, and those open their files with "w". A graceful shutdown truncates both to empty, discarding batches already written, so on this mod a clean stop destroys more than an abrupt one. 1.0.0 is published, so the manifest change takes 1.0.1 and the canonical tag moves with it. Nothing under the image changes: the Dockerfile and the entrypoint are untouched and the rebuild is byte-identical in intent.
There was a problem hiding this comment.
2 issues found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="templates/openagents/README.md">
<violation number="1" location="templates/openagents/README.md:35">
P2: These lines imply that a scheduled flush makes channel history survive a restart. The pinned mod’s shutdown path can truncate already-flushed history, so document that shutdown caveat too.</violation>
<violation number="2" location="templates/openagents/README.md:36">
P2: The README now explains the persistence trade-off without disclosing its cost. Keep a sentence here stating that the template stays always on to avoid scale-to-zero loss and bills continuously.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| one. Channel messages are upstream's own exception, covered under Scope below. | ||
| one. Channel messages are the exception: the messaging mod batches them, writing its history | ||
| out every 50 messages or every 10 minutes, so whatever has arrived since the last write is in | ||
| memory only and a restart drops it. The forum and the wiki write through as they go. |
There was a problem hiding this comment.
P2: The README now explains the persistence trade-off without disclosing its cost. Keep a sentence here stating that the template stays always on to avoid scale-to-zero loss and bills continuously.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At templates/openagents/README.md, line 36:
<comment>The README now explains the persistence trade-off without disclosing its cost. Keep a sentence here stating that the template stays always on to avoid scale-to-zero loss and bills continuously.</comment>
<file context>
@@ -31,7 +31,9 @@ from source as a separate backend and frontend.
- one. Channel messages are upstream's own exception, covered under Scope below.
+ one. Channel messages are the exception: the messaging mod batches them, writing its history
+ out every 50 messages or every 10 minutes, so whatever has arrived since the last write is in
+ memory only and a restart drops it. The forum and the wiki write through as they go.
- A password gate on registration, enforced at the protocol level: a `POST /api/register` with no
password is refused with "Password authentication required for network registration".
</file context>
Comment on lines
+35
to
+36
| out every 50 messages or every 10 minutes, so whatever has arrived since the last write is in | ||
| memory only and a restart drops it. The forum and the wiki write through as they go. |
There was a problem hiding this comment.
P2: These lines imply that a scheduled flush makes channel history survive a restart. The pinned mod’s shutdown path can truncate already-flushed history, so document that shutdown caveat too.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At templates/openagents/README.md, line 35:
<comment>These lines imply that a scheduled flush makes channel history survive a restart. The pinned mod’s shutdown path can truncate already-flushed history, so document that shutdown caveat too.</comment>
<file context>
@@ -31,7 +31,9 @@ from source as a separate backend and frontend.
forum and wiki, and uploaded files. A forum topic created before a restart was still there after
- one. Channel messages are upstream's own exception, covered under Scope below.
+ one. Channel messages are the exception: the messaging mod batches them, writing its history
+ out every 50 messages or every 10 minutes, so whatever has arrived since the last write is in
+ memory only and a restart drops it. The forum and the wiki write through as they go.
- A password gate on registration, enforced at the protocol level: a `POST /api/register` with no
</file context>
Suggested change
| out every 50 messages or every 10 minutes, so whatever has arrived since the last write is in | |
| memory only and a restart drops it. The forum and the wiki write through as they go. | |
| out every 50 messages or every 10 minutes, but the upstream shutdown path can still truncate | |
| persisted history, so a stop or scale-to-zero can lose messages even after an earlier flush. The | |
| forum and the wiki write through as they go. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
openagents1.0.0 shipped with the wrong explanation of why channel history does not come backafter a restart, and with a
Scopesection the README no longer wants. This corrects theexplanation, drops the section, and takes the template to 1.0.1 because 1.0.0's canonical tag is
already published.
How
The explanation was wrong. The claim that shipped was that the messaging mod writes its
history only from
shutdown(), so channel history never survives. Readingsdk/src/openagents/mods/workspace/messaging/,_save_message_historyhas two call sites:mod.py:170_save_interval = 50, so the mod flushes every 50 messagesmessage_storage_helper.pydump_interval_minutes = 10, a second flush every 10 minutesmod.py:338shutdown(), the thirdThe deploy that verified 1.0.0 posted one message and restarted a few minutes later. Neither
threshold fired, so nothing was ever written, and the storage directory holds no history file and
no dump rather than an empty one. The same instance's forum directory holds the
metadata.jsonwritten the minute its topic was created, which is the contrast that rules out the volume and the
platform: one mod in this app batches, the other writes through.
So the accurate statement is narrower. Whatever arrived since the last flush is in memory only.
alwaysOn: truestill earns its place, because scale-to-zero on a quiet network drops thattail with nobody having restarted anything. The manifest comment now argues it from the batching
rather than from a mod that never persists.
The
Scopesection comes out. Its two caveats go back into the body where a reader meetsthem in context: the channel one as part of what the volume does and does not hold, corrected,
and the MCP one back in the walkthrough step that sends people to
/api.1.0.0 -> 1.0.1.
version-guardrefuses a manifest change against a published canonical tag,correctly: overwriting
:1.0.0would drift instances already deployed. TheDockerfileandentrypoint.share untouched, so the rebuild carries the same image content under the new tag.One for upstream, not worked around here
shutdown()callsself.message_history.clear()andself.files.clear()and only then calls_save_message_history()and_save_file_metadata(), both of which open their file with"w"and write whatever dict they are handed. A graceful shutdown therefore truncates
message_history.jsonandfiles_metadata.jsonto empty, discarding batches that had alreadybeen written, while an abrupt stop loses only the unflushed tail. On this mod a clean shutdown is
the more destructive of the two. Left alone here because it belongs in
openagents-org/openagents.Verify
The two source facts, read on the pinned tree:
And on the still-running verification instance, the contrast between the two mods:
🤖 Generated with Claude Code
Summary by cubic
Corrects the
openagentstemplate's explanation of why channel history is lost after a restart, and removes theScopesection.The claim that shipped with 1.0.0 — that the messaging mod writes history only from
shutdown()and channels never survive — is wrong. The mod flushes every 50 messages and dumps every 10 minutes; the verification behind 1.0.0 posted a single message, so neither threshold fired and nothing was ever written. What is true is narrower: whatever arrived since the last write is in memory only.alwaysOn: truestays justified, now argued from that batching. TheScopesection's caveats move back into the README body, the channel one corrected and the MCP one as it stood. Bumps the manifest to 1.0.1 because the 1.0.0 canonical tag is already published; image content is unchanged.Upstream, not worked around here
A graceful shutdown is more destructive than an abrupt stop:
shutdown()clears the history and file dicts before saving with"w", truncating files that already held batches. Left foropenagents-org/openagents.Written for commit de5c2ee. Summary will update on new commits.