Repository navigation
feat: include simulator flow nodes from other files - #1032
chenghao-mou wants to merge 6 commits into
Conversation
e2fbefc to
fb07d1c
Compare
eb74116 to
7e50e50
Compare
7e50e50 to
ee4fd5b
Compare
A scenarios file had to hold every node its scenarios use, so shared nodes such as a menu or a person were copied into each file. A top-level `include` list now takes the nodes of other files. Paths are relative to the file that names them, includes nest, and each file loads once by its real path. An included file holds only `nodes` and `include`. Includes resolve here, on the client: the server receives one flat `nodes` map, so the protocol and the server do not change. Addresses AGT-3707
c2eee74 to
6dc2ac4
Compare
…to chenghao/feat/AGT-3707-simulator-flow-includes
…to chenghao/feat/AGT-3707-simulator-flow-includes
…to chenghao/feat/AGT-3707-simulator-flow-includes
| real, err := filepath.EvalSymlinks(path) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| r := &nodeResolver{ | ||
| root: filepath.Dir(real), | ||
| loaded: map[string]bool{real: true}, | ||
| chain: []string{real}, | ||
| nodes: map[string]sourcedNode{}, | ||
| } | ||
| if err := r.add(real, nodes); err != nil { | ||
| return nil, err | ||
| } | ||
| if err := r.includeAll(real, include); err != nil { |
There was a problem hiding this comment.
🟡 Relative includes resolve beside symlink targets
When a file is opened through a symlink, resolveNodes looks for its relative includes beside the target. A neighboring include fails to load or resolves to a different file.
Learn more
The resolver needs two identities for each file: its path as included, for resolving its relative includes, and its canonical path, for detecting cycles and shared files. resolveNodes passes the canonical path to includeAll, and includeAll repeats that choice for nested files. If a symlink and its target reside in different directories, relative paths are searched beside the target rather than beside the symlink.
Example: /app/scenarios.yaml links to /shared/scenarios.yaml, which says include: [nodes.yaml]. With /app/nodes.yaml present and /shared/nodes.yaml absent, loading /app/scenarios.yaml fails instead of loading /app/nodes.yaml.
Recommended fix: Carry the path used to open each file through includeAll and load for relative path resolution. Keep EvalSymlinks only for loaded and chain identities; test both a symlinked root and a symlinked nested include.
Was this helpful? React with 👍 or 👎 to provide feedback.
Shared nodes such as a menu or a person no longer need copying into every scenarios file:
Paths are relative to the naming file, includes nest, and each file loads once. An included file holds only
nodesandinclude. Cycles, a node defined in two files, and missing paths fail with the files named. Includes resolve on the client, so the server still receives one flatnodesmap.Not in this PR: the path-based Python loader in agents-private, which AGT-3707 also asks for.
Warning
Stacked on #1031.
Addresses AGT-3707
Initial prompt and agent context
Model: Claude Opus 5.5