Skip to content

Auto-load prior DSG into Neo4j on chatdsg startup - #17

Closed
harelb wants to merge 1 commit into
masterfrom
chatdsg-auto-load-dsg
Closed

harelb wants to merge 1 commit into
masterfrom
chatdsg-auto-load-dsg

Conversation

@harelb

@harelb harelb commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Fixes MIT-SPARK/Awesome-DCIST-T4#337.

Problem

Two separate things were wrong:

  1. The load path was broken. chatdsg.py called load_dsg_to_db() with the old five-argument signature (object_labelspace, room_labelspace, uri, creds, graph), but heracles.utils.load_dsg_to_db() now takes (neo4j_uri, neo4j_creds, scene_graph) and reads labelspaces out of the graph metadata. Passing --scene-graph raised TypeError.
  2. Nothing ever triggered a load. The launch components in dcist_launch_system invoke ./chatdsg.py with no arguments, and the load was gated on if args.scene_graph:, so the prior scene graph was never loaded into Neo4j.

Changes

  • --scene-graph now defaults to $ADT4_PRIOR_MAP/hydra/backend/dsg.json — the layout the launch system already documents and forwards into the chatdsg pane.
  • Fixed the load_dsg_to_db() call and removed --object-labelspace / --room-labelspace. Labelspaces come from the graph. extract_labelspaces_from_dsg() is used to warn when a graph carries none, instead of silently loading unlabeled objects and rooms.
  • Added --no-dsg-load. This is the one addition beyond the issue: loading calls initialize_db(), which clears the database, so auto-loading means every startup wipes Neo4j. Worth a deliberate look — there is an existing feature/chatdsg_optional_dsg_reset branch suggesting the same need.
  • Credentials fall back to ADT4_NEO4J_* when HERACLES_NEO4J_* is unset, so the example works when run directly rather than under tmuxp.
  • logging.basicConfig() so the startup messages actually print before the Textual app takes the terminal.

No config regeneration is required: dcist_launch_system/scripts/generate_configs.sh produces a zero diff, and both tmux configs that launch chatdsg already forward ADT4_PRIOR_MAP and map HERACLES_NEO4J_* from ADT4_NEO4J_*.

Testing

Run against a live Neo4j with example_dsg.json staged as a prior map.

  • Invoked chatdsg.py with no CLI arguments, exactly as the tmux components do: loaded 65 objects / 96 2D places / 5 rooms.
  • Confirmed by Cypher query that labels came from the graph's embedded labelspace, not the YAML files — objects resolved to seating, storage, sign, decor; rooms to hallway, lounge.
  • --no-dsg-load skips the load; unset $ADT4_PRIOR_MAP warns instead of failing.
  • Guard paths verified: missing DSG file and missing credentials both skip without contacting the database.
  • pre-commit clean (ruff, ruff-format, whitespace).

Note that --scene-graph keeps nargs="?", so a bare --scene-graph with no value still falls through to the $ADT4_PRIOR_MAP default.

chatdsg.py called load_dsg_to_db() with the old five-argument signature
(object labelspace, room labelspace, uri, creds, graph), but heracles now
takes (uri, creds, graph) and reads the labelspaces out of the graph
metadata. Passing --scene-graph therefore raised TypeError, and the tmux
launch components invoke ./chatdsg.py with no arguments at all, so the
prior scene graph was never loaded.

- Default --scene-graph to $ADT4_PRIOR_MAP/hydra/backend/dsg.json, which
  is the layout the launch system already forwards to the chatdsg pane.
- Fix the load_dsg_to_db() call and drop the --object-labelspace and
  --room-labelspace flags; labelspaces now come from the graph itself.
  Warn via extract_labelspaces_from_dsg() when a graph carries none,
  rather than silently loading unlabeled objects and rooms.
- Add --no-dsg-load, since loading calls initialize_db() and so clears
  the database on every startup.
- Fall back to ADT4_NEO4J_* credentials when HERACLES_NEO4J_* is unset,
  for running the example outside tmuxp.
- Configure logging so the startup messages print before the Textual app
  takes over the terminal.

Fixes MIT-SPARK/Awesome-DCIST-T4#337
@harelb harelb closed this Jul 30, 2026
@harelb
harelb deleted the chatdsg-auto-load-dsg branch July 30, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Heracles Agents Automatic Loading of DSG to Neo4j

1 participant