v1.6.13 — Audit hotfix
Five fixes from the post-1.6.12 cold-pass review. All on the standalone runtime; CLI variant source untouched. Full notes in CHANGELOG.md.
What was wrong in 1.6.12
| Severity | Bug | User-visible symptom |
|---|---|---|
| P1 | Agent.reset() cleared _stop_flag while a worker thread was still alive |
Old worker kept running on the now-empty history, appended stale tool results, could even fire a fresh API call against the cleared session |
| P1 | Compaction could orphan a leading tool_result block when the slice point landed inside a tool chain |
Long sessions got HTTP 400 (tool_result block without matching tool_use) exactly when compaction was supposed to save them |
| P2 | stop() set the agent flag and pushed idle without waking workers blocked inside CookThreadDispatcher |
UI reported idle while start_turn() still refused new work because the old thread was alive |
| P2 | tool_batch sub-calls bypassed the validation-hint severity ledger |
A batched td_create_node (high severity) without a follow-up validator did not fire the soft hint that a non-batched call would |
| P3 | README H1 still said v1.6.11 | Cosmetic; check_versions.py's regex didn't match the en-dash form |
What changed under the hood
Agent.reset(): now clearsmessagesonly. Stop flag stays set.- New
Agent.clear_stop(): explicit cancellation lift, only safe to call after the previous worker has been joined. AgentRuntime.reset(): reorders to signal stop → cancel pending cook calls → join worker (2s grace) → mutate state →clear_stop().AgentRuntime.stop(): cancels pending cook calls + joins worker before pushing idle.compact(): advances cut forward past every leading user/tool_resultso the retained slice starts on a clean boundary. May reducekeep_recentbelow the requested value — by design._record_tool_call: peeks insidetool_batchresults and feeds each successful sub-call's name into_turn_tool_calls. Failed sub-calls skipped.
Tests
9 new regression tests pin each behaviour. Pytest 1132 passing (up from 1122).
Upgrade
tdpilot_API.tox rebuilt with all the runtime fixes baked in. Drop it back into TD; existing ~/.tdpilot-api/ state survives. tdpilot-dpsk4.tox rebuilt only to refresh API_VERSION.
The npm release auto-publishes via the Trusted Publisher OIDC binding — npx tdpilot-dpsk4@1.6.13 should resolve immediately.