Repository navigation
fix(intake): resolve fabricated agents by registry record id and sanitised name when reading build status - #403
Merged
Conversation
…tised name when reading build status
The fabrication status check (postfab._resolve_live_statuses) passed the
job row's DISPLAY name (e.g. 'Arbiter Agent') as the registry name filter
value. The AgentCore Registry API rejects names containing spaces or
special characters with ValidationException, so every live-status read
failed and the stale snapshot was used instead.
Three-path resolution:
1. registryRecordId (new field on the job row) -> GetRegistryRecord (one
call, exact). The fabricator now captures the record id from
store_agent_config_registry via _RegistrationRunState.agent_record_info
and writes it to the COMPLETED status row.
2. registryName (new field) -> ListRegistryRecords with the stamped
sanitised name (the exact name the registry record was created with).
3. Fallback for pre-fix rows: sanitise the display name with
sanitize_registry_name().lower() (same function the fabricator uses
to derive record names) before passing it to the filter.
The raw display name is never passed to the name filter.
Changes:
- arbiter/fabricator/index.py: _RegistrationRunState gains
agent_record_info dict; store_agent_config_registry stashes
(record_id, registry_name) on both create and reuse paths;
_write_fabrication_status accepts registry_record_id and registry_name;
process_event's COMPLETED write threads them from the run state.
- service/agent_intake_single/tools/postfab.py: _resolve_registry_status
takes registry_record_id and registry_name params with the three-path
resolution; _resolve_live_statuses reads the new fields from job items.
- tests: 7 new test classes covering by-id, by-name, sanitised-fallback,
and GetRegistryRecord-failure-to-name-fallback paths.
Existing tests updated: _stub_list calls use lowercased names to match
the new sanitise-and-lowercase fallback convention.
Live-verified: _resolve_registry_status('Arbiter Agent', '',
registry_record_id='MshBnaCcFECO') -> 'APPROVED'; by sanitised name ->
'APPROVED'.
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.
Problem
postfab._resolve_live_statusespassed the job row's display name (e.g.'Arbiter Agent','Catering & Fuel Sequencing Agent') as thenamefilter value toListRegistryRecords. The AgentCore Registry API rejects names containing spaces or special characters withValidationException: Invalid value for filter name, so every live-status read failed and the stale write-once snapshot won by default.Fix
Three-path resolution order (most-to-least precise):
registryRecordId(new field on the job row) →GetRegistryRecord— one call, exact match.registryName(new field) →ListRegistryRecordsusing the stamped sanitised name the fabricator created the record with.sanitize_registry_name().lower()(the same function the fabricator uses to derive record names) and list with filters.The raw display name is never passed to the name filter.
Changes
arbiter/fabricator/index.py_RegistrationRunStategainsagent_record_info: dict[str, tuple[str, str]]mapping agent_id → (record_id, registry_name).store_agent_config_registrystashes the record coordinates on both create and reuse paths._write_fabrication_statusacceptsregistry_record_idandregistry_nameoptional params, writing them to DynamoDB when present.process_event's COMPLETED write threads the record info from the run state.service/agent_intake_single/tools/postfab.py_resolve_registry_statustakesregistry_record_idandregistry_nameparams and follows the three-path resolution._resolve_live_statusesreads the new fields from each job item and passes them through.Tests (
test_postfab_live_registry.py)TestResolveByRegistryRecordId,TestResolveByRegistryName,TestFallbackSanitiseDisplayName,TestRecordIdFallbackToName._stub_listcalls updated to expect lowercased names matching the new fallback convention.Stubber+ParamValidator— no mocks that could drift from the API shape.Testing
Live verification