Skip to content
Open
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
1 change: 1 addition & 0 deletions src/nooa/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ def _resolve_system_prompt(self) -> str:
value = format(value, fmt_spec)
parts.append(str(value))
except Exception:
logger.debug("Prompt template eval failed for %r", field, exc_info=True)
placeholder = field
if conversion:
placeholder = f"{field}!{conversion}"
Expand Down
2 changes: 1 addition & 1 deletion src/nooa/runtime/async_safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _is_event_loop_thread() -> bool:
# Compare thread IDs - _thread_id is set when loop starts
if hasattr(loop, "_thread_id"):
return bool(getattr(loop, "_thread_id") == current_thread().ident) # noqa: B009
return True # Assume yes if we can't check
return False # Assumed not event loop thread — err on safe side
except RuntimeError:
return False # No running loop

Expand Down
7 changes: 5 additions & 2 deletions src/nooa/runtime/method_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,10 @@ def wrapper(self: Any, *args: Any, **kwargs: Any) -> Any:
# nearest traced ancestor — same semantics as the async wrapper.
_push_agent_call_id(call_id if _tracing_enabled[0] else parent_call_id)

# Same agent-call event as the async wrapper. The sync wrapper doesn't
# set _parent_agent_var, so read it directly for is_top_level.
# Set parent agent for LLM inheritance — subagents instantiated inside
# this sync method can inherit the parent's LLM (mirrors async wrapper).
parent_token = _parent_agent_var.set(self)

is_top_level = _parent_agent_var.get() is None
try:
self.event_manager.add(
Expand Down Expand Up @@ -490,6 +492,7 @@ def wrapper(self: Any, *args: Any, **kwargs: Any) -> Any:
except Exception: # noqa: BLE001
logger.debug("agent-call: AfterAgentCall emission failed (sync)", exc_info=True)
_pop_agent_call_id()
_parent_agent_var.reset(parent_token)
if hook_context is not None:
call_after_hook(
"after_agent_call",
Expand Down