Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/specify_cli/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,8 @@ def register_commands(
_integ = get_integration(agent_name)
if _integ is not None:
_sep = _integ.invoke_separator_for_mode(registrar_writes_skills)
except Exception:
except (ImportError, ValueError, KeyError):
Comment thread
Quratulain-bilal marked this conversation as resolved.
pass
pass
_prefix = get_invocation_prefix(agent_name, registrar_writes_skills)

Expand Down
26 changes: 26 additions & 0 deletions tests/test_post_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,29 @@ def test_cline_transforms_applied_via_registrar(
# _rewrite_handoff_references rewrote the dotted agent handoff
assert "agent: speckit-foo" in content
assert "agent: speckit.foo" not in content


def test_register_commands_propagates_programming_errors(tmp_path):
"""Regression: narrowed exception must not swallow TypeError/AttributeError.

The invoke separator resolution narrowed from bare 'except Exception' to
'except (ImportError, ValueError, KeyError)'. Programming errors like
TypeError must propagate instead of being silently swallowed.
"""
registrar = CommandRegistrar()
commands = [{"name": "test.cmd", "file": "commands/test.md"}]

ext_dir = tmp_path / "ext"
ext_dir.mkdir()

def _broken_get_integration(name):
raise TypeError("intentional programming error")

import specify_cli.integrations as integ_mod
original = integ_mod.get_integration
integ_mod.get_integration = _broken_get_integration
try:
with pytest.raises(TypeError, match="intentional programming error"):
registrar.register_commands("bob", commands, "ext", ext_dir, tmp_path)
finally:
integ_mod.get_integration = original