Skip to content

fix(usage): do not count kit's own negative controls as refusals - #993

Merged
sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a-usage-controls
Nov 23, 2026
Merged

sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a-usage-controls

Conversation

@sandstream

Copy link
Copy Markdown
Owner

What was wrong

kit#980 marked the refusals that kit's own negative controls cause (metadata.session_id: "kit-negative-control"), so they could be told apart from an agent's. Nothing read the marker. Measured in a fresh scratch repository after kit agent-config and one kit check --category security, with no agent activity at all:

kit usage · Floor
  2 audited operations                    2 refused
    gate-bash   1
    gate-env    1

Every kit check adds two more. A person reading the Floor tab to see where agents were stopped (kit-research read-where-agents-fail-vs-kit) sees refusals no agent caused.

The fix

floorFromLogs leaves marked rows out of events, refusals and the per-gate counts, and returns them as controls. Both renderers say so:

Log Terminal --markdown
only controls "only kit's own negative controls logged (2): not counted" the totals are 0, plus the line below
controls and real refusals the real counts, plus "kit's own negative controls 2 not counted" "2 refusals by kit's own negative controls (kit check, kit usage --prove) are not counted."

--json gains floor.controls. Rows written before kit#980 carry no marker and are still counted; there is no way to tell them apart.

Verification

  • src/usage-report.test.ts: a log of two marked rows and one real refusal gives events 1, refusals 1, controls 2. It fails without the fix.
  • src/usage-markdown.test.ts: the line renders.
  • Re-ran kit usage in the scratch repository: 0 audited, 0 refused, and the controls line.
  • node scripts/prepush.mjs: build, format, lint, tests of the changed files, self-audit pass. kit review and the new-source-file check fail locally for container reasons. Semgrep did not run (not installed here).
  • No protected path. Harness-neutral: the audit log and the marker are the same for every harness.

Generated by Claude Code

Every kit check with the gates wired logs two refusals from its own
negative controls. kit#980 marked them; the Floor tab still counted
them, so a repository nobody was refused in showed 2 refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
@github-actions

Copy link
Copy Markdown

Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published.

@sandstream-kit-reviewer sandstream-kit-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kit review gate at cc2c16a66bb1: gates passed. All 33 checks passed on this commit, no file is in a protected class, 6 files and 68 lines changed. This approval is deterministic; it does not judge what the change is for.

@sandstream
sandstream merged commit 0830f94 into main Nov 23, 2026
33 checks passed
@sandstream
sandstream deleted the claude/web-kit-status-sync-p6fg9a-usage-controls branch November 23, 2026 22:59
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