Skip to content

fix(detector): detect function attribute replay#121

Closed
prasannakotyal wants to merge 1 commit into
gpu-mode:mainfrom
prasannakotyal:prasannakotyal/kg-blue-151-function-attribute-replay
Closed

fix(detector): detect function attribute replay#121
prasannakotyal wants to merge 1 commit into
gpu-mode:mainfrom
prasannakotyal:prasannakotyal/kg-blue-151-function-attribute-replay

Conversation

@prasannakotyal

Copy link
Copy Markdown

Summary

Targets KG red #151, where custom_kernel stores the first output on the function object itself and later returns that saved value from an input-independent fast path.

This adds a narrow FUNCTION_ATTRIBUTE_REPLAY detector. It requires:

  • an entrypoint function body using custom_kernel.<attr> or getattr(custom_kernel, "<attr>")
  • a call-free early return from that function-attribute state or a local alias to it
  • no input parameter reference in the replay guard
  • mutation of that same state from input-derived values, including direct assignment or container methods like .append(...)

Plain function metadata, constant flags, and workspace attributes that still compute from the current input stay out of scope.

KernelGuard-Red-Submission: 151

Local verification

  • red_31_function_attr_replay -> FUNCTION_ATTRIBUTE_REPLAY, should_filter=True
  • red_486_function_attr_list_replay -> FUNCTION_ATTRIBUTE_REPLAY, should_filter=True
  • red_487_function_attr_namespace_replay -> FUNCTION_ATTRIBUTE_REPLAY, should_filter=True
  • clean_metadata -> stays valid
  • clean_attr_constant -> stays valid
  • clean_workspace_attr -> stays valid
  • python -m py_compile kernelguard.py

@prasannakotyal
prasannakotyal temporarily deployed to kernelguard-api-control-plane May 1, 2026 23:38 — 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
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