Repository navigation
Look entity ids up instead of rebuilding them in editor scripts - #34
Merged
Merged
Conversation
The shared resolver tried azlmbr.entity.EntityId(int(id)) first and used it whenever IsValid() was true, falling back to scanning SearchBus. On 26.10.0 EntityId(n) answers an invalid id for every n (found in the AiCompanion session's release-candidate run), so the resolver only ever worked through the fallback, and a constructed id that happened to look valid would have acted on the wrong entity. It now always finds the entity's own id object by its text, and an unknown id raises inside the script; a small wrapper, added to any script that resolves ids, turns that into the error entity_not_found instead of a traceback. Script refusals from the AgentServer now keep the gem's code (secure_mode, execution_failed, ...) instead of a hard-coded editor_error, so an agent can see that editor Python is disabled. The surface harness's level now holds entities matching the sample ids, as a real level would; the set_parent test reads back the parent it asked for.
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.
What
Every editor tool that takes an entity id resolves it in its editor-Python script through one shared resolver. That resolver tried
azlmbr.entity.EntityId(int(id))first and used it wheneverIsValid()was true, otherwise scanningSearchBusfor the entity.The AiCompanion session found, and I confirmed live on 26.10.0, that
EntityId(n)answers[4294967295]withIsValid() == Falsefor everyn, including a real id. So the resolver only ever worked through its fallback scan. It was correct by accident, and a constructed id that looked valid would have acted on the wrong entity.Changes
entity_not_foundinstead of a traceback, for all 16 tools that take an entity id.secure_modewhen editor Python is disabled,execution_failed, ...) instead of a hard-codededitor_error, so an agent can see why.CLAUDE.mdrecords the convention: get an entity with_resolve_entity_id, neverentity.EntityId(n).Tests
entity_not_found. The harness's level now holds entities matching the sample ids, as a real level would, and theset_parenttest reads back the parent it asked for.secure_moderefusal keeps its code.get_transformon an unknown id returns{"status": "error", "code": "entity_not_found", "message": "No entity with id 123456789"}.