langstage-cli 0.6.57__tar.gz → 0.6.59__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. {langstage_cli-0.6.57/langstage_cli.egg-info → langstage_cli-0.6.59}/PKG-INFO +14 -7
  2. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/README.md +13 -6
  3. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/langstage_cli/cli.py +127 -10
  4. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/langstage_cli/sessions.py +48 -2
  5. {langstage_cli-0.6.57 → langstage_cli-0.6.59/langstage_cli.egg-info}/PKG-INFO +14 -7
  6. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/langstage_cli.egg-info/SOURCES.txt +2 -0
  7. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/pyproject.toml +1 -1
  8. langstage_cli-0.6.59/tests/test_session_agent_215.py +194 -0
  9. langstage_cli-0.6.59/tests/test_show_config_bare_spec_213.py +82 -0
  10. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/LICENSE +0 -0
  11. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/deepagent_code/__init__.py +0 -0
  12. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/langstage_cli/__init__.py +0 -0
  13. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/langstage_cli/agui_stream.py +0 -0
  14. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/langstage_cli/config.py +0 -0
  15. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/langstage_cli/exit_codes.py +0 -0
  16. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/langstage_cli.egg-info/dependency_links.txt +0 -0
  17. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/langstage_cli.egg-info/entry_points.txt +0 -0
  18. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/langstage_cli.egg-info/requires.txt +0 -0
  19. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/langstage_cli.egg-info/top_level.txt +0 -0
  20. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/setup.cfg +0 -0
  21. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_advertised_wave4.py +0 -0
  22. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_agui_stream.py +0 -0
  23. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_approval_menu_abort.py +0 -0
  24. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_approval_menu_keys_211.py +0 -0
  25. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_async_mode.py +0 -0
  26. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_checkpointer.py +0 -0
  27. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_cli.py +0 -0
  28. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_cli_help.py +0 -0
  29. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_codeconfig.py +0 -0
  30. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_config.py +0 -0
  31. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_config_command.py +0 -0
  32. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_configurable.py +0 -0
  33. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_ctrl_c_sync_tool.py +0 -0
  34. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_custom_decision_195.py +0 -0
  35. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_decision_shapes_209.py +0 -0
  36. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_deferred_pass.py +0 -0
  37. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_dumb_term.py +0 -0
  38. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_exit_codes.py +0 -0
  39. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_generic_interrupt.py +0 -0
  40. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_help_render.py +0 -0
  41. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_hidden_option_suggestions.py +0 -0
  42. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_history_persist.py +0 -0
  43. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_hitl_approval_preview.py +0 -0
  44. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_hitl_resume_warning.py +0 -0
  45. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_init.py +0 -0
  46. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_interrupt_answer_text_206.py +0 -0
  47. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_interrupt_non_tty.py +0 -0
  48. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_legacy_config_home.py +0 -0
  49. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_load_error.py +0 -0
  50. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_menu_allowed_197.py +0 -0
  51. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_message_boundaries.py +0 -0
  52. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_no_color.py +0 -0
  53. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_no_interactive_approve.py +0 -0
  54. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_no_persist_resume.py +0 -0
  55. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_paused_session_message.py +0 -0
  56. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_persist_env.py +0 -0
  57. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_quiet_output.py +0 -0
  58. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_quiet_tool_result_204.py +0 -0
  59. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_reasoning_render.py +0 -0
  60. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_rename_shim.py +0 -0
  61. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_render_markdown.py +0 -0
  62. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_routine_1024.py +0 -0
  63. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_session_lifecycle.py +0 -0
  64. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_sessions.py +0 -0
  65. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_show_config.py +0 -0
  66. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_show_config_malformed.py +0 -0
  67. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_spec_loading_core.py +0 -0
  68. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_spec_resolution.py +0 -0
  69. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_spinner_reply_survives.py +0 -0
  70. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_stdin_interactive.py +0 -0
  71. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_stdin_single_shot.py +0 -0
  72. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_stream_mode.py +0 -0
  73. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_streaming_marker.py +0 -0
  74. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_terminal_width.py +0 -0
  75. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_toml_relative_paths.py +0 -0
  76. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_tool_card_args.py +0 -0
  77. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_tool_output_escape.py +0 -0
  78. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_turn_error_verbose.py +0 -0
  79. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_turn_exit_and_render.py +0 -0
  80. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_unicode_console.py +0 -0
  81. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_usage_hint_186.py +0 -0
  82. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_verbose_command.py +0 -0
  83. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_verify_flag.py +0 -0
  84. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_workspace.py +0 -0
  85. {langstage_cli-0.6.57 → langstage_cli-0.6.59}/tests/test_wrong_type_graph.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langstage-cli
3
- Version: 0.6.57
3
+ Version: 0.6.59
4
4
  Summary: The terminal stage for your LangGraph agent — Claude Code-style CLI for any CompiledGraph
5
5
  Author-email: Kedar Dabhadkar <kdabhadk@gmail.com>
6
6
  License-Expression: MIT
@@ -142,8 +142,8 @@ langstage-cli --show-config
142
142
 
143
143
  # Resume a previous conversation across separate invocations
144
144
  langstage-cli "remember: my name is Kedar" # a fresh, PERSISTED session
145
- langstage-cli -c "what's my name?" # continue the most recent session
146
- langstage-cli --list-sessions # list resumable sessions
145
+ langstage-cli -c "what's my name?" # continue this agent's most recent session
146
+ langstage-cli --list-sessions # list resumable sessions, with their agents
147
147
  langstage-cli --resume <id> # resume a specific one
