feat: forward agent display identity to prompts
This commit is contained in:
@@ -62,6 +62,26 @@ class TestAgentProviderRuntime(unittest.TestCase):
|
||||
config = Path(tmp, "codex-config.toml").read_text()
|
||||
self.assertIn('[projects."/home/node/workspace"]', config)
|
||||
|
||||
def test_codex_injects_name_and_color_into_prompt(self):
|
||||
with tempfile.TemporaryDirectory(prefix="bb-provider.") as tmp:
|
||||
prompt_file = Path(tmp) / "prompt.txt"
|
||||
prompt_file.write_text("Existing instructions.\n")
|
||||
plan = build_agent_provision_plan(
|
||||
template="codex",
|
||||
dockerfile="",
|
||||
state_dir=Path(tmp),
|
||||
instance_name="bot-bottle-test",
|
||||
prompt_file=prompt_file,
|
||||
label="review-api",
|
||||
color="bright-cyan",
|
||||
)
|
||||
prompt = prompt_file.read_text()
|
||||
self.assertTrue(plan.has_prompt)
|
||||
self.assertIn("Bot-bottle agent display identity:", prompt)
|
||||
self.assertIn("Name: review-api", prompt)
|
||||
self.assertIn("Color: bright-cyan", prompt)
|
||||
self.assertTrue(prompt.endswith("Existing instructions.\n"))
|
||||
|
||||
def test_codex_forward_host_credentials_adds_auth_and_verify(self):
|
||||
with tempfile.TemporaryDirectory(prefix="bb-provider.") as tmp:
|
||||
home = Path(tmp) / "host-codex"
|
||||
@@ -126,6 +146,26 @@ class TestAgentProviderRuntime(unittest.TestCase):
|
||||
self.assertIn("/home/node", config["projects"])
|
||||
self.assertIn("/home/node/workspace", config["projects"])
|
||||
|
||||
def test_claude_injects_name_and_color_into_prompt(self):
|
||||
with tempfile.TemporaryDirectory(prefix="bb-provider.") as tmp:
|
||||
prompt_file = Path(tmp) / "prompt.txt"
|
||||
prompt_file.write_text("Existing instructions.\n")
|
||||
plan = build_agent_provision_plan(
|
||||
template="claude",
|
||||
dockerfile="",
|
||||
state_dir=Path(tmp),
|
||||
instance_name="bot-bottle-test",
|
||||
prompt_file=prompt_file,
|
||||
label="research-ui",
|
||||
color="green",
|
||||
)
|
||||
prompt = prompt_file.read_text()
|
||||
self.assertTrue(plan.has_prompt)
|
||||
self.assertIn("Bot-bottle agent display identity:", prompt)
|
||||
self.assertIn("Name: research-ui", prompt)
|
||||
self.assertIn("Color: green", prompt)
|
||||
self.assertTrue(prompt.endswith("Existing instructions.\n"))
|
||||
|
||||
def test_codex_forward_host_credentials_populates_egress_routes(self):
|
||||
with tempfile.TemporaryDirectory(prefix="bb-provider.") as tmp:
|
||||
home = Path(tmp) / "host-codex"
|
||||
|
||||
@@ -127,6 +127,21 @@ class TestClaudeProvisionPrompt(unittest.TestCase):
|
||||
self.assertIsNone(r)
|
||||
bottle.cp_in.assert_called_once()
|
||||
|
||||
def test_returns_path_when_provider_prompt_has_identity(self):
|
||||
bottle = _make_bottle()
|
||||
provision = AgentProvisionPlan(
|
||||
template="claude", command="claude", prompt_mode="append_file",
|
||||
image="", dockerfile="", guest_home="/home/node",
|
||||
instance_name="bot-bottle-demo-abc12",
|
||||
prompt_file=Path("/tmp/prompt.txt"),
|
||||
guest_env={},
|
||||
has_prompt=True,
|
||||
)
|
||||
r = ClaudeAgentProvider().provision_prompt(
|
||||
_plan(agent_prompt="", agent_provision=provision), bottle,
|
||||
)
|
||||
self.assertEqual("/home/node/.bot-bottle-prompt.txt", r)
|
||||
|
||||
def test_chowns_to_node_after_copy(self):
|
||||
bottle = _make_bottle()
|
||||
ClaudeAgentProvider().provision_prompt(_plan(), bottle)
|
||||
|
||||
@@ -130,6 +130,22 @@ class TestCodexProvisionPrompt(unittest.TestCase):
|
||||
self.assertIsNone(r)
|
||||
bottle.cp_in.assert_called_once()
|
||||
|
||||
def test_returns_path_when_provider_prompt_has_identity(self):
|
||||
bottle = _make_bottle()
|
||||
provision = AgentProvisionPlan(
|
||||
template="codex", command="codex",
|
||||
prompt_mode="read_prompt_file",
|
||||
image="", dockerfile="", guest_home="/home/node",
|
||||
instance_name="bot-bottle-demo-abc12",
|
||||
prompt_file=Path("/tmp/prompt.txt"),
|
||||
guest_env={},
|
||||
has_prompt=True,
|
||||
)
|
||||
r = CodexAgentProvider().provision_prompt(
|
||||
_plan(agent_prompt="", agent_provision=provision), bottle,
|
||||
)
|
||||
self.assertEqual("/home/node/.bot-bottle-prompt.txt", r)
|
||||
|
||||
|
||||
class TestCodexProvisionSkills(unittest.TestCase):
|
||||
def test_noop_when_agent_has_no_skills(self):
|
||||
|
||||
Reference in New Issue
Block a user