Skip to content

Consolidate eval-backed rule extension PRs#273

Merged
SinatrasC merged 2 commits into
mainfrom
rule-family-pr-consolidation
Jun 20, 2026
Merged

Consolidate eval-backed rule extension PRs#273
SinatrasC merged 2 commits into
mainfrom
rule-family-pr-consolidation

Conversation

@SinatrasC

@SinatrasC SinatrasC commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Consolidates the useful eval-backed KernelGuard rule-extension PRs into a single surgical rule-family update instead of merging many overlapping detector branches independently.

This adds broader AST detectors for replay, fake-output, and evaluator/runtime manipulation families, wires the resulting rules into CODE_DETECTORS and BASE_DETECTOR_SPECS, and tightens pointer replay handling so valid fast paths that call/launch work before returning cached output containers are not hard-filtered as stale replay.

What changed

  • Added INPUT_PASSTHROUGH_OUTPUT coverage for direct and indirect input.float() passthroughs, including nullcontext, dynamic type(...), __init_subclass__, helper-function, and descriptor-backed exports.
  • Added INPUT_REDUCTION_OUTPUT and SELF_MATMUL_OUTPUT hard fake-output families for input reductions and self-matmul/bmm-style fake outputs.
  • Extended LAST_CALL_REPLAY coverage for first-call sentinel replay, captured mutable state, mutable defaults, function attributes, nonlocal factories, contextvars, local __dict__ aliases, partial-bound methods/storage, and generator .send() replay.
  • Extended POINTER_REPLAY coverage for pointer/id/data_ptr cache hits, class callable state, and lambda/operator pointer dispatch forms.
  • Added system/runtime manipulation coverage for builtins and harness mutation, timer monkeypatching, fake benchmark emits, and runtime package/process/socket expansion.
  • Added shared AST helpers for entrypoint methods, lambda inputs, no-op context managers, torch call recognition, and cache/output naming.
  • Tightened object pointer replay so a pointer-guarded branch with real calls, such as a cached launch fast path, is not treated as a stale-output return.

Sourced PRs covered

Replay / captured state:
#208 #209 #210 #211 #212 #213 #214 #215 #216 #217 #218 #219 #220 #221 #172 #173 #11 #43 #115 #144 #152 #174 #183 #222 #225

Partial / factory / callable entrypoints:
#192 #193 #195 #156 #165 #21

Pointer replay:
#202 #203 #204 #205 #206 #207 #18 #223 #22 #143

Fake-output passthrough and reductions:
#252 #250 #251 #244 #246 #247 #248 #249 #253

Self-matmul / bmm / sentinel-style fake-output family:
#256 #254 #255 #257 #258 #259 #261 #262 #263 #264 #265 #266 #267 #268 #269 #270 #271

System/runtime manipulation:
#24 #25 #26 #27

Context-local replay:
#65

Validation

  • python3 -m py_compile kernelguard.py
  • git diff --check
  • targeted smoke set for the new rule families
  • streaming gates: 251 TP / 2 known flywheel metadata-gap FN / 0 FP / 1421 TN
  • scripts/github/blue_pr_static_security.py: passed with 0 findings

Notes

The two remaining flywheel misses are the pre-existing metadata-gap samples that only hit DECODE_MM_REF at low confidence; this branch does not broaden that unrelated gate.

Covered PR families and representatives:
- #208 plus #209-#221: first-call and captured-state replay through LAST_CALL_REPLAY.
- #172 and #173: mutated captured subscripts/attributes folded into the broad captured-state replay detector.
- #252 plus #250/#251 and ignored variants #244/#246/#247/#248/#249: direct and indirect input.float() passthrough output detection, including nullcontext, dynamic type(), __init_subclass__, and descriptor-backed exports.
- #253: input reduction fake-output detection for torch.any/all style outputs.
- #256 plus #254/#255 and related #257/#258/#259/#261-#271 family: self-matmul/bmm/sentinel-style fake output coverage through SELF_MATMUL_OUTPUT and replay detectors.
- #202 plus #203-#207 and related #18/#223 forms: pointer/id/data_ptr replay cache extensions.
- #192/#193/#195 and additional ignored variants #156/#165: partial/factory/nonlocal mutable-state replay.
- #11/#43/#115/#144/#152/#174/#183/#222/#225: aliases, function/default state, generator-send, and local __dict__ replay variants.
- #21: callable/class entrypoint replay blind spots.
- #65: contextvars-backed state replay.
- #22/#143: lambda/operator setitem pointer-dispatch replay.

Implementation notes:
- Add shared AST helpers for entrypoint methods, no-op nullcontext bodies, lambda input handling, torch call recognition, and output/cache naming.
- Add hard fake-output policies for INPUT_PASSTHROUGH_OUTPUT, INPUT_REDUCTION_OUTPUT, and SELF_MATMUL_OUTPUT.
- Register the new replay and fake-output detectors in CODE_DETECTORS and BASE_DETECTOR_SPECS.
- Tighten object pointer replay so cached fast paths that launch/refresh work before returning are not treated as stale output replay.

Validation:
- python3 -m py_compile kernelguard.py
- git diff --check
- targeted smoke set for new rule families
- streaming gates: 251 TP / 2 known flywheel metadata-gap FN / 0 FP / 1421 TN
- blue_pr_static_security.py: passed with 0 findings
- --audit-rules report generated at /tmp/kg_rule_audit_explicit/rule_audit_report.md
@SinatrasC SinatrasC marked this pull request as ready for review June 20, 2026 20:39
@SinatrasC SinatrasC changed the title [codex] Consolidate eval-backed rule extension PRs Consolidate eval-backed rule extension PRs Jun 20, 2026
@SinatrasC SinatrasC marked this pull request as draft June 20, 2026 20:40
@SinatrasC SinatrasC marked this pull request as ready for review June 20, 2026 20:41
@SinatrasC SinatrasC marked this pull request as draft June 20, 2026 20:43
@SinatrasC SinatrasC marked this pull request as ready for review June 20, 2026 20:43
@SinatrasC SinatrasC merged commit babd880 into main Jun 20, 2026
7 checks passed
This was referenced 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.

1 participant