148
148
  ```
149
149
 
@@ -166,11 +166,17 @@ Every invocation persists its conversation to a durable, per-workspace store so
166
166
  run can pick it up — the terminal-agent continuity of Claude Code / Codex / Aider,
167
167
  without you baking a checkpointer into your own graph:
168
168
 
169
- - `--continue` / `-c` — resume the **most recent** session for this workspace and keep
170
- going. If there's no prior session, it just starts a fresh one.
169
+ - `--continue` / `-c` — resume the **most recent** session this agent made in this
170
+ workspace and keep going. If there's no prior session, it just starts a fresh one.
171
+ Another agent's sessions are skipped, so trying `--demo` and then your own graph in the
172
+ same directory doesn't hand your graph the demo's conversation.
171
173
  - `--resume <id>` — resume a **specific** session (ids come from `--list-sessions`; a
172
174
  bare `--resume` also lists them). A short prefix works if it's unambiguous; an
173
- ambiguous one is an error that lists the sessions it matches.
175
+ ambiguous one is an error that lists the sessions it matches. Resuming another agent's
176
+ session works but says so; one paused at another agent's approval is refused (exit `1`),
177
+ since this agent can't answer it.
178
+ - `--list-sessions` shows which agent made each session (`-` for sessions saved before
179
+ 0.6.59, which `-c` still picks up).
174
180
  - A plain run with no flag starts a **new** session that is still persisted, so it can be
175
181
  continued later.
176
182
  - A session left paused at an approval (exit `2`) is resolved before a new message: the
@@ -286,7 +292,8 @@ Options:
286
292
  --show-config Print the resolved configuration and exit
287
293
  -q, --quiet Scriptable single-shot output: only the reply
288
294
  --verify Preflight the agent (one real turn); exit 0/1
289
- -c, --continue Resume the most recent session for this workspace
295
+ -c, --continue Resume this agent's most recent session for this
296
+ workspace
290
297
  --resume [ID] Resume a specific session (bare: list them)
291
298
  --list-sessions List resumable sessions for this workspace
292
299
  --persist/--no-persist Persist this session so it can be continued (default: on)
@@ -104,8 +104,8 @@ langstage-cli --show-config
104
104
 
105
105
  # Resume a previous conversation across separate invocations
106
106
  langstage-cli "remember: my name is Kedar" # a fresh, PERSISTED session
107
- langstage-cli -c "what's my name?" # continue the most recent session
108
- langstage-cli --list-sessions # list resumable sessions
107
+ langstage-cli -c "what's my name?" # continue this agent's most recent session
108
+ langstage-cli --list-sessions # list resumable sessions, with their agents
109
109
  langstage-cli --resume <id> # resume a specific one
110
110
  ```
111
111
 
@@ -128,11 +128,17 @@ Every invocation persists its conversation to a durable, per-workspace store so
128
128
  run can pick it up — the terminal-agent continuity of Claude Code / Codex / Aider,
129
129
  without you baking a checkpointer into your own graph:
130
130
 
131
- - `--continue` / `-c` — resume the **most recent** session for this workspace and keep
132
- going. If there's no prior session, it just starts a fresh one.
131
+ - `--continue` / `-c` — resume the **most recent** session this agent made in this
132
+ workspace and keep going. If there's no prior session, it just starts a fresh one.
133
+ Another agent's sessions are skipped, so trying `--demo` and then your own graph in the
134
+ same directory doesn't hand your graph the demo's conversation.
133
135
  - `--resume <id>` — resume a **specific** session (ids come from `--list-sessions`; a
134
136
  bare `--resume` also lists them). A short prefix works if it's unambiguous; an
135
- ambiguous one is an error that lists the sessions it matches.
137
+ ambiguous one is an error that lists the sessions it matches. Resuming another agent's
138
+ session works but says so; one paused at another agent's approval is refused (exit `1`),
139
+ since this agent can't answer it.
140
+ - `--list-sessions` shows which agent made each session (`-` for sessions saved before
141
+ 0.6.59, which `-c` still picks up).
136
142
  - A plain run with no flag starts a **new** session that is still persisted, so it can be
137
143
  continued later.
138
144
  - A session left paused at an approval (exit `2`) is resolved before a new message: the
@@ -248,7 +254,8 @@ Options:
248
254
  --show-config Print the resolved configuration and exit
249
255
  -q, --quiet Scriptable single-shot output: only the reply
250
256
  --verify Preflight the agent (one real turn); exit 0/1
251
- -c, --continue Resume the most recent session for this workspace
257
+ -c, --continue Resume this agent's most recent session for this
258
+ workspace
252
259
  --resume [ID] Resume a specific session (bare: list them)
253
260
  --list-sessions List resumable sessions for this workspace
254
261
  --persist/--no-persist Persist this session so it can be continued (default: on)
@@ -1105,9 +1105,39 @@ def _reconcile_graph_name(report: str, cfg: Any) -> str:
1105
1105
  return re.sub(r"(?m)^ graph_name\s+=.*$", lambda _m: line, report, count=1)
1106
1106
 
1107
1107
 
