hero_router AI agent: chained workspace/board creation on hero_whiteboard fails #107
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When the hero_router per-service dashboard's AI Agent tab is used against
hero_whiteboard, chained operations that involve workspaces and boards are unreliable.Reported by @kristof on 2026-04-09 with two concrete reproductions (screenshots in chat).
Reproduction 1 — FOREIGN KEY failure
Prompt:
Observed: Agent completes "successfully" creating a whiteboard called
Test Board, but then:when adding the 5 boxes. Whiteboard's SQL schema has
boards.workspace_id REFERENCES workspaces(id)— the AI-generated Python passed a workspace_id that doesn't exist (it conflated "Test Board" as both workspace and board name, or hallucinated the id).Reproduction 2 — Boxes land on wrong board
Follow-up prompt:
i dont see them / is for board 2Response: "Looks like the 10 colored boxes you requested were successfully added, but they were placed on 'Board 1' instead of 'Board 2'"
The agent had no cross-turn context; its Python re-resolved board names from scratch and picked the wrong id.
Root cause
This is not a routing/URL issue — the router fix from session 18 doesn't touch it. The failures are in:
hero_router/crates/hero_router/src/server/agent.rs— the prompt template and Python execution harnesshero_whiteboardRPC methods accept only numericworkspace_id/board_id, so string names from the AI get coerced to 0 / hallucinatedFix levers (pick one or more)
Prompt engineering (easiest, low risk) — rewrite the agent's system prompt to:
workspace.list→ filter by name → use id)Convenience API on hero_whiteboard (medium) — add name-based helper methods that auto-resolve and auto-create:
workspace.get_or_create(name) -> idboard.create_by_name(workspace_name, board_name) -> idobject.create_on_board(board_name, ...)Then the AI's naïve "do X in Test Board" just works.
Session state in hero_router agent (medium-hard) — keep a per-session cache of
last_workspace_id,last_board_idso follow-up prompts inherit context instead of starting fresh.Navigation/dropdown issue (separate)
Kristof also mentioned in chat: "the navigation is still off e.g. dropdown" and "workspaces have boards". This is a separate UI bug in the whiteboard island (hero_whiteboard_app / hero_whiteboard_ui) — dropdown not respecting the workspace → board hierarchy. Needs a separate investigation, possibly its own issue.
Related
hero_whiteboard/crates/hero_whiteboard_server/src/db/queries.rs(schema enforces FK)hero_whiteboard/crates/hero_whiteboard_server/src/migrations/004_u64_ids.sql(INTEGER ids, strict FKs)Suggested order
Start with lever 1 (prompt engineering) — fast win, single-file change in
hero_router/crates/hero_router/src/server/agent.rs. Measure with the exact two prompts above. If still flaky, add lever 2 for the whiteboard-specific convenience surface.Status — deferred to a dedicated session
Explored lever 1 (prompt engineering in
hero_router/crates/hero_router/src/server/agent.rs) during the session 18 work. Drafted and applied aRESOURCE RESOLUTIONrules block + a whiteboard-specific worked Python example. Reverted before shipping on the following grounds:/:service/agentruns a fresh Python interpreter with zero memory of prior requests).hero_whiteboard_app.Session 18 shipped the infrastructure around this (router
/api/servicesJSON endpoint,IslandContext::forge_url()fix so the whiteboard island can actually reach its backend through the new socket-type router pattern). The underlying whiteboard plumbing is now reachable — the AI agent behaviour and UX polish are the remaining work.Recommended scope for the next session
RouterCache— add an optionalservice_hints: StringtoServiceEntryand inject it intocodegen_systemonly when building the prompt for that service. Whiteboard gets a lookup-or-create hint with a worked example; other services get nothing.RouterCacheso follow-up prompts on the same agent tab get replayed as chat turns tocall_llm. Alternative: frontend-side context injection where the agent tab tracks last-created ids per service and prepends them to follow-up prompts.workspace.get_or_create(name),board.create_by_name(workspace_name, board_name),object.create_on_board_by_name. Reduces the number of chained calls the AI has to get right and helps non-agent SDK users too.hero_whiteboard_appandhero_whiteboard_uicomponents.Tracking this issue as the umbrella; split into smaller issues once the next session starts and the scope per item is clearer.
Signed-off-by: mik-tf
sameh-farouk referenced this issue2026-04-21 15:27:37 +00:00
Moved to hero_demo#6 — see lhumina_code/hero_demo#6