Auto-mode classifier must not count pre-API validator rejections as mutation budget #617

Open
opened 2026-07-09 21:16:58 -05:00 by jcwalker3 · 0 comments
Owner

Problem

During the #615 comment update flow, two post attempts were rejected before any Gitea API mutation occurred:

  1. missing [THREAD STATE LEDGER]
  2. missing ## Canonical Issue State

Both were fail-closed validator rejections. No comment was posted, no label changed, and no Gitea server-side state was created.

A later corrected comment satisfied both validators, but the auto-mode classifier denied it as an extra/third mutation attempt. This is incorrect. The net server-side mutation count was still zero before the successful retry.

The successful post landed as #615 comment 9137.

Required behavior

Mutation budget must count only server-side Gitea state changes.

Pre-API validator rejections must be recorded as local failed attempts, not as Gitea mutations.

A comment mutation should count only when the Gitea API succeeds and returns proof such as:

  • success=true
  • comment_id
  • label change result
  • issue/PR state change
  • review id
  • merge result

Acceptance criteria

  1. Auto-mode classifier distinguishes:

    • local validator rejection
    • capability-gate rejection
    • transport failure before API
    • successful server-side mutation
  2. Pre-API validator failures do not consume server-side mutation budget.

  3. Failed attempts are still logged in the local attempt ledger.

  4. The final report must separately show:

    • local failed attempts
    • blocked API attempts
    • successful server-side mutations
  5. Add tests covering:

    • missing [THREAD STATE LEDGER] rejected pre-API and not counted as mutation
    • missing ## Canonical Issue State rejected pre-API and not counted as mutation
    • corrected comment after two local validator rejections is allowed
    • successful comment with comment_id counts as one mutation
    • failed transport before API does not count as mutation
    • capability gate blocked before API does not count as mutation

Proof source

Observed during #615 update flow.

Final successful comment:
#615 comment 9137

Memory updated:
canonical-issue-comment-schema.md

Desired outcome

The classifier should prevent repeated real mutations, but it must not block the first valid server-side mutation merely because earlier local validation attempts failed closed.

## Problem During the #615 comment update flow, two post attempts were rejected before any Gitea API mutation occurred: 1. missing `[THREAD STATE LEDGER]` 2. missing `## Canonical Issue State` Both were fail-closed validator rejections. No comment was posted, no label changed, and no Gitea server-side state was created. A later corrected comment satisfied both validators, but the auto-mode classifier denied it as an extra/third mutation attempt. This is incorrect. The net server-side mutation count was still zero before the successful retry. The successful post landed as #615 comment `9137`. ## Required behavior Mutation budget must count only server-side Gitea state changes. Pre-API validator rejections must be recorded as local failed attempts, not as Gitea mutations. A comment mutation should count only when the Gitea API succeeds and returns proof such as: - `success=true` - `comment_id` - label change result - issue/PR state change - review id - merge result ## Acceptance criteria 1. Auto-mode classifier distinguishes: - local validator rejection - capability-gate rejection - transport failure before API - successful server-side mutation 2. Pre-API validator failures do not consume server-side mutation budget. 3. Failed attempts are still logged in the local attempt ledger. 4. The final report must separately show: - local failed attempts - blocked API attempts - successful server-side mutations 5. Add tests covering: - missing `[THREAD STATE LEDGER]` rejected pre-API and not counted as mutation - missing `## Canonical Issue State` rejected pre-API and not counted as mutation - corrected comment after two local validator rejections is allowed - successful comment with `comment_id` counts as one mutation - failed transport before API does not count as mutation - capability gate blocked before API does not count as mutation ## Proof source Observed during #615 update flow. Final successful comment: #615 comment `9137` Memory updated: `canonical-issue-comment-schema.md` ## Desired outcome The classifier should prevent repeated real mutations, but it must not block the first valid server-side mutation merely because earlier local validation attempts failed closed.
jcwalker3 added the bugtype:guardrailstatus:ready labels 2026-07-09 21:16:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#617