fix(robomp): parameterized bot identity in system prompts
system_append.md and system_append_pr_review.md hardcoded the literal
'robomp' as the bot persona, so the agent self-mentioned an account
that does not exist when deployments configure ROBOMP_BOT_LOGIN to a
different login. Affected users saw the agent ask for @robomp mentions
that GitHub never resolved to the actual bot.
Thread the configured login through persona.system_append and
persona.system_append_pr_review as a bot_login keyword, render it
via the existing {{bot_login}} placeholder, and pass
settings.bot_login at the worker callsite. Regression test asserts the
templated login lands in both prompts and the legacy literal is gone.
Fixes #1932
This commit is contained in:
@@ -181,3 +181,27 @@ def test_review_completion_reminder_mentions_submit_only() -> None:
|
||||
)
|
||||
assert "submit_pr_review" in out
|
||||
assert "gh_open_pr" not in out
|
||||
|
||||
|
||||
def test_system_append_renders_configured_bot_login() -> None:
|
||||
out = persona.system_append(
|
||||
repo=_Repo(),
|
||||
issue=_Issue(),
|
||||
workspace=_Workspace(),
|
||||
bot_login="Svitter",
|
||||
)
|
||||
# The hardcoded persona name MUST be replaced by the configured login so
|
||||
# the agent self-mentions the account that actually receives webhooks.
|
||||
assert "You are **@Svitter**" in out
|
||||
assert "**robomp**" not in out
|
||||
|
||||
|
||||
def test_system_append_pr_review_renders_configured_bot_login() -> None:
|
||||
out = persona.system_append_pr_review(
|
||||
repo=_Repo(),
|
||||
issue=_Issue(),
|
||||
workspace=_Workspace(),
|
||||
bot_login="Svitter",
|
||||
)
|
||||
assert "You are **@Svitter**" in out
|
||||
assert "**robomp**" not in out
|
||||
|
||||
@@ -149,7 +149,7 @@ def _patch_worker(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
|
||||
monkeypatch.setattr("robomp.worker.host_tools.build", lambda _b: ())
|
||||
monkeypatch.setattr(
|
||||
"robomp.worker.persona.system_append",
|
||||
lambda *, repo, issue, workspace: "SYS",
|
||||
lambda *, repo, issue, workspace, bot_login: "SYS",
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"robomp.worker.persona.seed_phases",
|
||||
|
||||
Reference in New Issue
Block a user