Skip to content

Commit 26481e2

Browse files
fix: fix tests and lint
1 parent bb227b3 commit 26481e2

File tree

6 files changed

+27
-16
lines changed

6 files changed

+27
-16
lines changed

core/framework/credentials/validation.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,7 @@ def format_error_message(self) -> str:
159159
f" {c.env_var} for {_label(c)}"
160160
f"\n Connect this integration at hive.adenhq.com first."
161161
)
162-
lines.append(
163-
"\nIf you've already set up credentials, "
164-
"restart your terminal to load them."
165-
)
162+
lines.append("\nIf you've already set up credentials, restart your terminal to load them.")
166163
return "\n".join(lines)
167164

168165

core/framework/graph/edge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ def validate(self) -> list[str]:
740740
# GCU nodes must be referenced in at least one parent's sub_agents
741741
referenced_subagents = set()
742742
for node in self.nodes:
743-
for sa_id in (node.sub_agents or []):
743+
for sa_id in node.sub_agents or []:
744744
referenced_subagents.add(sa_id)
745745

746746
orphaned = gcu_node_ids - referenced_subagents

core/framework/runner/preload_validation.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ def validate_credentials(
9797
# Preserve the original validation_result so callers can
9898
# inspect which credentials are still missing.
9999
exc = CredentialError(
100-
"Credential setup incomplete. "
101-
"Run again after configuring the required credentials."
100+
"Credential setup incomplete. Run again after configuring the required credentials."
102101
)
103102
if hasattr(e, "validation_result"):
104103
exc.validation_result = e.validation_result # type: ignore[attr-defined]
@@ -128,10 +127,16 @@ def credential_errors_to_json(exc: Exception) -> dict:
128127
failed = result.failed
129128
missing = []
130129
for c in failed:
130+
if c.available:
131+
status = "invalid"
132+
elif c.aden_not_connected:
133+
status = "aden_not_connected"
134+
else:
135+
status = "missing"
131136
entry: dict = {
132137
"credential": c.credential_name,
133138
"env_var": c.env_var,
134-
"status": "invalid" if c.available else ("aden_not_connected" if c.aden_not_connected else "missing"),
139+
"status": status,
135140
}
136141
if c.tools:
137142
entry["tools"] = c.tools

core/framework/tools/queen_lifecycle_tools.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ async def _preflight():
187187
await loop.run_in_executor(
188188
None,
189189
lambda: validate_credentials(
190-
runtime.graph.nodes, interactive=False, skip=False,
190+
runtime.graph.nodes,
191+
interactive=False,
192+
skip=False,
191193
),
192194
)
193195
except CredentialError as e:
@@ -245,9 +247,7 @@ async def _preflight():
245247
# Build structured error with per-credential details so the
246248
# queen can report exactly what's missing and how to fix it.
247249
error_payload = credential_errors_to_json(e)
248-
error_payload["agent_path"] = str(
249-
getattr(session, "worker_path", "") or ""
250-
)
250+
error_payload["agent_path"] = str(getattr(session, "worker_path", "") or "")
251251

252252
# Emit SSE event so the frontend opens the credentials modal
253253
bus = getattr(session, "event_bus", None)

core/tests/test_execution_stream.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,19 @@ async def stream(
4747
) -> AsyncIterator[StreamEvent]:
4848
self._call_count += 1
4949

50-
if self._call_count == 1:
51-
# First call: set the output via tool call
50+
# Each execution takes 2 LLM calls:
51+
# - Odd calls (1, 3, 5, ...): set output via tool call
52+
# - Even calls (2, 4, 6, ...): finish with text
53+
if self._call_count % 2 == 1:
54+
# First call of each execution: set the output via tool call
5255
yield ToolCallEvent(
5356
tool_use_id=f"tc_{self._call_count}",
5457
tool_name="set_output",
5558
tool_input={"key": "result", "value": "ok"},
5659
)
5760
yield FinishEvent(stop_reason="tool_use", input_tokens=10, output_tokens=10)
5861
else:
59-
# Subsequent calls: just finish with text
62+
# Second call of each execution: finish with text
6063
yield TextDeltaEvent(content="Done.", snapshot="Done.")
6164
yield FinishEvent(stop_reason="end_turn", input_tokens=5, output_tokens=5)
6265

examples/templates/email_inbox_management/nodes/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@
106106
node_type="event_loop",
107107
client_facing=False,
108108
max_node_visits=0,
109-
input_keys=["rules", "max_emails", "next_page_token", "last_processed_timestamp", "query"],
109+
input_keys=[
110+
"rules",
111+
"max_emails",
112+
"next_page_token",
113+
"last_processed_timestamp",
114+
"query",
115+
],
110116
output_keys=["emails", "next_page_token"],
111117
nullable_output_keys=["next_page_token"],
112118
system_prompt="""\

0 commit comments

Comments
 (0)