1108
+ def _with_shown_bare_spec(cfg: Any) -> Any:
1109
+ """``cfg`` with a bare ``file.py`` spec shown the way the run resolves it (gh #213).
1110
+
1111
+ Core rebases a ``file.py:attr`` spec from a toml onto the toml's directory and
1112
+ expands ``~``, but its spec parser needs the ``:attr``, so the CLI's colon-less
1113
+ ``file.py`` form came through untouched. The run makes up for it (the toml dir is
1114
+ the load's base), but ``--show-config`` and ``/config`` printed the raw value: a
1115
+ path that doesn't exist from a subdirectory. This applies core's rule to the bare
1116
+ form, on a copy, so the diagnostic names the file that actually loads.
1117
+ """
1118
+ spec = getattr(cfg, "agent_spec", None)
1119
+ split = _split_py_file_spec(spec.strip()) if isinstance(spec, str) else None
1120
+ if split is None or split[1]:
1121
+ return cfg # not a bare .py path: core already shows it resolved
1122
+ raw = split[0]
1123
+ file_path = Path(raw).expanduser()
1124
+ toml_dir = cfg.toml_dir_for("agent_spec") if hasattr(cfg, "toml_dir_for") else None
1125
+ if toml_dir is not None and not file_path.anchor:
1126
+ file_path = Path(toml_dir) / file_path
1127
+ elif file_path == Path(raw):
1128
+ return cfg # nothing to resolve: keep the user's exact spelling
1129
+ shown = copy.copy(cfg)
1130
+ if hasattr(cfg, "_sources"):
1131
+ shown._sources = dict(cfg._sources)
1132
+ shown.agent_spec = str(file_path)
1133
+ return shown
1134
+
1135
+
1108
1136
  def _describe(cfg: Any, **kwargs: Any) -> str:
1109
- """``cfg.describe(**kwargs)`` showing the graph that actually runs (gh #129)."""
1110
- return _reconcile_graph_name(cfg.describe(**kwargs), cfg)
1137
+ """``cfg.describe(**kwargs)`` showing the graph that actually runs (gh #129)
1138
+ and the agent file it loads (gh #213)."""
1139
+ shown = _with_shown_bare_spec(cfg)
1140
+ return _reconcile_graph_name(shown.describe(**kwargs), shown)
1111
1141
 
1112
1142
 
1113
1143
  def _split_py_file_spec(spec: str) -> Optional[Tuple[str, str]]:
@@ -1153,6 +1183,41 @@ def _absolutize_file_spec(spec: str) -> str:
1153
1183
  return f"{Path(path_part).expanduser().resolve()}{suffix}"
1154
1184
 
1155
1185
 
1186
+ def _session_agent_id(spec: str, base_dir: Path, graph_name: str) -> str:
1187
+ """The agent a session is recorded under in the session index (gh #215).
1188
+
1189
+ A file spec becomes its absolute path (resolved against ``base_dir``, the same base
1190
+ the spec was loaded from), so one agent reads alike from any subdirectory; a module
1191
+ spec stays as typed. The graph attribute is always named, so ``agent.py`` and
1192
+ ``agent.py:graph`` are the same agent.
1193
+ """
1194
+ parsed = _split_py_file_spec(spec)
1195
+ if parsed is not None:
1196
+ path = Path(parsed[0]).expanduser()
1197
+ if not path.is_absolute():
1198
+ path = Path(base_dir) / path
1199
+ return f"{path.resolve()}:{graph_name}"
1200
+ module = spec.rsplit(":", 1)[0] if ":" in spec else spec
1201
+ return f"{module}:{graph_name}"
1202
+
1203
+
1204
+ def _shown_agent(agent: Optional[str], workspace: Path) -> str:
1205
+ """A recorded agent as the session list and notes print it: a file inside the
1206
+ workspace relative to it, one under the home directory with ``~``."""
1207
+ if not agent:
1208
+ return "-"
1209
+ parsed = _split_py_file_spec(agent)
1210
+ if parsed is None:
1211
+ return agent
1212
+ path, suffix = Path(parsed[0]), parsed[1]
1213
+ for root, prefix in ((Path(workspace), ""), (Path.home(), "~/")):
1214
+ try:
1215
+ return f"{prefix}{path.relative_to(root).as_posix()}{suffix}"
1216
+ except ValueError:
1217
+ continue
1218
+ return agent
1219
+
1220
+
1156
1221
  # Per-value cap on the tool-call card (default output; ``-v`` shows values in full).
1157
1222
  _TOOL_ARG_VALUE_MAX = 50
1158
1223
 
@@ -3424,18 +3489,35 @@ def scaffold_init(target_dir: Path, force: bool = False) -> int:
3424
3489
 
3425
3490
 
3426
3491
  def _resolve_resume_thread(
3427
- workspace: Path, continue_session: bool, resume_id: Optional[str]
3492
+ workspace: Path,
3493
+ continue_session: bool,
3494
+ resume_id: Optional[str],
3495
+ agent: Optional[str] = None,
3428
3496
  ) -> Optional[str]:
3429
3497
  """The thread ``--continue`` / ``--resume <id>`` targets, or ``None`` for a fresh one.
3430
3498
 
3431
3499
  ``--continue`` with nothing to continue notes it and starts fresh; an unknown
3432
3500
  ``--resume`` id is an error (exit 1).
3501
+
3502
+ With ``agent`` (the loaded agent, gh #215), ``--continue`` takes the most recent
3503
+ session recorded for THIS agent (or one recorded before agents were), never another
3504
+ agent's. ``--resume`` of another agent's session says so; if that session is paused
3505
+ at an approval, it is an error (exit 1): this agent can't answer it, and a new
3506
+ message must not be stacked onto the paused turn.
3433
3507
  """
3434
3508
  thread: Optional[str] = None
3435
3509
  if continue_session:
3436
- thread = sessions.most_recent_thread(workspace)
3510
+ thread = sessions.most_recent_thread(workspace, agent=agent)
3437
3511
  if thread is None:
