diff --git a/cecli/helpers/conversation/integration.py b/cecli/helpers/conversation/integration.py
index f5c046728e2..f649689323d 100644
--- a/cecli/helpers/conversation/integration.py
+++ b/cecli/helpers/conversation/integration.py
@@ -201,9 +201,19 @@ def add_randomized_cta(self) -> None:
]
)
+ user_fidelity = random.choice(
+ [
+ "Be mindful of any instructions given, prioritizing the latest.",
+ "Respect all established constraints.",
+ "Please stay on task and stick closely to my guidance.",
+ "Keep my explicit intent in mind.",
+ "Stay focused on our goals and the scope of our concerns.",
+ ]
+ )
+
msg = dict(
role="user",
- content="System Message:\n\n" + message,
+ content=f"System Message:\n\n{message}\n{user_fidelity}",
)
ConversationService.get_manager(coder).add_message(
diff --git a/cecli/prompts/agent.yml b/cecli/prompts/agent.yml
index 988538838a5..6ed6e1566b7 100644
--- a/cecli/prompts/agent.yml
+++ b/cecli/prompts/agent.yml
@@ -46,7 +46,7 @@ main_system: |
2. **Explore**: Use discovery tools (`ExploreCode`, `Grep`, `Ls`) to research and gather understanding for you task. Modify search terms when errors are encountered.
3. **Execute**: Mark files as editable with `ContextManager` before attempting edits. Proactively use skills if they are available. Review diff outputs after edit to ensure the proper changes were made.
4. **Verify & Recover**: If an edit fails or introduces linting errors, use `UndoChange` immediately.
- 5. **Yield**: Use the `Yield` tool only after verifying the solution. Briefly summarize the changes for the user.
+ 5. **Yield**: Use the `Yield` tool after accomplishing the goal and verifying any changes made. Provide helpful summaries of any changes.
## Todo List Management
- Break complex goals into meaningful sub-tasks so the problem remains tractable
@@ -57,12 +57,12 @@ main_system: |
Use the `.cecli/temp` directory for all temporary, test, or scratch files.
- Always reply to the user in {language}.
+ Always reply in {language}.
system_reminder: |
## Operational Rules
- - **Scope**: No unrequested refactors. Avoid full-file rewrites.
+ - **Scope**: No unrequested refactors. Avoid full-file rewrites. Only modify what you are asked to.
- **Hygiene**: Use `ContextManager`/`RemoveSkill` to evict unneeded files/skills immediately after use.
- **Outputs**: Tool calls trigger turns. Never include tool syntax in final user summaries.
- **Sandbox**: Perform all verification and temp logic in `.cecli/temp`.
diff --git a/cecli/prompts/subagent.yml b/cecli/prompts/subagent.yml
index 1339499995c..7786b0f6aa9 100644
--- a/cecli/prompts/subagent.yml
+++ b/cecli/prompts/subagent.yml
@@ -31,7 +31,7 @@ main_system: |
2. **Explore**: Use discovery tools (`ExploreCode`, `Grep`, `Ls`) to research and gather understanding for you task. Modify search terms when errors are encountered.
3. **Execute**: Mark files as editable with `ContextManager` before attempting edits. Proactively use skills if they are available. Review diff outputs after edit to ensure the proper changes were made.
4. **Verify & Recover**: If an edit fails or introduces linting errors, use `UndoChange` immediately.
- 5. **Yield**: Use the `Yield` tool only after verifying the solution. Briefly summarize the changes for the user.
+ 5. **Yield**: Use the `Yield` tool after accomplishing the goal and verifying any changes made. Provide helpful summaries of any changes.
## Todo List Management
- Break complex goals into meaningful sub-tasks so the problem remains tractable
@@ -42,12 +42,12 @@ main_system: |
Use the `.cecli/temp` directory for all temporary, test, or scratch files.
- Always reply to the user in {language}.
+ Always reply in {language}.
system_reminder: |
## Operational Rules
- - **Scope**: No unrequested refactors. Avoid full-file rewrites.
+ - **Scope**: No unrequested refactors. Avoid full-file rewrites. Only modify what you are asked to.
- **Hygiene**: Use `ContextManager`/`RemoveSkill` to evict unneeded files/skills immediately after use.
- **Outputs**: Tool calls trigger turns. Never include tool syntax in final user summaries.
- **Sandbox**: Perform all verification and temp logic in `.cecli/temp`.
diff --git a/cecli/tui/app.py b/cecli/tui/app.py
index 9d151bff074..2613c091336 100644
--- a/cecli/tui/app.py
+++ b/cecli/tui/app.py
@@ -722,9 +722,9 @@ def update_spinner(self, msg, agent_name: str | None = None):
def show_error(self, message, agent_name: str | None = None):
"""Show an error message in the status bar."""
- self.status_bar.show_notification(
- message, severity="error", timeout=5, agent_name=agent_name
- )
+ status_bar = self.query_one("#status-bar", StatusBar)
+
+ status_bar.show_notification(message, severity="error", timeout=5, agent_name=agent_name)
def on_resize(self) -> None:
file_list = self.query_one("#file-list", FileList)
diff --git a/tests/tui/test_app.py b/tests/tui/test_app.py
index 5d008b93ad3..ec68cfd657e 100644
--- a/tests/tui/test_app.py
+++ b/tests/tui/test_app.py
@@ -197,9 +197,12 @@ def mock_query_one(selector, *args):
if isinstance(selector, type):
name = selector.__name__
else:
- if "," in selector or "#" in selector:
+ if selector == "#input" or selector == "#input, InputArea":
return mock_input_area
- return mock_footer
+ elif selector == "#status-bar" or selector == "#status-bar, StatusBar":
+ return mock_status_bar
+ name = "MainFooter" # Default fallback
+
mapping = {
"MainFooter": mock_footer,
"StatusBar": mock_status_bar,
@@ -217,9 +220,6 @@ def mock_query_one(selector, *args):
tui_instance.worker = MagicMock()
tui_instance.worker.coder = mock_coder
- # Stub status_bar reference
- tui_instance.status_bar = mock_status_bar
-
# Mock AgentService - unknown UUID should return None (no prefix)
monkeypatch.setattr(
"cecli.helpers.agents.service.AgentService.get_instance",
@@ -239,3 +239,40 @@ def mock_query_one(selector, *args):
timeout=5,
agent_name=None,
)
+
+
+def test_show_error_uses_query_one(tui_instance):
+ """
+ Test that show_error uses query_one to get the status bar and show a notification.
+ """
+ mock_status_bar = MagicMock()
+ tui_instance.query_one = MagicMock(return_value=mock_status_bar)
+
+ # Import StatusBar for the assertion
+ from cecli.tui.widgets import StatusBar
+
+ tui_instance.show_error("A test error", agent_name="test_agent")
+
+ # Assert query_one was called correctly
+ tui_instance.query_one.assert_called_once_with("#status-bar", StatusBar)
+
+ # Assert show_notification was called on the result of query_one
+ mock_status_bar.show_notification.assert_called_once_with(
+ "A test error",
+ severity="error",
+ timeout=5,
+ agent_name="test_agent",
+ )
+ # Test: error message for unknown agent should have agent_name=None
+ msg = {
+ "type": "error",
+ "message": "Something went wrong!",
+ "coder_uuid": "unknown_uuid",
+ }
+ tui_instance.handle_output_message(msg)
+ mock_status_bar.show_notification.assert_called_once_with(
+ "Something went wrong!",
+ severity="error",
+ timeout=5,
+ agent_name=None,
+ )