Skip to content

Dense hand-written code is excluded as minified/packed: the 'has definitions' exemptions miss functions packed on wide lines #7501

Closed

Description

@squid-protocol

What happens

Hand-written but very dense source, typical of current AI coding agents, is dropped from scans whole. That makes the scan see no program at all for these repos.

The case: four programs written by the Codex CLI (gpt-6-luna) in the agent-habits study (population-analyses agent-habits-prereg/). Each is a complete, correct program packed onto very few lines:

file lines longest line blocked by
chess engine, C (engine.c) 56 995 aperture Gate 4.1, saturation: line 38 exceeds 500 chars
chess engine, Rust (src/main.rs) 35 2,303 Gate 4.1; with the 4.1 bound raised to 5,000: statistical_auditor Packed Payload Guard, 14.42 hits/line
chess engine, Rust, 2nd run 37 — same two gates
SAT solver, C (solver.c) 15 1,082 Gate 4.1; with the bound raised, it is read and has 8 functions

The C chess engine with the bound raised is next blocked by the Packed Payload Guard at 19.42 hits/line. In the same 60-run study, no Sonnet or Haiku file was blocked. That is the failure that matters: the gap falls on one author's style, which biases any comparison between authors.

Engine: main 7d2e1f627.

Root cause

Both gates have an exemption meant for exactly this ("a long line beside real definitions is a data row, not minifier output", #5460; _has_named_definitions for #5467), and both miss dense code:

  • aperture._has_definitions skips every line longer than _DEF_LINE_MAX = 200, a ReDoS guard. It also only counts C-style definitions whose line ends at { (or a GNU-style name line). Functions written inline, int f(...){...} with several per line, are never counted.
  • statistical_auditor._has_named_definitions requires _is_ordinary_width (average bytes per physical line ≤ DEFINITION_MAX_AVG_LINE). Dense code fails that by construction, even when the detector extracted many functions.

Class sweep (every gate with a definitions exemption)

  • aperture 3.4 (hex/array payload), 4.1 (saturation) and 5.1 (monotony): all use _has_definitions, so all are open to the same miss. Only 4.1 was observed here.
  • statistical_auditor Packed Payload Guard: uses _has_named_definitions / _is_ordinary_width. Observed.
  • statistical_auditor, other relegations that read width or density: to be checked by the fix.

Constraint: the gates must keep doing their job

They exist to stop minified JS/CSS bundles, packed or obfuscated payloads and data dumps, and to protect the regex engines from ReDoS. A fix must tell dense hand-written source apart from those, not admit everything that is wide. Candidate signals:

  • language (minifiers target JS, CSS and HTML; minified C, Rust, COBOL or Java is not a practice);
  • whitespace and identifier shape;
  • definitions per line, counted with a bounded scan that is still ReDoS-safe on long lines.

Tests must show minified and packed fixtures are still blocked.

Acceptance

  • Synthetic fixtures, not the study files: dense C, dense Rust, and a dense file in at least one more systems language, each with many functions on 500–3,000-char lines. They are scanned and their functions are extracted.
  • Minified JS/CSS bundle, packed hex/array payload and pure data table fixtures are still excluded, with the same reasons as before.
  • Each changed gate has a test pinning both directions.
  • Golden masters re-blessed, with the drift attributed to the fix.

Activity

  1. added
    bug
    core-engine
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions