Skip to content

🐛 fix(memory): avoid redundant lifecycle events and feed replay - #99

Merged
marcelsamyn merged 1 commit into
mainfrom
fix/radar-feed-growth
Sep 22, 2026
Merged

marcelsamyn merged 1 commit into
mainfrom
fix/radar-feed-growth

Conversation

@marcelsamyn

@marcelsamyn marcelsamyn commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Repeated lifecycle recomputation rewrites unchanged claims, producing redundant change-feed events. Completed feed consumers also have no durable cursor, so polling starts over. This change skips unchanged lifecycle writes, including deadlines removed by a later message, and adds an opaque checkpointCursor for incremental polling.

Consumers can opt into startAt: "head" to observe future changes without importing historical events. Existing pagination keeps nextCursor: null at completion; existing callers retain their starting behavior. User, partition, epoch, and frozen-sweep checks remain enforced.

Recent-change responses also expose the change timestamps already used for sorting. Consumers can distinguish an old memory changed today from its original authored date. The SDK keeps the added fields optional for older servers.

Validation: 101 focused tests passed against isolated PostgreSQL, including unchanged row/event counts, deadline chronology and source removal, writes during pagination, empty and subsequent polls, scope isolation, HTTP validation, and SDK parsing. Full type/schema check, lint, SDK and production builds, changed-file formatting, and git diff --check passed. Read-only review findings were resolved and re-reviewed. Coverage percentage was not measured.

No migration or data cleanup. No deployment or SDK publication was performed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T08:40:26.923230Z 87b11ec New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown

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: 87b11ec08e

ℹ️ 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".

/** Opaque keyset cursor returned by the previous page. */
cursor: z.string().min(1).max(2048).optional(),
/** First sweep only. Omission replays from the beginning. */
startAt: z.enum(["beginning", "head"]).optional(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject head starts when an older server ignores them

When this SDK is used against a server from before this commit, that server's Zod request schema strips the unknown startAt field and silently performs a beginning replay. Because the new response schema explicitly accepts an absent checkpointCursor, queryChangeFeed({ startAt: "head" }) succeeds and returns historical events even though the caller requested future-only changes, potentially replaying old notifications or actions. Detect the missing capability for startAt: "head" and fail rather than returning the replayed page.

Useful? React with 👍 / 👎.

@marcelsamyn
marcelsamyn merged commit 14c8fbd into main Sep 22, 2026
1 check passed
@marcelsamyn
marcelsamyn deleted the fix/radar-feed-growth branch September 22, 2026 09:11
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