Skip to content

fix(preflight): bound duplicate detection inputs - #497

Merged
JSONbored merged 1 commit into
mainfrom
codex/fix-unbounded-preflight-body-tokenization
Jun 10, 2026
Merged

fix(preflight): bound duplicate detection inputs#497
JSONbored merged 1 commit into
mainfrom
codex/fix-unbounded-preflight-body-tokenization

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • The preflight duplicate-check tokenized unbounded title/body and re-tokenized collision items, enabling an authenticated caller to force heavy CPU/memory use and cause availability issues.
  • The goal is to cap attacker-controlled inputs and avoid repeated expensive tokenization while preserving the term-overlap duplicate detection behavior.

Description

  • Add centralized preflight size limits in src/signals/preflight-limits.ts and apply them to API and MCP schemas by updating src/api/routes.ts and src/mcp/server.ts to cap title, body, arrays, and array item lengths via PREFLIGHT_LIMITS and zod validators.
  • Truncate/prebound preflight text and arrays before internal processing by introducing truncateText and boundedTextItems in src/signals/engine.ts, and use them when building planned and collision item term inputs so tokenization works on bounded data.
  • Reuse the collision report term cache by storing the computed itemTerms map on the generated CollisionReport (collisionReportTermCache) and consult it during preflight cluster filtering instead of retokenizing cluster items.
  • Add a regression unit test to test/unit/signals-coverage.test.ts that verifies linked-issue extraction only scans the bounded preflight body window.

Testing

  • Ran type checking with npm run typecheck and it succeeded.
  • Ran the targeted unit test file with npx vitest run test/unit/signals-coverage.test.ts and it passed.
  • Ran the full unit test suite with npm run test:unit and all tests passed.

Codex Task

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui 414475e Commit Preview URL

Branch Preview URL
Jun 10 2026, 07:02 AM

@github-actions github-actions Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 9, 2026
@ghost

ghost commented Jun 9, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #497 is no longer open. No action.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@ghost ghost added the gittensory:reviewed label Jun 9, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored
JSONbored force-pushed the codex/fix-unbounded-preflight-body-tokenization branch from decf11a to 414475e Compare June 10, 2026 07:00
@JSONbored
JSONbored merged commit 75ed5f0 into main Jun 10, 2026
10 checks passed
@JSONbored
JSONbored deleted the codex/fix-unbounded-preflight-body-tokenization branch June 10, 2026 07:03
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 10, 2026
@JSONbored JSONbored added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jun 10, 2026
@github-actions github-actions Bot mentioned this pull request Jun 10, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant