Skip to content

[BUG](fn-consumer): Skip stale work fetch - #7523

Merged
tanujnay112 merged 4 commits into
mainfrom
codex/skip-stale-fn-fetch
Jul 30, 2026
Merged

[BUG](fn-consumer): Skip stale work fetch#7523
tanujnay112 merged 4 commits into
mainfrom
codex/skip-stale-fn-fetch

Conversation

@tanujnay112

@tanujnay112 tanujnay112 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Avoid materializing logs for stale async attached-function queue records, and explicitly acknowledge records that are already complete at the current collection head.

Root cause

fn-consumer fetched and materialized every input collection before comparing the attached-function completion frontier with the queued compaction frontier. A stale input could therefore load millions of records and then be discarded.

Change

  • Look up the current attached-function completion frontier in SysDB before fetching logs.
  • When that completion offset equals the collection head and is at or beyond the queued frontier, call FinishWork directly. This advances/records the invocation frontier and removes the queue item without boundary resolution or function execution.
  • When the completion offset is behind the collection head, leave the work queued for the existing boundary-resolution/execution path.
  • Keep the existing post-fetch check as a race-safety guard.

Validation

  • cargo test -p worker function_execution --lib

@github-actions

Copy link
Copy Markdown

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@tanujnay112
tanujnay112 force-pushed the codex/skip-stale-fn-fetch branch from e6c268b to 773e009 Compare July 29, 2026 01:16
@tanujnay112
tanujnay112 force-pushed the codex/skip-stale-fn-fetch branch from 773e009 to d02a95c Compare July 29, 2026 01:20
@tanujnay112
tanujnay112 marked this pull request as ready for review July 29, 2026 20:21

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@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: d02a95ce40

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

) -> Result<i64, CompactionError> {
let mut sysdb = compaction_context.sysdb.clone();
let attached_function = sysdb
.get_attached_functions(None, Some(collection_id), vec![attached_function_id], true)

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 Avoid the single-ID SysDB request that always errors

Every fn-consumer batch now reaches this lookup before fetching logs, but GrpcSysDb::get_attached_functions encodes a one-element ids vector into both the deprecated id field and the ids field (rust/sysdb/src/sysdb.rs:2451-2464). The coordinator explicitly rejects requests containing both fields (go/pkg/sysdb/coordinator/task.go:928-930), so in the production gRPC SysDB configuration this returns InvalidArgument for every work item and prevents all async attached-function execution. Use a lookup that populates only one of those fields, or correct the helper before calling it here.

Useful? React with 👍 / 👎.

@blacksmith-sh

This comment has been minimized.

@tanujnay112
tanujnay112 merged commit 3684fe3 into main Jul 30, 2026
174 of 176 checks passed
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.

2 participants