Skip to content

fix(detector): detect lambda setitem replay - #123

Closed
prasannakotyal wants to merge 1 commit into
gpu-mode:mainfrom
prasannakotyal:prasannakotyal/kg-blue-131-lambda-setitem-replay
Closed

prasannakotyal wants to merge 1 commit into
gpu-mode:mainfrom
prasannakotyal:prasannakotyal/kg-blue-131-lambda-setitem-replay

Conversation

@prasannakotyal

Copy link
Copy Markdown

Summary

Targets KG red #131, where custom_kernel is a lambda expression that returns saved state when present and otherwise populates that state through __setitem__ with data.clone().

This adds a narrow LAMBDA_SETITEM_REPLAY detector. It requires:

  • top-level custom_kernel = lambda ...
  • a ternary lambda body with an input-independent replay guard
  • direct return of a subscripted state object on the replay branch
  • state.__setitem__(..., <input-derived>) in the populate branch

Normal lambda kernels that compute from the current input, or lambdas that only read constant state, stay out of scope.

KernelGuard-Red-Submission: 131

Local verification

  • red_11_lambda_list_setitem_replay -> LAMBDA_SETITEM_REPLAY, should_filter=True
  • red_12_lambda_dict_setitem_replay -> LAMBDA_SETITEM_REPLAY, should_filter=True
  • clean_lambda_compute -> stays valid
  • clean_lambda_constant_state -> stays valid
  • python -m py_compile kernelguard.py

@prasannakotyal
prasannakotyal temporarily deployed to kernelguard-api-control-plane May 1, 2026 23:41 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

KernelGuard Blue Evaluation

@SinatrasC

Copy link
Copy Markdown
Collaborator

Thanks for the KernelGuard Flywheel Campaign contribution. We are not merging this narrow variant separately because the consolidated rule-family implementation in #273 is the merge path for this detector area.

@SinatrasC SinatrasC closed this Jun 20, 2026

This branch was previously deployed

1 inactive deployment
kernelguard-api-control-plane — 2f5c58e0 Deployed May 1, 2026 by prasannakotyal via sync #194
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