:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(skills): mark input-fixable skill update errors as retryable (#119358)
posthog[bot]9dc52fd267e5
diff --git a/products/skills/backend/tools/skills.py b/products/skills/backend/tools/skills.pyindex 0f58eaafee11..3afdb01285e4 100644--- a/products/skills/backend/tools/skills.py+++ b/products/skills/backend/tools/skills.py@@ -32,7 +32,7 @@ from products.skills.backend.api.skill_services import (from products.skills.backend.models.skills import LLMSkill, LLMSkillFilefrom ee.hogai.tool import MaxTool-from ee.hogai.tool_errors import MaxToolFatalError+from ee.hogai.tool_errors import MaxToolFatalError, MaxToolRetryableErrorMAX_LIST_RESULTS = 50@@ -485,14 +485,9 @@ class UpdateLLMSkillTool(MaxTool):base_version=base_version,version_description=(version_description or "").strip() or None,)- except (- LLMSkillNotFoundError,- LLMSkillVersionConflictError,- LLMSkillVersionLimitError,- LLMSkillFileLimitError,- LLMSkillDescriptionTooLongError,- LLMSkillEditError,- ) as err:+ except (LLMSkillVersionConflictError, LLMSkillEditError, LLMSkillDescriptionTooLongError) as err:+ raise MaxToolRetryableError(_publish_error_message(err, skill_name))+ except (LLMSkillNotFoundError, LLMSkillVersionLimitError, LLMSkillFileLimitError) as err:raise MaxToolFatalError(_publish_error_message(err, skill_name))return f"Updated skill '{skill.name}' — new version v{skill.version}.", Nonediff --git a/products/skills/backend/tools/test_skills.py b/products/skills/backend/tools/test_skills.pyindex c598ac191380..657e14f9b0d0 100644--- a/products/skills/backend/tools/test_skills.py+++ b/products/skills/backend/tools/test_skills.py@@ -20,7 +20,7 @@ from products.skills.backend.tools.skills import (UpdateSkillArgs,)-from ee.hogai.tool_errors import MaxToolFatalError+from ee.hogai.tool_errors import MaxToolFatalError, MaxToolRetryableErrordef _run(tool, **kwargs):@@ -267,16 +267,22 @@ class TestUpdateLLMSkillTool(BaseTest):assert "Do the better thing." in latest.bodyassert "Do a thing." not in latest.body- def test_version_conflict_raises(self):+ @parameterized.expand(+ [+ ("version_conflict", 5, {"body": "new body"}, "modified"),+ ("edit_not_found", 0, {"edits": [{"old": "Missing text.", "new": "x"}]}, "not found"),+ ]+ )+ def test_input_errors_are_retryable(self, _name, version_offset, update_kwargs, expected_error):existing = self._create_skill()tool = UpdateLLMSkillTool(team=self.team, user=self.user)- with self.assertRaisesRegex(MaxToolFatalError, "modified"):+ with self.assertRaisesRegex(MaxToolRetryableError, expected_error):_run(tool,skill_name="make-fractals",- base_version=existing.version + 5,- body="new body",+ base_version=existing.version + version_offset,+ **update_kwargs,)def test_body_and_edits_are_mutually_exclusive(self):