@yahyahammad/venastine 0.3.14 → 0.3.16

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.
@@ -479,6 +479,13 @@ class SessionRow:
479
479
  ran_on: str
480
480
  tier: str
481
481
  return_code: Optional[int]
482
+ # BATCH 258. When the session ended, on the manager's monotonic clock,
483
+ # and None while it runs. The sidebar keeps the five most recent
484
+ # finished sessions under the running ones (SS14, amended), and
485
+ # "most recent" is an order by THIS -- the start order the rows
486
+ # arrive in is not the order they end in. Last and defaulted, so a
487
+ # row built by keyword elsewhere is still a whole row.
488
+ finished_mono: Optional[float] = None
482
489
 
483
490
 
484
491
  @dataclass
@@ -530,7 +537,8 @@ class _Session:
530
537
  call_id=self.call_id, state=self.state,
531
538
  started_wall=self.started_wall, timeout_s=self.timeout_s,
532
539
  match_count=self.match_count, output_chars=self.output.total,
533
- ran_on=self.ran_on, tier=self.tier, return_code=self.return_code)
540
+ ran_on=self.ran_on, tier=self.tier, return_code=self.return_code,
541
+ finished_mono=self.finished_mono)
534
542
 
535
543
 
536
544
  @dataclass
package/logging_setup.py CHANGED
@@ -44,7 +44,7 @@ _DEFAULT_DATEFMT = "%Y-%m-%d %H:%M:%S"
44
44
  _DEFAULT_LOG_FILE = "logs/app.log"
45
45
  _DEFAULT_LEVEL = "INFO"
46
46
 
47
- # Rotation defaults live here, not in config.py: this file owns the
47
+ # Rotation defaults live here, not in config.yaml: this file owns the
48
48
  # logging concern end-to-end (mirrors how ROADMAP.md §2 keeps the whole
49
49
  # logging subsystem in one file). Bump via the function signature if
50
50
  # needed; there is no project-wide reason to surface them as config yet.
package/main.py CHANGED
@@ -395,7 +395,7 @@ def _announce_posture() -> None:
395
395
  app.log and, on the CLI, to stderr through the root handler -- it is
396
396
  the record a bug report is triaged against. The stderr banner is for
397
397
  the human at the terminal, who may have set one of these months ago
398
- and forgotten, or may have inherited a config.py from somewhere.
398
+ and forgotten, or may have inherited a config.yaml from somewhere.
399
399
 
400
400
  Silent when the posture is shipped, so this costs nothing in the case
401
401
  that needs nothing said. That is also why it reads `unsafe_reasons()`
@@ -408,7 +408,7 @@ def _announce_posture() -> None:
408
408
  if not reasons:
409
409
  return
410
410
  print("", file=sys.stderr)
411
- print(" !! REDUCED SECURITY POSTURE -- set in config.py", file=sys.stderr)
411
+ print(" !! REDUCED SECURITY POSTURE -- set in config.yaml", file=sys.stderr)
412
412
  for _label, detail in reasons:
413
413
  logger.warning("Reduced security posture: %s", detail)
414
414
  print(f" - {detail}", file=sys.stderr)
