Repository navigation
fix(id): export host events through authorized journal history - #3998
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
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. CodeRabbit Verify
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 47937fe3e7
ℹ️ 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".
| while self.admin_history.len() > self.limits.retained_events.min(MAX_ADMIN_HISTORY_EVENTS) | ||
| || admin_history_bytes(&self.admin_history) > MAX_ADMIN_HISTORY_BYTES |
There was a problem hiding this comment.
Track retained history bytes incrementally
With a substantial retained history, every accepted input, chat message, or host event calls admin_history_bytes, which allocates and JSON-serializes every retained event again. With the default 1,024-event retention and valid 16 KiB inputs, this can re-encode tens of megabytes for each new event, even when no export is requested. This synchronous work runs inside the single world actor, delaying subsequent inputs, ticks, and view requests; byte-limit trimming can repeat the full scan for each removed event. Cache encoded event sizes and maintain a running byte total as events enter and leave the deque.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Disposition (queue task 6505, rebase/land of PR #3998): tracked as its own follow-up in #4633 — admin_history_bytes re-serializes the retained admin history per accepted event; track retained bytes incrementally. Not fixed in this PR: this task is the rebase/land of the recorded #242 decision, and the retained history is bounded (retained_events cap + MAX_ADMIN_HISTORY_BYTES byte cap checked on the same path), so the cost is bounded per event; the incremental-byte-tracking optimization is scoped and accepted on #4633.
|
Cross-link: the Codex P2 on |
# Conflicts: # pkgs/id/src/cli.rs # pkgs/id/src/world/actor.rs # pkgs/id/src/world/core.rs # pkgs/id/src/world/handle.rs # pkgs/id/src/world/mod.rs # pkgs/id/src/world/tests.rs
# Conflicts: # pkgs/id/src/world/core.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6bc2e8244e
ℹ️ 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".
| ensure!( | ||
| events.len() <= self.limits.retained_events.min(MAX_ADMIN_HISTORY_EVENTS), | ||
| "checkpoint admin history exceeds its event bound" |
There was a problem hiding this comment.
Trim restored admin history to the current retention limit
For library callers reopening a compacted world with a lower WorldLimits::retained_events, this check rejects an otherwise valid journal whenever its persisted admin history exceeds the new limit. Previously, lowering retention worked because restore trims checkpoint participant events to the supplied limit; the new admin-history field now makes WorldCore::restore and open_world fail instead. Validate the persisted history against the stable format bound, then trim it to the current retention limit and mark it incomplete if events are removed.
Useful? React with 👍 / 👎.
| admin_history: Some(JournalAdminHistory { | ||
| events: self.admin_history.iter().cloned().collect(), | ||
| complete: self.admin_history_complete, | ||
| }), |
There was a problem hiding this comment.
Keep retained history checkpoint entries replicable
For a snapshot-capable world with small program state and few participant events, retaining 1,000 sub-kilobyte host capability results can now create a single checkpoint entry larger than 256 KiB. Previously those host events were separate journal entries and the checkpoint could remain small. After compaction publishes a replication reset, world_replication_net.rs::send_snapshot calls split_entry_payload, which rejects any individual entry above MAX_REPLICATION_PAYLOAD_BYTES (world/replication.rs:179–180). Existing replication streams consequently fail, and reconnecting cannot transfer the same compacted checkpoint. Keep the checkpoint within the replication entry bound, defer compaction when it exceeds that bound, or store retained history in separately replicable entries.
Useful? React with 👍 / 👎.
Fixes #242.
Summary
Systemevents remain excluded from participant streams, snapshots, andevents_after; capability results stay host/admin-only.territory.doc/2026-11-01T17-30-12Z_design_host_event_export/.Evidence
events_aftercould not return them and fixtures missed them.cargo test --lib -- --test-threads=4—id: 1,516 passed, 0 failed, 5 ignored;id_core: 238 passed, 0 failed, 1 ignored. This includes authorization, non-disclosure, partial checkpoint recording, andterritoryreplay tests.rustfmt --check;git diff --checkis clean.just cistopped on formatting differences in unrelated base files; all-featurescargo checkhit missing generatedweb/distand arusshsignature mismatch; Clippy hit incompatible cached Rust artifacts.Merge Danger
Door: Two-way — the change is revertible, but the journal format bump requires version-aware readers.
Blast Radius: Medium — admin recording, fixture replay, and checkpoint persistence change; participant delivery semantics do not.
Need help on this PR? Tag
@codesmith-botwith what you need.