Conversation
…_use Cherry-pick of upstream PR #47473 (commit 85babcb, author yf.jin) for issue #47472. Recovers bare <invoke> tool-call markup that opus-4-8 leaves in assistant text when the antml: namespace prefix is dropped and the serving layer cannot promote it to a structured tool_use block. Carried locally — upstream PR still OPEN/BLOCKED as of cherry-pick. Tests: tests/agent/transports/test_anthropic_invoke_salvage.py (19 passed).
Extend the carried text-embedded tool-call salvage for the observed opus-4-8 edge case where the outer invoke tag loses only its opening '<' and arrives as 'antml:invoke ...>' while the closing '</invoke>' remains complete. Keeps plain 'invoke name=...' prose unsalvaged by requiring either '<invoke'/'<antml:invoke' or 'antml:invoke'. Follow-up to carried upstream PR #47473 / issue #47472. Tests: python -m pytest tests/agent/transports/test_anthropic_invoke_salvage.py -o 'addopts=' -q (22 passed)
Follow-up on the cherry-picked salvage: some gateways render the Anthropic-ML namespace separator as an underscore (antml_invoke / antml_parameter) rather than a colon. Widen _SALVAGE_INVOKE_RE / _SALVAGE_PARAM_RE from (?:antml:) to (?:antml[:_]) so those leak shapes are recovered too, add a regression test, and map the contributor in scripts/release.py AUTHOR_MAP.
Contributor
🔎 Lint report:
|
| Rule | Count |
|---|---|
unresolved-attribute |
2 |
unresolved-import |
1 |
First entries
tests/run_agent/test_credits_notices_toggle.py:76: [unresolved-attribute] unresolved-attribute: Unresolved attribute `_credits_session_start_micros` on type `AIAgent`
tests/agent/transports/test_anthropic_invoke_salvage.py:25: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
run_agent.py:2989: [unresolved-attribute] unresolved-attribute: Object of type `Self@get_credits_spent_micros` has no attribute `_credits_session_start_micros`
✅ Fixed issues (1):
| Rule | Count |
|---|---|
invalid-assignment |
1 |
First entries
tests/run_agent/test_credits_notices_toggle.py:76: [invalid-assignment] invalid-assignment: Object of type `None` is not assignable to attribute `_credits_session_start_micros` of type `int`
Unchanged: 5993 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
Collaborator
Author
|
Closing without merge — the bug doesn't reproduce on native Anthropic. See issue #47472 for the full writeup. CI was green; this is a taste/premise call, not a quality one. |
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.
Summary
The skill curator no longer touches
skills.external_dirsskills — the user'sshared, often version-controlled skill library is now read-only to autonomous
curation, while foreground user-directed edits still work.
Salvages #51875 (@yu-xin-c) and closes the gap that made its headline guard
inert, plus credits @x7peeps (#47752) who reported the same fix first.
Root cause
External-dir skills were visible to the curator's LLM review fork, which could
archive/skill_manage/raw-terminalthem in place. The automatic sweep wasalready safe (rooted at the local skills dir), but the LLM agent operated
through general-purpose tools with no external-ownership boundary.
#51875 added an
is_external_skill_pathboundary and a background-review writeguard in
skill_manage— but that guard only fires whenis_background_review()is true, and the curator fork ran under the defaultassistant_toolorigin, so the guard never triggered during the curationpass it was built to stop. This PR fixes that keystone.
Changes
agent/skill_utils.py:is_external_skill_path()— central ownership boundary.tools/skill_usage.py: external skills are ineligible for curation; excludedfrom
list_agent_created_skill_names/agent_created_report(so the LLM isnever shown them);
archive_skillrefuses them.tools/skill_manager_tool.py:_background_review_write_guardrefusesautonomous
patch/edit/delete/write_file/remove_fileon external (andbundled / hub-installed) skills; foreground user edits still pass.
agent/curator.py: set_memory_write_origin="background_review"on thereview fork so
turn_contextbinds the origin and the guard actually fires;prompt rule marks external dirs read-only.
exclusion, background-review
skill_managerefusal, and a regression testasserting the fork runs under the
background_revieworigin.Validation
background_review)patch/deleteof external skillassistant_tool)patchof same external skillcreated_by: agent)is_curation_eligible(external)/archive_skill(external)scripts/run_tests.sh tests/agent/test_skill_utils.py tests/tools/test_skill_usage.py tests/tools/test_skill_manager_tool.py tests/agent/test_curator.py tests/agent/test_turn_context.py→ 236 passed, 0 failed. Plus an isolated E2E run against a temp HERMES_HOME confirming the table above.Known residual
The raw-
terminalmv/rmpath is deterred by the prompt rule (the LLM isnever handed an external path in the candidate list), not hard-blocked — shell
commands can't be intercepted per-path. The enforceable layers (candidate-list
exclusion, eligibility,
archive_skill,skill_manageguard) are all hard.Closes #47688. Supersedes #51875 and #47752.
Infographic