Skip to content
Closed
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
8 changes: 5 additions & 3 deletions cecli/coders/agent_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,10 +833,12 @@ def get_environment_info(self):
result += f"- Git repository: {rel_repo_dir} with {num_files:,} files\n"
except Exception:
result += "- Git repository: active but details unavailable\n"
if self.mcp_manager and self.mcp_manager.connected_servers:
num_mcp_servers = len(self.mcp_manager.connected_servers)
result += f"- Connected MCP servers: {num_mcp_servers}\n"
else:
result += "- Git repository: none\n"

if self.mcp_manager and self.mcp_manager.connected_servers:
num_mcp_servers = len(self.mcp_manager.connected_servers)
result += f"- Connected MCP servers: {num_mcp_servers}\n"
result += "</context>"
return result
except Exception as e:
Expand Down
10 changes: 10 additions & 0 deletions cecli/coders/base_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,15 @@ def __init__(
if root is not None:
self.root = os.path.normpath(os.path.abspath(root))

# Outside a git repo with no files in context there is nothing to derive
# a root from. Fall back to the primary workspace (sub-agents) or the
# process working directory so tools that pass root as their subprocess
# cwd never receive an empty path.
if not self.root:
self.root = utils.safe_abs_path(
primary_root or getattr(self, "primary_root", None) or os.getcwd()
)

# A sub-agent may operate on a different base path than its parent. In
# that case its repo must be scoped to *this* root (per-base-path),
# rather than inheriting the parent's repo, so the coder's repo/fs match
Expand Down Expand Up @@ -2331,6 +2340,7 @@ async def compact_context_if_needed(self, force=False, message=""):
if (
self.context_compaction_max_tokens
and non_compactable_tokens >= self.context_compaction_max_tokens
and not force
):
if getattr(self, "_compaction_noop_warning_time", 0) + 300 < time.time():
self._compaction_noop_warning_time = time.time()
Expand Down
Loading
Loading