Skip to content

fix(replay): map and narrate unnamed agents (Agent(instructions=...)) - #318

Merged
MervinPraison merged 2 commits into
mainfrom
fix/replay-unnamed-agents
Oct 27, 2026
Merged

MervinPraison merged 2 commits into
mainfrom
fix/replay-unnamed-agents

Conversation

@MervinPraison

Copy link
Copy Markdown
Owner

Bug: watch(Agent(instructions="...")) shows "Nothing to map yet", and its steps read "The run started", "The run thought with…". An agent created without name= records agent_name: null, and the Replay map skipped every such event. This reproduces on the released aiui 0.3.148 / praisonai 4.7.19.

Fix (replay-core.js, about 25 lines):

  • agentOf(ev) works out which agent an event belongs to, in this order:
    • agent_name;
    • the package's id (agent:Agent, from the companion core fix);
    • for 4.7.19 traces, tool:None/<tool>, or nothing at all on the agent's own run events, which falls back to Agent.
  • deriveGraph, nodeIdsForEvent and narrate use it. The agent and its tools are drawn and change state, steps read "Agent started.", and no tool:None id reaches the map.
  • Only when no graph was recorded. A team graph leaves unnamed agents out on purpose, so observedGraph asks for them only when there is no graph; they don't reappear as "Outside the team".

Tests

  • tests/js/replay-core.test.mjs: 46 pass, 6 of them new:

    • the unnamed agent on the map, for both the new and the 4.7.19 trace ids;
    • a failed run shown red;
    • no "outside" box next to a recorded team graph;
    • named agents unchanged;
    • narration.

    The two map tests fail on the old code.

  • tests/unit: 1646 passed. Browser tests with axe: 19 passed.

  • End to end with real gpt-4o-mini: watch(Agent(instructions=...)) now shows one Agent box, done, both with the companion core fix and on praisonai 4.7.19 as released.

The companion core PR in MervinPraison/PraisonAI fixes the trace ids at the source.

🤖 Generated with Claude Code

An agent created without name= records agent_name null. The Replay map
skipped every such event, so watch(Agent(instructions=...)) showed
"Nothing to map yet" and its steps were narrated as "The run".

- agentOf(ev): agent_name, else the package's id (agent:Agent from the
  companion core fix), else tool:None/<tool> or nothing in 4.7.19 traces,
  falling back to "Agent" for an agent's own run events.
- deriveGraph / nodeIdsForEvent / narrate use it, so the agent and its tools
  are drawn and lit, and steps read "Agent started.".
- Only when no graph was recorded: a team graph leaves unnamed agents out on
  purpose, and they must not reappear as "Outside the team".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 27, 2026 09:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@MervinPraison MervinPraison added pipeline/blocked:ci Blocked: CI not green on HEAD pipeline/blocked:no-final Blocked: no FINAL @claude trigger yet pipeline/reviews-pending Waiting for CodeRabbit/Qodo/Copilot reviews labels Oct 27, 2026
@MervinPraison
MervinPraison merged commit 34a01c1 into main Oct 27, 2026
17 checks passed
@MervinPraison

Copy link
Copy Markdown
Owner Author

@claude You are the FINAL architecture reviewer. If the branch is under MervinPraison/PraisonAIUI (not a fork), you are able to make modifications to this branch and push directly. SCOPE: Focus ONLY on PraisonAIUI (src/praisonaiui, src/frontend, tests, docs). Do NOT expand into praisonaiagents or the monorepo unless the PR explicitly requires it. Read ALL comments above from Gemini, Qodo, CodeRabbit, and Copilot carefully before responding.

Phase 1: Review per AGENTS.md

  1. Protocol-driven: check heavy implementations vs core SDK
  2. Backward compatible: ensure zero feature regressions
  3. Performance: no hot-path regressions (lazy imports, import-time <200ms)
  4. Product value: review in depth whether the change genuinely adds PraisonAIUI UX value — never add features for the sake of adding them. It must strengthen the UI (simpler, more user-friendly, robust). If it does not clearly add value, request changes or recommend rejecting/closing rather than merging scope creep.
  5. Layering: UI/frontend/server features here; core agent runtime belongs in praisonaiagents (PraisonAI monorepo). Agent-callable tools → PraisonAI-Tools. Do not pull monorepo or SDK scope into this repo unless the PR explicitly requires it.
  6. Do not bloat server.py or create_app() with new params — prefer existing YAML config, plugins, and feature modules; only add params if absolutely required. Reject knobs/exports with no live consumer.

Phase 2: FIX Valid Issues
5. For any VALID bugs or architectural flaws found by Gemini, CodeRabbit, Qodo, Copilot, or any other reviewer: implement the fix
6. Push all code fixes directly to THIS branch (do NOT create a new PR)
7. Comment a summary of exact files modified and what you skipped

Phase 3: Final Verdict
8. If all issues are resolved, approve the PR / close the Issue
9. If blocking issues remain, request changes / leave clear action items

@praisonai-triage-agent

Copy link
Copy Markdown
Contributor

Final architecture review

Other reviewers: none to act on. Copilot did not run (quota), and Gemini, Qodo and CodeRabbit left no comments.

Phase 1: review against AGENTS.md

  • Product value: this fixes a real bug. watch(Agent(instructions=...)) showed "Nothing to map yet" and its steps read "The run started". With the fix, the agent and its tools appear on the map and change state, and steps read "Agent started."
  • Scope: the change is all in replay-core.js. There are no server, create_app() or Python changes, no new dependencies and no new config knobs. The deriveGraph(events, opts) option is internal and its one caller is observedGraph.
  • Backward compatibility: named agents behave as before (there is a test for it). When a team graph is recorded, unnamed agents stay hidden and do not show up as "Outside the team". tool:None/... ids no longer reach the map.
  • Performance: a few string checks per event, so nothing that affects hot paths.
  • Layering: correct. The UI now tolerates traces from praisonai 4.7.19. The source fix for those trace ids is in the companion core PR.

Phase 2: fixes pushed (8add511)
Only one file changed: src/praisonaiui/templates/frontend/plugins/views/replay-core.js

  1. Moved nodeIdsForEvent's doc comment back onto that function. The PR had left it stranded above agentOf's docblock.
  2. Made agentOf module-private and took it out of the globalThis.PraisonReplayCore API. It had no consumer outside this file, and AGENTS.md says not to export without a live consumer.
  3. observedGraph now reuses the hasGraph check instead of repeating the same condition.

Skipped: nothing else needed changing.

Tests: node --test tests/js/*.mjs gives 46 passed and 0 failed. No Python files changed, and pytest is not installed in this runner, so I did not run pytest tests/unit here.

Phase 3: verdict. I found no blocking issues, and the PR is ready to merge ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pipeline/blocked:ci Blocked: CI not green on HEAD pipeline/blocked:no-final Blocked: no FINAL @claude trigger yet pipeline/reviews-pending Waiting for CodeRabbit/Qodo/Copilot reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants