# v0.19.8 Release Notes

> v0.19.7 -> v0.19.8

## Summary

Session lifecycle observability and resource control: per-session concurrency cap (default 3, hard cap 10, env `MAX_SESSION_TASKS`) plus two new endpoints — `GET /v1/session/:session_id/status` (reads `status.json` for online/idle state and active task list) and `GET /v1/session/:session_id/log` (SSE-streams `action.log` by polling the trailing 100 lines once per second with last-line dedup, `: ping` heartbeat after 15 quiet ticks); a per-session `action.log` records user input and key tool/error events for human audit (1 MB rotation, never enters ToriiDB/embedder); configurable timeouts for `invoke_subagent` (`MAX_SUBAGENT_TIMEOUT_MIN`) and external CLI agents (`MAX_EXTERNAL_AGENT_TIMEOUT_MIN`), default 10 min, hard cap 60; and a fix that allows `invoke_subagent` to resume an existing persistent session by id (existence-checked, no auto-create).

<details>
<summary>翻譯</summary>
Session 生命週期可觀測性與資源控制：每 session 併發上限（預設 3、硬上限 10，env `MAX_SESSION_TASKS`）並新增兩支端點 — `GET /v1/session/:session_id/status`（讀 `status.json` 提供 online／idle 狀態與進行中任務清單）與 `GET /v1/session/:session_id/log`（SSE 串流 `action.log`：每秒讀尾端 100 行、以 last-line 比對去重，連續 15 tick 無事件送 `: ping` heartbeat）；每 session `action.log` 紀錄使用者輸入與關鍵 tool／錯誤事件供人工稽核（1 MB rotation，不進 ToriiDB／embedder）；`invoke_subagent`（`MAX_SUBAGENT_TIMEOUT_MIN`）與外部 CLI agent（`MAX_EXTERNAL_AGENT_TIMEOUT_MIN`）超時改為 env 可調，預設 10 分鐘、硬上限 60 分鐘；並修正 `invoke_subagent` 支援以 session id 續用既有持久化 session（已存在性檢查、不自動建立）。
</details>

## Changes

### FIX
- Support persistent session_id for invoke_subagent (@pardnchiu) [deb674e]

<details>
<summary>翻譯</summary>

- 修正 `invoke_subagent` 以非空 `session_id` 續用既有持久化 session（不存在直接 error，不自動建立）

</details>

### UPDATE
- Add session concurrency limit and status endpoint (@pardnchiu) [215fbfa]
- Add configurable timeout settings for subagent and external agent (@pardnchiu) [16945d8]
- Stream session action.log via SSE endpoint with tail-100 polling (@pardnchiu) [staged]

<details>
<summary>翻譯</summary>

- 新增每 session 併發上限與 `GET /v1/session/:session_id/status` 端點
- subagent 與外部 agent 超時改為 env 可調（預設 10 分鐘、硬上限 60 分鐘）
- 新增 `GET /v1/session/:session_id/log` SSE 端點，每秒輪詢 `action.log` 尾端 100 行並推播新增行

</details>

### ADD
- Add session action logs for tool and user events (@pardnchiu) [a78ae4e]

<details>
<summary>翻譯</summary>

- 每 session 新增 `action.log` 紀錄 user 輸入與 tool／錯誤事件（純檔案、不進 DB／embedder）

</details>

## Scope

- `internal/session/concurrent.go` — ADD (per-session concurrency slots, buffered channel pattern)
- `internal/session/status.go` — ADD (per-session `status.json` with online/idle state and active task list)
- `internal/session/actionLog.go` — ADD (per-session `action.log` with 1 MB rotation), UPDATE (`ReadRecord` tail-N reader for SSE consumers)
- `internal/routes/handler/status.go` — ADD (`GET /v1/session/:session_id/status` handler)
- `internal/routes/handler/log.go` — ADD (`GET /v1/session/:session_id/log` SSE handler with tail-100 polling and last-line dedup)
- `internal/routes/new.go` — UPDATE (mount status and log endpoints)
- `internal/agents/exec/execute.go` — UPDATE (concurrency Enter/Leave hooks, Online/Idle, action.log events tee)
- `internal/agents/exec/execWithSubagent.go` — UPDATE (`MAX_SUBAGENT_TIMEOUT_MIN`, persistent session_id existence check)
- `internal/agents/external/external.go` — UPDATE (`MAX_EXTERNAL_AGENT_TIMEOUT_MIN`)
- `internal/tools/agent/subagent/invokeSubagent.go` — FIX (forward `session_id` to exec layer)
- `.env.example` — CHORE (document `MAX_SESSION_TASKS` / `MAX_SUBAGENT_TIMEOUT_MIN` / `MAX_EXTERNAL_AGENT_TIMEOUT_MIN`)

***

### Version Mapping (SemVer)

| Detected Tag | Version Impact |
|---|---|
| `FIX` / `UPDATE` / `SECURITY` / `REFACTOR` / `PERF` / `ADD` / `REMOVE` | PATCH (+0.0.1) |
| `STYLE` / `DOC` / `TEST` / `CHORE` | No bump (`type: none`, skip index) |

***

Generated by [SKILL](https://github.com/pardnchiu/skill-version-generate)