@@ -2233,7 +2233,7 @@ def run_research(
2233
2233
  """Run the full deep-research pipeline, write artifacts to disk,
2234
2234
  and print the results. ensemble_mode/ensemble_n come from
2235
2235
  settings.json (§14); None means the pipeline falls back to the
2236
- config.py defaults. authorization (§25) comes from
2236
+ config.yaml defaults. authorization (§25) comes from
2237
2237
  build_research_authorization(); None means no gated tool is reachable,
2238
2238
  which is the behaviour every research run had before §25.
2239
2239
 
@@ -2394,7 +2394,7 @@ def build_parser() -> argparse.ArgumentParser:
2394
2394
  )
2395
2395
  # Defaults are None so that after parsing we can tell an explicit
2396
2396
  # CLI choice from argparse fill-in; resolution happens in main via
2397
- # resolve_runtime_defaults (CLI > settings.json > config.py).
2397
+ # resolve_runtime_defaults (CLI > settings.json > config.yaml).
2398
2398
  parser.add_argument(
2399
2399
  "--provider",
2400
2400
  default=None,
@@ -2420,7 +2420,7 @@ def build_parser() -> argparse.ArgumentParser:
2420
2420
  metavar="LEVEL",
2421
2421
  help="Reasoning effort for chat AND research (typically "
2422
2422
  "low|medium|high; 'auto' sends none). Default: settings.json "
2423
- "'effort' key, else config.DEFAULT_EFFORT.",
2423
+ "'effort' key, else default_effort in config.yaml.",
2424
2424
  )
2425
2425
  # ROADMAP_v2 §25. TWO flags onto ONE dest, in a mutually exclusive
2426
2426
  # group, rather than a single nargs="?" flag with an optional value.
@@ -2457,7 +2457,7 @@ def build_parser() -> argparse.ArgumentParser:
2457
2457
  "Never persisted.",
2458
2458
  )
2459
2459
  # R9/R12. Default None so settings.json can supply it and an explicit
2460
- # flag still wins (§14's CLI > settings.json > config.py precedence,
2460
+ # flag still wins (§14's CLI > settings.json > config.yaml precedence,
2461
2461
  # which only works because argparse defaults stay None).
2462
2462
  #
2463
2463
  # The MODE is persistable where the grant list is not, and the
@@ -2496,7 +2496,7 @@ def build_parser() -> argparse.ArgumentParser:
2496
2496
  action="store_const",
2497
2497
  const=False,
2498
2498
  help="Research mode: skip the post-pipeline review even if "
2499
- "settings.json or config.py turns it on.",
2499
+ "settings.json or config.yaml turns it on.",
2500
2500
  )
2501
2501
  parser.add_argument(
2502
2502
  "--tui",
@@ -2546,7 +2546,7 @@ def build_parser() -> argparse.ArgumentParser:
2546
2546
  metavar="THREAD",
2547
2547
  action="append",
2548
2548
  help="Attach another thread's summary to this session as context. "
2549
- "Repeatable, up to config.MAX_INJECTED_REFS.",
2549
+ "Repeatable, up to max_injected_refs in config.yaml.",
2550
2550
  )
2551
2551
  # ROADMAP_v2 §24. A flag for M21's reason, and the two kind flags exist
2552
2552
  # so a piped run can skip the question rather than being refused.
@@ -2584,7 +2584,7 @@ def build_parser() -> argparse.ArgumentParser:
2584
2584
  def resolve_runtime_defaults(args, settings: dict) -> tuple[str, str]:
2585
2585
  """Provider/model precedence: explicit CLI flag > settings.json
2586
2586
  (trusted project tier already beat user tier inside the loader) >
2587
- config.py constants."""
2587
+ config.yaml's values."""
2588
2588
  provider = args.provider or settings.get("default_provider") or DEFAULT_PROVIDER
2589
2589
  model = args.model or settings.get("default_model") or config.MODEL_NAME
2590
2590
  return provider, model
@@ -70,7 +70,7 @@ SHUTDOWN_TIMEOUT_S = 15.0
70
70
  # F6 (#64): the WHOLE teardown -- polite close, force-cancel, loop-thread
71
71
  # join -- shares this one wall-clock budget, instead of three sequential
72
72
  # SHUTDOWN_TIMEOUT_S waits whose worst case hung a quitting harness ~45s.
73
- # Master value lives in config.py beside the other harness bounds; the
73
+ # Master value lives in config.yaml beside the other harness bounds; the
74
74
  # re-export here keeps it beside its sibling timeouts and gives tests a
75
75
  # single name to shrink.
76
76
  TEARDOWN_BUDGET_S = _harness_config.TEARDOWN_BUDGET_S
@@ -131,7 +131,7 @@ class MemoryManager:
131
131
  if total > cap:
132
132
  logger.warning(
133
133
  "Injecting %s of %s memories; the oldest %s are not in this "
134
- "prompt. Raise config.MAX_INJECTED_MEMORIES or prune with "
134
+ "prompt. Raise max_injected_memories in config.yaml or prune with "
135
135
  "/forget.", cap, total, total - cap)
136
136
  header = (f"{header}\n\nShowing the {cap} most recent of {total}. "
137
137
  f"Older ones exist and are not listed here.")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yahyahammad/venastine",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "description": "A from-scratch agentic harness: tool-using chat plus a ten-pass self-critiquing research pipeline.",
5
5
  "keywords": [
6
6
  "agent",
@@ -106,9 +106,9 @@ OMITTED = {
106
106
  "disagreement routes a claim to be checked and subtracts nothing, "
107
107
  "and the loader warns when this is set",
108
108
  "ensemble_mode":
109
- "resolved as `config.ENSEMBLE_MODE if value is None`, so writing "
110
- "`false` is not a restatement of the default but a decision to "
111
- "outrank whatever config.py says later",
109
+ "an unset value defers to config.yaml's own ensemble_mode, so "
110
+ "writing `false` is not a restatement of the default but a "
111
+ "decision to outrank whatever config.yaml says later",
112
112
  "compaction.trigger_tokens":
113
113
  "_trigger_is_configured() is a PRESENCE test: the window-derived "
114
114
  "trigger only applies while no human has named a number. Writing "
@@ -117,7 +117,7 @@ OMITTED = {
117
117
  "much earlier fold with nothing on screen to explain it",
118
118
  "research.subagent_review":
119
119
  "same `is not None` shape as ensemble_mode: an explicit false "
120
- "beats config.SUBAGENT_REVIEW rather than deferring to it",
120
+ "beats config.yaml's subagent_review rather than deferring to it",
121
121
  "tui.theme":
122
122
  "no shipped default to write -- absent, _startup_theme() resolves "
123
123
  "one -- and an invented value would outrank a theme the user "
package/pyproject.toml CHANGED
@@ -18,7 +18,7 @@ build-backend = "setuptools.build_meta"
18
18
 
19
19
  [project]
20
20
  name = "venastine-research-harness"
21
- version = "0.3.14"
21
+ version = "0.3.16"
22
22
  description = "A from-scratch agentic harness: tool-using chat plus a ten-pass self-critiquing research pipeline."
23
23
  readme = "README.md"
24
24
  # The same words as package.json's `keywords`, in the same order: what a
@@ -19,9 +19,10 @@ the precedent: `tools/builtin/_math_common.py` exists because "an
19
19
  expression string is code", and its docstring lists the escapes that were
20
20
  found before the AST allowlist went in.
21
21
 
22
- So the posture is bound once and frozen (UN1). The `config.py` constants
23
- are still where a HUMAN writes the value; they simply stop being what is
24
- read at the moment a decision is made.
22
+ So the posture is bound once and frozen (UN1). `config.yaml` is still
23
+ where a HUMAN writes the value, and the `config.py` constants that
24
+ publish it simply stop being what is read at the moment a decision is
25
+ made.
25
26
 
26
27
  WHAT THE GUARANTEE IS, AND IS NOT
27
28
  ---------------------------------
@@ -254,7 +255,7 @@ class Posture:
254
255
  if self.shell_approval_mode == "never":
255
256
  reasons.append((
256
257
  "shell: never ask",
257
- "SHELL_APPROVAL_MODE is 'never' -- no shell command is "
258
+ "shell_approval_mode is 'never' -- no shell command is "
258
259
  "ever asked about, including one that reads outside the "
259
260
  "workspace on the host"))
260
261
  elif self.shell_approval_mode == "contained":
@@ -264,7 +265,7 @@ class Posture:
264
265
  # holds a `.venastine/` that code can read it.
265
266
  reasons.append((
266
267
  "shell: contained",
267
- "SHELL_APPROVAL_MODE is 'contained' -- a command that runs "
268
+ "shell_approval_mode is 'contained' -- a command that runs "
268
269
  "in the container without network runs without asking, "
269
270
  "including code the agent wrote itself; host reads and "
270
271
  "network commands still ask"))
@@ -279,7 +280,7 @@ class Posture:
279
280
  "asks, as under tiered")
280
281
  reasons.append((
281
282
  "shell: classified",
282
- "SHELL_APPROVAL_MODE is 'classified' -- a decision model "
283
+ "shell_approval_mode is 'classified' -- a decision model "
283
284
  f"({who}) decides whether a single command that runs in the "
284
285
  "container, and that tiered would ask about, runs without "
285
286
  "asking; compound commands, host reads, the host fallback, "
@@ -293,14 +294,14 @@ class Posture:
293
294
  and self.shell_approval_mode != "always"):
294
295
  reasons.append((
295
296
  "host shell, no ask",
296
- "ALLOW_INSECURE_SANDBOX_FALLBACK and "
297
- "AUTO_APPROVE_SANDBOX_FALLBACK are both on -- unprompted "
297
+ "allow_insecure_sandbox_fallback and "
298
+ "auto_approve_sandbox_fallback are both on -- unprompted "
298
299
  "arbitrary code on the host, with your own file access, "
299
300
  "including writes into this harness's own source"))
300
301
  elif self.allow_insecure_fallback:
301
302
  reasons.append((
302
303
  "host shell fallback",
303
- "ALLOW_INSECURE_SANDBOX_FALLBACK is on -- if no container "
304
+ "allow_insecure_sandbox_fallback is on -- if no container "
304
305
  "runtime (Docker or Podman) can run the sandbox, commands "
305
306
  "run on the host with no filesystem or network isolation"))
306
307
  # ROADMAP_v3 §49 slice 3 (SS41). Reported when it is ENABLED rather
@@ -321,7 +322,7 @@ class Posture:
321
322
  # this is §48 (CE6)'s correction applied to a second pair.
322
323
  if (self.auto_approve_fallback
323
324
  and self.shell_approval_mode not in ("always", "never")):
324
- asking = ("AUTO_APPROVE_SANDBOX_FALLBACK is on as well, so "
325
+ asking = ("auto_approve_sandbox_fallback is on as well, so "
325
326
  "NOTHING there asks first -- that opt-in answers "
326
327
  "for the whole backend, not only for the host "
327
328
  "fallback it is named after. Running as root is "
@@ -332,7 +333,7 @@ class Posture:
332
333
  "runs as root always asks")
333
334
  reasons.append((
334
335
  "wsl backend",
335
- "ALLOW_WSL_BACKEND is on -- the agent can ask for a command "
336
+ "allow_wsl_backend is on -- the agent can ask for a command "
336
337
  "to run in WSL, which is not a sandbox: it reaches this "
337
338
  "harness's own config and authority files, has no memory or "
338
339
  "process limits, and can start Windows programs with your "
@@ -345,7 +346,7 @@ class Posture:
345
346
  if self.allow_ssh_backend:
346
347
  reasons.append((
347
348
  "ssh backend",
348
- "ALLOW_SSH_BACKEND is on -- the agent can ask for a command "
349
+ "allow_ssh_backend is on -- the agent can ask for a command "
349
350
  "to run on the configured remote host, which this harness "
350
351
  "cannot inspect: no isolation, no memory or process limits, "
351
352
  "and credentials it did not issue. Nothing runs there "
@@ -355,7 +356,7 @@ class Posture:
355
356
  if not self.redact_tool_outputs:
356
357
  reasons.append((
357
358
  "no redaction",
358
- "REDACT_TOOL_OUTPUTS is off -- credential-shaped strings "
359
+ "redact_tool_outputs is off -- credential-shaped strings "
359
360
  "in tool results are passed through unredacted"))
360
361
  elif self.redact_off_env:
361
362
  reasons.append((
@@ -3365,7 +3365,7 @@ def _unavailable_message(backend: str = BACKEND_CONTAINER) -> str:
3365
3365
  return (
3366
3366
  "No container runtime can run the sandbox"
3367
3367
  + (f" ({reason})" if reason else "")
3368
- + " and ALLOW_INSECURE_SANDBOX_FALLBACK is False. Install Docker or "
3368
+ + " and allow_insecure_sandbox_fallback is false. Install Docker or "
3369
3369
  "Podman for strong isolation, or set "
3370
3370
  "allow_insecure_sandbox_fallback: true in config.yaml to use the "
3371
3371
  "weaker subprocess fallback (no filesystem isolation, no network "
@@ -281,7 +281,7 @@ def _read_rich(resolved_path: str) -> str:
281
281
  consumer, it sits behind `read`, and `read` is globally denied and
282
282
  cannot be re-enabled at runtime -- so a default install carries neither
283
283
  it nor its eleven transitive distributions. Anyone who reaches here has
284
- enabled `read` in config.py, and the bare ModuleNotFoundError would name
284
+ enabled `read` in config.yaml, and the bare ModuleNotFoundError would name
285
285
  a package they never asked for and cannot place.
286
286
  """
287
287
  try:
@@ -144,7 +144,7 @@ logger = logging.getLogger(__name__)
144
144
  # read the posture at import time**, pinned by
145
145
  # test_posture.py::test_no_module_reads_the_posture_at_import.
146
146
  capability.validate_mode(config.SHELL_APPROVAL_MODE,
147
- "config.SHELL_APPROVAL_MODE")
147
+ "shell_approval_mode in config.yaml")
148
148
 
149
149
  # Compute the shell name once at import time to avoid blocking on
150
150
  # subprocess probes every time the schema is accessed. On Windows this
@@ -625,7 +625,7 @@ def _shell_approval_check(tool_name: str, params: dict) -> bool:
625
625
  """
626
626
  active = posture.current()
627
627
  mode = capability.validate_mode(active.shell_approval_mode,
628
- "config.SHELL_APPROVAL_MODE")
628
+ "shell_approval_mode in config.yaml")
629
629
  if mode == capability.ALWAYS:
630
630
  return True
631
631
  if mode == capability.NEVER:
@@ -878,7 +878,7 @@ def _interactive_approval_check(tool_name: str, params: dict) -> bool:
878
878
  """
879
879
  active = posture.current()
880
880
  mode = capability.validate_mode(active.shell_approval_mode,
881
- "config.SHELL_APPROVAL_MODE")
881
+ "shell_approval_mode in config.yaml")
882
882
  if mode == capability.ALWAYS:
883
883
  return True
884
884
  if mode == capability.NEVER:
@@ -1055,8 +1055,8 @@ def fallback_changed_refusal(command: str, docker_up: bool) -> str | None:
1055
1055
  if active.allow_insecure_fallback and not active.auto_approve_fallback:
1056
1056
  return ("Docker became unavailable after the approval check. "
1057
1057
  "The insecure subprocess fallback requires explicit "
1058
- "per-run approval (AUTO_APPROVE_SANDBOX_FALLBACK is "
1059
- "False). Please retry — the approval prompt will "
1058
+ "per-run approval (auto_approve_sandbox_fallback is "
1059
+ "false in config.yaml). Please retry — the approval prompt will "
1060
1060
  "appear this time.")
1061
1061
  return None
1062
1062
 
@@ -455,7 +455,7 @@ def input_approval_check(tool_name: str, params: dict) -> bool:
455
455
  return False
456
456
  active = posture.current()
457
457
  mode = capability.validate_mode(active.shell_approval_mode,
458
- "config.SHELL_APPROVAL_MODE")
458
+ "shell_approval_mode in config.yaml")
459
459
  if mode == capability.ALWAYS:
460
460
  return True
461
461
  if mode == capability.NEVER:
package/tui/app.py CHANGED
@@ -487,8 +487,9 @@ class SessionRowsChanged(Message):
487
487
  sink runs on the manager's threads and the handler on the UI thread,
488
488
  so a delta would have the panel reassembling an order it never saw.
489
489
 
490
- FILTERED ON THE UI SIDE, not here. The panel shows live sessions
491
- only (SS14), and doing that in the handler keeps this message a
490
+ FILTERED ON THE UI SIDE, not here. The panel shows the running
491
+ sessions and the five most recent finished ones (SS14, amended in
492
+ batch 258), and doing that in the handler keeps this message a
492
493
  faithful copy of what the manager said rather than a view of it --
493
494
  which is what lets a second reader be added without the first one's
494
495
  filter being in the way.
@@ -656,14 +657,45 @@ def _redacted_command(row) -> str:
656
657
  return check_output_policy(tool, {"command": row.command})["command"]
657
658
 
658
659
 
660
+ #: How many finished sessions the sidebar keeps under the running ones
661
+ #: (SS14 as amended in batch 258; the owner's choice of five). The
662
+ #: manager keeps twenty (`_FINISHED_KEPT`), so this is a view of what it
663
+ #: holds and never a reason for it to hold more.
664
+ PANEL_FINISHED_SHOWN = 5
665
+
666
+
667
+ def _panel_outcome(row) -> tuple[str, str]:
668
+ """A session's `(status, outcome)` for the panel: how it ended, in as
669
+ few cells as say it.
670
+
671
+ `done` is an exit of 0 and nothing else. A non-zero code, a kill, a
672
+ timeout and a start that failed are all `failed`, and the outcome
673
+ text tells them apart -- the code itself where there is one, because
674
+ `2` and `137` are what a person would go and look up.
675
+ """
676
+ if row.state in shell_sessions.LIVE_STATES:
677
+ return "running", ""
678
+ if row.state == shell_sessions.EXITED:
679
+ if row.return_code is None:
680
+ return "failed", "exited"
681
+ return ("done" if row.return_code == 0 else "failed",
682
+ str(row.return_code))
683
+ return "failed", {shell_sessions.KILLED: "killed",
684
+ shell_sessions.TIMED_OUT: "timed out",
685
+ shell_sessions.FAILED: "failed"}.get(row.state,
686
+ row.state)
687
+
688
+
659
689
  def _panel_rows(rows) -> list[dict]:
660
- """`SessionRow`s as the session panel's `{id, label}` pairs (SS14).
690
+ """`SessionRow`s as the session panel's rows (SS14).
661
691
 
662
692
  EIGHTEEN COLUMNS, so the label is the id and as much of the command
663
693
  as fits -- the widget elides, and what it elides from has to be the
664
694
  part that identifies the session rather than a prefix of `docker`.
665
695
  A monitor's match count rides along when there is one, because "it
666
696
  has matched something" is the whole reason a monitor is on screen.
697
+ A finished row adds its `status` and `outcome` (`_panel_outcome`),
698
+ which the widget fits before the command.
667
699
 
668
700
  Module-level beside `_kill_rows`, for its reason.
669
701
  """
@@ -671,8 +703,10 @@ def _panel_rows(rows) -> list[dict]:
671
703
  for row in rows:
672
704
  matches = (f" {row.match_count}✓"
673
705
  if row.kind == "monitor" and row.match_count else "")
706
+ status, outcome = _panel_outcome(row)
674
707
  out.append({"id": row.id,
675
- "label": f"{row.id}{matches} {_redacted_command(row)}"})
708
+ "label": f"{row.id}{matches} {_redacted_command(row)}",
709
+ "status": status, "outcome": outcome})
676
710
  return out
677
711
 
678
712
 
@@ -944,7 +978,7 @@ class VenastineApp(App):
944
978
  self._animations = tui_settings.get("animations", True)
945
979
  # §38 (O6). Render a turn's reasoning inline, or collapse it to the
946
980
  # animated one-line indicator. Defaulted HERE rather than in
947
- # config.py, following `animations` immediately above: config.py
981
+ # config.yaml, following `animations` immediately above: config.yaml
948
982
  # holds no TUI values and is plain-values-only. /thinking flips it
949
983
  # for the session and persists nothing, matching /effort.
950
984
  self._show_thinking = tui_settings.get("show_thinking", True)
@@ -1544,7 +1578,7 @@ class VenastineApp(App):
1544
1578
  from the trace.
1545
1579
 
1546
1580
  "(remembered)" marks a pair restored from the preference store
1547
- rather than resolved from settings.json or config.py (§43, RM3).
1581
+ rather than resolved from settings.json or config.yaml (§43, RM3).
1548
1582
  #138's rule: a launch should not have to be guessed at, and a
1549
1583
  session silently coming up on a model no config file names is
1550
1584
  exactly the confusion this feature would otherwise trade for the
@@ -2439,13 +2473,15 @@ class VenastineApp(App):
2439
2473
  self.open_session(str(message.session_id))
2440
2474
 
2441
2475
  def open_session(self, session_id: str) -> None:
2442
- """Show a LIVE session, read-only (SS14).
2476
+ """Show a session this process holds, read-only (SS14).
2443
2477
 
2444
2478
  The panel's route, and the only one that starts from a session
2445
2479
  id: the panel draws what the manager holds, so by definition
2446
- this process has the session. A row that has finished between
2447
- the draw and the click is the one race, and it is answered the
2448
- way a missing thread is -- said, not ignored.
2480
+ this process has the session -- running, or one of the finished
2481
+ rows the panel keeps since batch 258, whose output the manager
2482
+ still has. A row that aged out of the manager between the draw
2483
+ and the click is the one race, and it is answered the way a
2484
+ missing thread is -- said, not ignored.
2449
2485
  """
2450
2486
  row = shell_sessions.sessions.row(session_id)
2451
2487
  if row is None:
@@ -3651,9 +3687,9 @@ class VenastineApp(App):
3651
3687
  def on_session_rows_changed(self, message: SessionRowsChanged) -> None:
3652
3688
  """The session sink spoke. Runs on the UI thread (§49, SS14)."""
3653
3689
  self.refresh_session_panel(message.rows)
3654
- # SS14: the panel shows live sessions only, so a session that
3655
- # just finished leaves it -- and the view of it, if one is open,
3656
- # is now showing a state that has moved. Repainted here because
3690
+ # SS14: a session that just finished changes its row's mark --
3691
+ # and the view of it, if one is open, is now showing a state
3692
+ # that has moved. Repainted here because
3657
3693
  # this is the only signal: the poll stops the moment the session
3658
3694
  # stops being live, so without this the view would keep the last
3659
3695
  # tick's "running" header for good.
@@ -3675,13 +3711,23 @@ class VenastineApp(App):
3675
3711
  `refresh_agent_panel`'s reason: two writers of one widget is how
3676
3712
  the two come to draw it differently.
3677
3713
 
3678
- THE FILTER IS HERE, which is SS14's "live sessions only" -- the
3679
- message carries everything the manager holds, so this is the one
3680
- place that decides what a reader sees.
3714
+ THE FILTER IS HERE, which is SS14's -- the message carries
3715
+ everything the manager holds, so this is the one place that
3716
+ decides what a reader sees. Since batch 258 that is every running
3717
+ session as it started, then the PANEL_FINISHED_SHOWN most recent
3718
+ finished ones, newest first. It was running only, and a session
3719
+ then left the panel at the moment it ended -- which is also the
3720
+ moment its wake starts the agent's next turn, so the row seemed
3721
+ to be taken by the turn.
3681
3722
  """
3682
3723
  live = [row for row in rows
3683
3724
  if row.state in shell_sessions.LIVE_STATES]
3684
- self._session_panel.show(_panel_rows(live))
3725
+ finished = sorted(
3726
+ (row for row in rows
3727
+ if row.state not in shell_sessions.LIVE_STATES),
3728
+ key=lambda row: row.finished_mono or 0.0,
3729
+ reverse=True)[:PANEL_FINISHED_SHOWN]
3730
+ self._session_panel.show(_panel_rows(live) + _panel_rows(finished))
3685
3731
 
3686
3732
  @property
3687
3733
  def _session_panel(self) -> SessionPanel:
@@ -6128,7 +6174,7 @@ def _cmd_window(app: VenastineApp, args: str) -> None:
6128
6174
  # the best reason to have this command -- a gateway or a self-hosted
6129
6175
  # endpoint can report its own default rather than the deployment's
6130
6176
  # real window -- so refusing would block precisely the case it exists
6131
- # for. The risk is named in the same terms config.py uses for the qwen
6177
+ # for. The risk is named in the same terms config.yaml uses for the qwen
6132
6178
  # entry: erring high means a hard context-limit error mid-run.
6133
6179
  reported = _reported_window(app)
6134
6180
  if reported and tokens > reported:
@@ -6297,9 +6343,10 @@ def _report_override(app: VenastineApp, key: str) -> None:
6297
6343
  elif _reported_window(app) is not None:
6298
6344
  source = f"reported by {app.provider_name}"
6299
6345
  elif compaction._normalized(app.model) in config.MODEL_CONTEXT_WINDOWS:
6300
- source = "config.MODEL_CONTEXT_WINDOWS"
6346
+ source = "model_context_windows in config.yaml"
6301
6347
  else:
6302
- source = "config.DEFAULT_CONTEXT_WINDOW (no entry for this model)"
6348
+ source = ("default_context_window in config.yaml "
6349
+ "(no entry for this model)")
6303
6350
  app._transcript.write_system(
6304
6351
  f"Context window: {effective:,} — {source}.")
6305
6352
  app._transcript.write_system(
@@ -6654,7 +6701,7 @@ def _clear_pipeline_role(app: VenastineApp, role: str, label: str) -> None:
6654
6701
  remaining = pipeline_models.resolve(role)
6655
6702
  if remaining:
6656
6703
  app._transcript.write_system(
6657
- f"config.py still sets {label}: {remaining['provider_name']} | "
6704
+ f"config.yaml still sets {label}: {remaining['provider_name']} | "
6658
6705
  f"{remaining['model']}.")
6659
6706
 
6660
6707