3438
- _status(f"{DIM}⏺ No prior session for this workspace — starting a fresh one.{RESET}")
3512
+ if agent is not None and sessions.most_recent_thread(workspace) is not None:
3513
+ _status(
3514
+ f"{DIM}⏺ No prior session for this agent in this workspace (only other "
3515
+ f"agents' sessions, see --list-sessions) — starting a fresh one.{RESET}"
3516
+ )
3517
+ else:
3518
+ _status(
3519
+ f"{DIM}⏺ No prior session for this workspace — starting a fresh one.{RESET}"
3520
+ )
3439
3521
  return None
3440
3522
  elif resume_id is not None:
3441
3523
  matches = sessions.match_threads(workspace, resume_id)
@@ -3455,6 +3537,24 @@ def _resolve_resume_thread(
3455
3537
  _status(f"{DIM}Run --list-sessions to see available sessions.{RESET}")
3456
3538
  sys.exit(1)
3457
3539
  thread = matches[0]
3540
+ recorded = sessions.load_index(workspace).get(thread, {}).get("agent")
3541
+ if agent is not None and recorded and recorded != agent:
3542
+ shown = sessions.display_id(thread)
3543
+ made_by, current = _shown_agent(recorded, workspace), _shown_agent(agent, workspace)
3544
+ if sessions.thread_is_paused(workspace, thread):
3545
+ _status(
3546
+ f"{RED}⏺ Error: session {shown} is paused at an approval from {made_by}, "
3547
+ f"which {current} can't answer.{RESET}"
3548
+ )
3549
+ _status(
3550
+ f"{DIM}Resume it with its own agent (-a {made_by} --resume {shown}), "
3551
+ f"or start a new session.{RESET}"
3552
+ )
3553
+ sys.exit(1)
3554
+ _status(
3555
+ f"{YELLOW}note: session {shown} was created by {made_by}; "
3556
+ f"resuming it with {current}.{RESET}"
3557
+ )
3458
3558
  if (
3459
3559
  thread is not None
3460
3560
  and sessions.load_index(workspace).get(thread, {}).get("checkpointer") == "agent"
@@ -3649,6 +3749,9 @@ def _print_sessions(workspace: Path) -> None:
3649
3749
  all_ids = [tid for tid, _ in rows]
3650
3750
  shown = {tid: sessions.display_id(tid, all_ids) for tid in all_ids}
3651
3751
  width = max(len(s) for s in shown.values())
3752
+ # The agent each session was made by (gh #215); "-" for one recorded before that.
3753
+ agents = {tid: _shown_agent(entry.get("agent"), workspace) for tid, entry in rows}
3754
+ agent_width = max(len(a) for a in agents.values())
3652
3755
  for tid, entry in rows:
3653
3756
  when = _format_ts(entry.get("updated"))
3654
3757
  first = entry.get("first_message") or f"{DIM}(no message yet){RESET}"
@@ -3661,8 +3764,14 @@ def _print_sessions(workspace: Path) -> None:
3661
3764
  )
3662
3765
  # A pinned id is shown in full and a minted UUID by its shortest unique prefix, so
3663
3766
  # two sessions never look alike and each shown id works with --resume (gh #188).
3664
- print(f" {CYAN}{shown[tid]:<{width}}{RESET} {DIM}{when}{RESET} {first}{mark}")
3665
- print(f"\n{DIM}Resume with: langstage-cli --resume <id> (or -c for the most recent){RESET}\n")
3767
+ print(
3768
+ f" {CYAN}{shown[tid]:<{width}}{RESET} {DIM}{when}{RESET} "
3769
+ f"{GRAY}{agents[tid]:<{agent_width}}{RESET} {first}{mark}"
3770
+ )
3771
+ print(
3772
+ f"\n{DIM}Resume with: langstage-cli --resume <id> "
3773
+ f"(or -c for this agent's most recent){RESET}\n"
3774
+ )
3666
3775
 
3667
3776
 
3668
3777
  @click.command(
@@ -3770,7 +3879,7 @@ def _print_sessions(workspace: Path) -> None:
3770
3879
  "continue_session",
3771
3880
  is_flag=True,
3772
3881
  default=False,
3773
- help="Resume the MOST RECENT session for this workspace and keep the "
3882
+ help="Resume this agent's MOST RECENT session for this workspace and keep the "
3774
3883
  "conversation going (cross-invocation memory). Starts fresh if there is none.",
3775
3884
  )
3776
3885
  @click.option(
@@ -4225,11 +4334,16 @@ def main(
4225
4334
  )
4226
4335
 
4227
4336
  # ---- Resolve the session thread + wire up persistence (gh #102) ----
4337
+ # Each session records the agent that made it, so --continue stays with this
4338
+ # agent's sessions and --resume of another agent's says so (gh #215).
4339
+ session_agent = _session_agent_id(final_spec, spec_base, final_graph_name)
4228
4340
  persist_sqlite_path: Optional[Path] = None
4229
4341
  session_thread: Optional[str] = None
4230
4342
  on_turn = None
4231
4343
  if read_only_resume:
4232
- session_thread = _resolve_resume_thread(workspace, continue_session, resume_id)
4344
+ session_thread = _resolve_resume_thread(
4345
+ workspace, continue_session, resume_id, agent=session_agent
4346
+ )
4233
4347
  persist_sqlite_path = None
4234
4348
  if session_thread is not None:
4235
4349
  config_dict["configurable"]["thread_id"] = session_thread
@@ -4252,7 +4366,9 @@ def main(
4252
4366
  "thread": session_thread,
4253
4367
  }
4254
4368
  elif persist:
4255
- session_thread = _resolve_resume_thread(workspace, continue_session, resume_id)
4369
+ session_thread = _resolve_resume_thread(
4370
+ workspace, continue_session, resume_id, agent=session_agent
4371
+ )
4256
4372
  if session_thread is None:
4257
4373
  # Fresh persisted session: honour a pinned [configurable] thread_id if the
4258
4374
  # user set one (now it actually persists across runs — closing the "I
@@ -4273,6 +4389,7 @@ def main(
4273
4389
  thread_id,
4274
4390
  first_message=msg,
4275
4391
  agent_checkpointer=had_user_checkpointer,
4392
+ agent=session_agent,
4276
4393
  )
4277
4394
 
4278
4395
  config_dict["_session_info"] = {
@@ -154,6 +154,7 @@ def touch_session(
154
154
  first_message: Optional[str] = None,
155
155
  *,
156
156
  agent_checkpointer: bool = False,
157
+ agent: Optional[str] = None,
157
158
  ) -> None:
158
159
  """Bump a thread's ``updated`` timestamp (creating the entry if missing).
159
160
 
@@ -163,6 +164,10 @@ def touch_session(
163
164
  ``agent_checkpointer`` marks a session whose state lives in the agent's OWN
164
165
  checkpointer, not the CLI's store (``"checkpointer": "agent"``), so the session list
165
166
  and a resume can say the CLI holds no history for it (gh #128).
167
+
168
+ ``agent`` is the resolved agent spec the turn ran (gh #215). It is recorded when the
169
+ entry is created, or filled into an older entry that has none; an entry that already
170
+ names an agent keeps it, so the session stays attributed to the agent that made it.
166
171
  """
167
172
  sessions = load_index(workspace)
168
173
  entry = sessions.get(thread_id)
@@ -171,22 +176,63 @@ def touch_session(
171
176
  entry = {"created": now, "updated": now, "first_message": _snippet(first_message)}
172
177
  if agent_checkpointer:
173
178
  entry["checkpointer"] = "agent"
179
+ if agent:
180
+ entry["agent"] = agent
174
181
  sessions[thread_id] = entry
175
182
  else:
176
183
  entry["updated"] = now
177
184
  if not entry.get("first_message") and first_message:
178
185
  entry["first_message"] = _snippet(first_message)
186
+ if agent and not entry.get("agent"):
187
+ entry["agent"] = agent
179
188
  _save_index(workspace, sessions)
180
189
 
181
190
 
182
- def most_recent_thread(workspace: Path) -> Optional[str]:
183
- """The most-recently-updated thread id for this workspace, or ``None`` if none."""
191
+ def most_recent_thread(workspace: Path, agent: Optional[str] = None) -> Optional[str]:
192
+ """The most-recently-updated thread id for this workspace, or ``None`` if none.
193
+
194
+ With ``agent``, only sessions recorded for that agent count, plus older entries that
195
+ record no agent (written before gh #215), so ``--continue`` never picks up a session
196
+ another agent made.
197
+ """
184
198
  sessions = load_index(workspace)
199
+ if agent is not None:
200
+ sessions = {t: e for t, e in sessions.items() if e.get("agent") in (None, "", agent)}
185
201
  if not sessions:
186
202
  return None
187
203
  return max(sessions.items(), key=lambda kv: kv[1].get("updated", 0))[0]
188
204
 
189
205
 
206
+ def thread_is_paused(workspace: Path, thread_id: str) -> bool:
207
+ """Whether the thread's latest checkpoint in the CLI's store ends on an ``interrupt()``.
208
+
209
+ Read from the store itself, not through a graph, so it works whichever agent is
210
+ loaded (gh #215): a graph without the interrupting node sees no pending task and
211
+ would otherwise let a new message stack onto the paused turn. Anything unreadable
212
+ (no store, no such thread, an agent-owned checkpointer) counts as not paused.
213
+ """
214
+ path = sessions_dir() / f"{workspace_key(workspace)}.sqlite"
215
+ if not path.is_file():
216
+ return False
217
+ try:
218
+ import sqlite3
219
+
220
+ from langgraph.checkpoint.sqlite import SqliteSaver
221
+
222
+ conn = sqlite3.connect(f"file:{path}?mode=ro", uri=True)
223
+ try:
224
+ saver = SqliteSaver(conn)
225
+ saver.is_setup = True # read-only: the tables exist, never create them
226
+ tup = saver.get_tuple({"configurable": {"thread_id": thread_id}})
227
+ finally:
228
+ conn.close()
229
+ except Exception: # noqa: BLE001 - a store we can't read is "not paused"
230
+ return False
231
+ if tup is None:
232
+ return False
233
+ return any(w[1] == "__interrupt__" for w in (tup.pending_writes or ()))
234
+
235
+
190
236
  def resolve_thread(workspace: Path, ref: str) -> Optional[str]:
191
237
  """Resolve a ``--resume`` reference to a full thread id.
192
238
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langstage-cli
3
- Version: 0.6.57
3
+ Version: 0.6.59
4
4
  Summary: The terminal stage for your LangGraph agent — Claude Code-style CLI for any CompiledGraph
5
5
  Author-email: Kedar Dabhadkar <kdabhadk@gmail.com>
6
6
  License-Expression: MIT
@@ -142,8 +142,8 @@ langstage-cli --show-config
142
142
 
143
143
  # Resume a previous conversation across separate invocations
144
144
  langstage-cli "remember: my name is Kedar" # a fresh, PERSISTED session
145
- langstage-cli -c "what's my name?" # continue the most recent session
146
- langstage-cli --list-sessions # list resumable sessions
145
+ langstage-cli -c "what's my name?" # continue this agent's most recent session
146
+ langstage-cli --list-sessions # list resumable sessions, with their agents
147
147
  langstage-cli --resume <id> # resume a specific one
148
148
  ```
149
149
 
@@ -166,11 +166,17 @@ Every invocation persists its conversation to a durable, per-workspace store so
166
166
  run can pick it up — the terminal-agent continuity of Claude Code / Codex / Aider,
167
167
  without you baking a checkpointer into your own graph:
168
168
 
169
- - `--continue` / `-c` — resume the **most recent** session for this workspace and keep
170
- going. If there's no prior session, it just starts a fresh one.
169
+ - `--continue` / `-c` — resume the **most recent** session this agent made in this
170
+ workspace and keep going. If there's no prior session, it just starts a fresh one.
171
+ Another agent's sessions are skipped, so trying `--demo` and then your own graph in the
172
+ same directory doesn't hand your graph the demo's conversation.
171
173
  - `--resume <id>` — resume a **specific** session (ids come from `--list-sessions`; a
172
174
  bare `--resume` also lists them). A short prefix works if it's unambiguous; an
173
- ambiguous one is an error that lists the sessions it matches.
175
+ ambiguous one is an error that lists the sessions it matches. Resuming another agent's
176
+ session works but says so; one paused at another agent's approval is refused (exit `1`),
177
+ since this agent can't answer it.
178
+ - `--list-sessions` shows which agent made each session (`-` for sessions saved before
179
+ 0.6.59, which `-c` still picks up).
174
180
  - A plain run with no flag starts a **new** session that is still persisted, so it can be
175
181
  continued later.
176
182
  - A session left paused at an approval (exit `2`) is resolved before a new message: the
@@ -286,7 +292,8 @@ Options:
286
292
  --show-config Print the resolved configuration and exit
287
293
  -q, --quiet Scriptable single-shot output: only the reply
288
294
  --verify Preflight the agent (one real turn); exit 0/1
289
- -c, --continue Resume the most recent session for this workspace
295
+ -c, --continue Resume this agent's most recent session for this
296
+ workspace
290
297
  --resume [ID] Resume a specific session (bare: list them)
291
298
  --list-sessions List resumable sessions for this workspace
292
299
  --persist/--no-persist Persist this session so it can be continued (default: on)
@@ -56,9 +56,11 @@ tests/test_reasoning_render.py
56
56
  tests/test_rename_shim.py
57
57
  tests/test_render_markdown.py
58
58
  tests/test_routine_1024.py
59
+ tests/test_session_agent_215.py
59
60
  tests/test_session_lifecycle.py
60
61
  tests/test_sessions.py
61
62
  tests/test_show_config.py
63
+ tests/test_show_config_bare_spec_213.py
62
64
  tests/test_show_config_malformed.py
63
65
  tests/test_spec_loading_core.py
64
66
  tests/test_spec_resolution.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "langstage-cli"
7
- version = "0.6.57"
7
+ version = "0.6.59"
8
8
  description = "The terminal stage for your LangGraph agent — Claude Code-style CLI for any CompiledGraph"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -0,0 +1,194 @@
1
+ """Sessions remember which agent made them (gh #215).
2
+
3
+ The session index stored no agent, so ``-a b.py -c`` fed agent A's transcript (tool
4
+ calls and all) to agent B without a word, ``--list-sessions`` couldn't tell sessions
5
+ apart, and continuing a session paused at A's approval with B dropped the approval and
6
+ stacked a second human message, exit 0. Now each index entry records its agent:
7
+ ``--continue`` takes this agent's most recent session, ``--resume`` of another agent's
8
+ session says so, and one paused at another agent's approval is refused (exit 1).
9
+ """
10
+
11
+ import json
12
+ import textwrap
13
+
14
+ import pytest
15
+ from click.testing import CliRunner
16
+
17
+ pytest.importorskip("ag_ui_langgraph")
18
+ pytest.importorskip("langgraph.checkpoint.sqlite.aio")
19
+
20
+ from langstage_cli import cli, sessions # noqa: E402
21
+ from langstage_cli.cli import main # noqa: E402
22
+
23
+ # Reports the message types it was handed: another agent's tool transcript shows up as
24
+ # 'tool' entries, a dropped approval as two 'human' entries in a row.
25
+ _OTHER = textwrap.dedent(
26
+ """
27
+ from langgraph.graph import StateGraph, START, END
28
+ from langgraph.graph.message import MessagesState
29
+ from langchain_core.messages import AIMessage
30
+
31
+ def respond(state):
32
+ return {"messages": [AIMessage(content=f"I see {[m.type for m in state['messages']]}")]}
33
+
34
+ g = StateGraph(MessagesState)
35
+ g.add_node("respond", respond)
36
+ g.add_edge(START, "respond")
37
+ g.add_edge("respond", END)
38
+ graph = g.compile()
39
+ """
40
+ )
41
+
42
+ # Agent A: calls a tool (so its transcript has a 'tool' message) and pauses on "ask me".
43
+ # A file agent, not the packaged demo: a module-level graph is shared across this test
44
+ # process, and an earlier test's checkpointer on it would read as the agent's own.
45
+ _FIRST = textwrap.dedent(
46
+ """
47
+ from langgraph.graph import StateGraph, START, END
48
+ from langgraph.graph.message import MessagesState
49
+ from langgraph.types import interrupt
50
+ from langchain_core.messages import AIMessage, ToolMessage
51
+
52
+ def respond(state):
53
+ last = state["messages"][-1].content
54
+ if "ask me" in last:
55
+ ok = interrupt("Proceed?")
56
+ return {"messages": [AIMessage(content=f"answered: {ok!r}")]}
57
+ return {"messages": [
58
+ AIMessage(content="", tool_calls=[{"name": "kb", "args": {}, "id": "t1"}]),
59
+ ToolMessage(content="42", tool_call_id="t1"),
60
+ AIMessage(content="the answer is 42"),
61
+ ]}
62
+
63
+ g = StateGraph(MessagesState)
64
+ g.add_node("respond", respond)
65
+ g.add_edge(START, "respond")
66
+ g.add_edge("respond", END)
67
+ graph = g.compile()
68
+ """
69
+ )
70
+
71
+ _DEMO = "first_agent.py:graph"
72
+
73
+
74
+ @pytest.fixture
75
+ def ws(tmp_path, monkeypatch):
76
+ d = tmp_path / "ws"
77
+ d.mkdir()
78
+ (d / "other_agent.py").write_text(_OTHER, encoding="utf-8")
79
+ (d / "first_agent.py").write_text(_FIRST, encoding="utf-8")
80
+ monkeypatch.setenv("LANGSTAGE_CONFIG_HOME", str(tmp_path / "empty_home"))
81
+ monkeypatch.chdir(d)
82
+ return d
83
+
84
+
85
+ def _run(*args):
86
+ return CliRunner().invoke(main, list(args))
87
+
88
+
89
+ def _index(ws):
90
+ return sessions.load_index(ws.resolve())
91
+
92
+
93
+ def _newest(ws):
94
+ idx = _index(ws)
95
+ return max(idx, key=lambda t: idx[t]["updated"])
96
+
97
+
98
+ def test_index_records_the_agent_and_the_list_shows_it(ws):
99
+ assert _run("-a", _DEMO, "use a tool").exit_code == 0
100
+ assert _run("-a", "other_agent.py:graph", "hello").exit_code == 0
101
+ agents = sorted(e.get("agent") for e in _index(ws).values())
102
+ assert agents == [f"{(ws / n).resolve()}:graph" for n in ("first_agent.py", "other_agent.py")]
103
+
104
+ out = _run("--list-sessions").output
105
+ assert "other_agent.py:graph" in out # shown relative to the workspace
106
+ assert _DEMO in out
107
+ assert str(ws) + "/other_agent.py" not in out.replace("\\", "/")
108
+
109
+
110
+ def test_bare_file_spec_and_its_graph_suffix_are_one_agent(ws):
111
+ assert _run("-a", "other_agent.py:graph", "one").exit_code == 0
112
+ r = _run("-a", "other_agent.py", "-c", "two")
113
+ assert r.exit_code == 0, r.output
114
+ assert "I see ['human', 'ai', 'human']" in r.output
115
+
116
+
117
+ def test_continue_skips_another_agents_session(ws):
118
+ assert _run("-a", _DEMO, "use a tool").exit_code == 0
119
+ r = _run("-a", "other_agent.py:graph", "-c", "hello")
120
+ assert r.exit_code == 0, r.output
121
+ assert "I see ['human']" in r.output # a fresh session, not the demo's transcript
122
+ assert "No prior session for this agent" in r.output
123
+
124
+
125
+ def test_continue_picks_this_agents_session_past_a_newer_other_one(ws):
126
+ assert _run("-a", "other_agent.py:graph", "mine").exit_code == 0
127
+ assert _run("-a", _DEMO, "use a tool").exit_code == 0
128
+ r = _run("-a", "other_agent.py:graph", "-c", "again")
129
+ assert r.exit_code == 0, r.output
130
+ assert "I see ['human', 'ai', 'human']" in r.output
131
+
132
+
133
+ def test_continue_still_takes_a_session_recorded_before_agents_were(ws):
134
+ assert _run("-a", "other_agent.py:graph", "old").exit_code == 0
135
+ idx = _index(ws)
136
+ for entry in idx.values():
137
+ entry.pop("agent")
138
+ sessions._save_index(ws.resolve(), idx)
139
+ r = _run("-a", "other_agent.py:graph", "-c", "new")
140
+ assert r.exit_code == 0, r.output
141
+ assert "I see ['human', 'ai', 'human']" in r.output
142
+ # The resume fills the agent into the old entry.
143
+ assert all(e.get("agent") for e in _index(ws).values())
144
+
145
+
146
+ def test_resume_of_another_agents_session_says_so(ws):
147
+ assert _run("-a", _DEMO, "use a tool").exit_code == 0
148
+ tid = _newest(ws)
149
+ r = _run("-a", "other_agent.py:graph", "--resume", tid, "hello")
150
+ assert r.exit_code == 0, r.output
151
+ assert f"was created by {_DEMO}; resuming it with other_agent.py:graph" in r.output
152
+ assert "'tool'" in r.output # the user asked for that session, so it is used
153
+ # It stays attributed to the agent that made it.
154
+ assert _index(ws)[tid]["agent"] == f"{(ws / 'first_agent.py').resolve()}:graph"
155
+
156
+
157
+ def test_resume_of_another_agents_paused_session_is_refused(ws):
158
+ r = _run("-a", _DEMO, "ask me")
159
+ assert r.exit_code == 2, r.output
160
+ tid = _newest(ws)
161
+ assert sessions.thread_is_paused(ws.resolve(), tid)
162
+
163
+ r = _run("-a", "other_agent.py:graph", "--resume", tid, "hello again")
164
+ assert r.exit_code == 1, r.output
165
+ assert "is paused at an approval from" in r.output
166
+ assert f"-a {_DEMO} --resume" in r.output
167
+ assert "I see" not in r.output # nothing reached the other agent
168
+
169
+ # Its own agent still finds the approval and resolves it.
170
+ r = _run("-a", _DEMO, "--resume", tid, "--no-interactive", "and now")
171
+ assert r.exit_code == 0, r.output
172
+ assert "paused at an approval from its previous turn" in r.output
173
+
174
+
175
+ def test_a_finished_session_is_not_paused(ws):
176
+ assert _run("-a", "other_agent.py:graph", "hello").exit_code == 0
177
+ assert not sessions.thread_is_paused(ws.resolve(), _newest(ws))
178
+ assert not sessions.thread_is_paused(ws.resolve(), "no-such-thread")
179
+
180
+
181
+ def test_session_agent_id_forms(tmp_path):
182
+ f = tmp_path / "a.py"
183
+ assert cli._session_agent_id("a.py", tmp_path, "graph") == f"{f.resolve()}:graph"
184
+ assert cli._session_agent_id(f"{f}:agent", tmp_path, "agent") == f"{f.resolve()}:agent"
185
+ assert cli._session_agent_id("pkg.mod", tmp_path, "graph") == "pkg.mod:graph"
186
+ assert cli._session_agent_id("pkg.mod:g", tmp_path, "g") == "pkg.mod:g"
187
+ assert cli._shown_agent(None, tmp_path) == "-"
188
+ assert cli._shown_agent(f"{f.resolve()}:graph", tmp_path.resolve()) == "a.py:graph"
189
+
190
+
191
+ def test_index_stays_valid_json(ws):
192
+ assert _run("-a", "other_agent.py:graph", "hello").exit_code == 0
193
+ path = sessions._index_path(ws.resolve())
194
+ assert json.loads(path.read_text(encoding="utf-8"))["sessions"]
@@ -0,0 +1,82 @@
1
+ """`--show-config` / `/config` show a bare toml `spec = "file.py"` resolved (gh #213).
2
+
3
+ The run loads a colon-less spec from a project `langstage.toml` relative to that
4
+ toml's directory (gh #116), but the diagnostics printed it raw, so from a
5
+ subdirectory they named a file that isn't there. The `file.py:graph` form was
6
+ already shown resolved, because core rebases it.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import re
12
+ from pathlib import Path
13
+
14
+ import pytest
15
+ from click.testing import CliRunner
16
+
17
+ from langstage_cli import cli
18
+ from langstage_cli.cli import main
19
+
20
+
21
+ def _spec_line(output: str) -> str:
22
+ return next(line for line in output.splitlines() if re.match(r"\s*agent_spec\s*=", line))
23
+
24
+
25
+ @pytest.fixture
26
+ def project(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
27
+ for var in ("LANGSTAGE_AGENT_SPEC", "DEEPAGENT_AGENT_SPEC"):
28
+ monkeypatch.delenv(var, raising=False)
29
+ proj = tmp_path / "proj"
30
+ (proj / "sub").mkdir(parents=True)
31
+ (proj / "my_agent.py").write_text("graph = None\n", encoding="utf-8")
32
+ monkeypatch.chdir(proj / "sub")
33
+ return proj
34
+
35
+
36
+ def _write_toml(proj: Path, spec: str) -> None:
37
+ (proj / "langstage.toml").write_text(f'[agent]\nspec = "{spec}"\n', encoding="utf-8")
38
+
39
+
40
+ @pytest.mark.parametrize("spec", ["my_agent.py", "my_agent.py:graph"])
41
+ def test_show_config_resolves_against_the_toml_dir(project: Path, spec: str) -> None:
42
+ _write_toml(project, spec)
43
+ res = CliRunner().invoke(main, ["--show-config"])
44
+ assert res.exit_code == 0, res.output
45
+ line = _spec_line(res.output)
46
+ assert str(project / "my_agent.py") in line, line
47
+ assert "[toml" in line # provenance is kept
48
+
49
+
50
+ def test_bare_tilde_spec_is_expanded(
51
+ project: Path, monkeypatch: pytest.MonkeyPatch, tmp_path: Path
52
+ ) -> None:
53
+ home = tmp_path / "home"
54
+ home.mkdir()
55
+ monkeypatch.setenv("HOME", str(home))
56
+ monkeypatch.setenv("USERPROFILE", str(home))
57
+ _write_toml(project, "~/agent.py")
58
+ res = CliRunner().invoke(main, ["--show-config"])
59
+ assert res.exit_code == 0, res.output
60
+ line = _spec_line(res.output)
61
+ assert "~" not in line.split("[")[0], line
62
+ assert str(home / "agent.py") in line, line
63
+
64
+
65
+ def test_env_bare_spec_keeps_its_spelling(project: Path, monkeypatch: pytest.MonkeyPatch) -> None:
66
+ # A spec from the environment stays cwd-relative (gh #30) and is shown as typed.
67
+ monkeypatch.setenv("LANGSTAGE_AGENT_SPEC", "my_agent.py")
68
+ res = CliRunner().invoke(main, ["--show-config"])
69
+ assert res.exit_code == 0, res.output
70
+ assert re.search(r"agent_spec\s*=\s*my_agent\.py\s", _spec_line(res.output) + " ")
71
+
72
+
73
+ def test_describe_does_not_mutate_the_config(project: Path) -> None:
74
+ from langstage_cli.config import CodeConfig
75
+
76
+ _write_toml(project, "my_agent.py")
77
+ cfg = CodeConfig.resolve(toml_start=Path.cwd())
78
+ report = cli._describe(cfg)
79
+ assert str(project / "my_agent.py") in _spec_line(report)
80
+ assert (
81
+ cfg.agent_spec == "my_agent.py"
82
+ ) # the run's own base-dir handling still sees the raw value
File without changes
File without changes