Repository navigation
fix(fabricator): do not resubmit reused registry records that are already approved or pending - #400
Merged
Merged
Conversation
…eady approved or pending
| import sys | ||
| import os | ||
| import json | ||
| from unittest.mock import patch, MagicMock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(fabricator): do not resubmit reused registry records that are already approved or pending
Problem
When
_find_existing_record_idreuses a Registry record whose status is alreadyAPPROVED(orPENDING_APPROVAL), the code unconditionally callsSubmitRegistryRecordForApproval. The registry rejects this withValidationException: Cannot submit the record for approval in current status: APPROVED. This is counted as a tool registration failure, causing the entire fabrication job to reportFAILEDeven though every record already exists and is usable.Root cause
The
_approvehelper insidestore_tool_config_registryalways calledsubmit_registry_record_for_approvalwithout first reading the record's current status. On a reuse path (SQS redelivery, retry, or "Check build status" re-trigger), the record is already approved, and the blind re-submission fails.The agent path (
store_agent_config_registry) had no status checking at all for reused records — it returnedTrueimmediately without verifying the record's lifecycle state.Fix
_approveinstore_tool_config_registry: reads the record's current status viaGetRegistryRecordbefore attempting submission. State table:APPROVED'approved'immediately — no submit callPENDING_APPROVAL'pending_approval'immediately — no submit callDRAFTCREATINGREJECTED/DEPRECATEDRuntimeError— terminal, non-recoverablestore_agent_config_registry: when reusing a record, reads its status and applies the same state table.DRAFTrecords are submitted for approval.REJECTED/DEPRECATEDrecords fail clearly. A reused record's content is NOT rewritten (content writes demote non-DRAFT records).Overall job status:
COMPLETEDwhen every tool and the agent are approved or pending;registryApprovalStatus = 'approved'iff all approved, else'pending_approval'.Stack
arbiter/fabricator/index.py—_approve()status pre-read;store_agent_config_registryreuse path status handlingTests
New test file
test_reused_record_status.py(10 tests) usingbotocore.stub.Stubberwith the realagent-registry-controlservice model — no hand-copied expected params. Covers:Updated 2 existing test files (
test_creating_conflict_recovery.py,test_registry_filter_approval_idempotency.py) to account for the newGetRegistryRecordpre-read in_approve.Full CI:
pytest arbiter/ -v --tb=short→ 2523 passed, 1 skipped, 0 failed.Smoke test
"Check build status" on agents that were previously built should show them as built (COMPLETED) without re-triggering approval submissions. Retrying a fabrication where the records already exist should complete without
ValidationExceptionerrors.