# v0.7.1 Release Notes

> v0.7.0 -> v0.7.1

## Summary

Fix race conditions in all provider `model` fields by migrating from mutable package-level `var` to instance-level struct fields, and repair context propagation chain broken by `context.Background()` usage in tool execution.

<details>
<summary>翻譯</summary>
修正所有 Provider 中因可變 package-level `var` 導致的 Race Condition（改為 struct 欄位存儲），並修復工具執行中因使用 `context.Background()` 造成的 Context 傳遞鏈斷裂。
</details>

## Changes

### FIX
- Fix race condition in all providers (claude, compat, copilot, gemini, nvidia, openai): migrate `defaultModel` mutation to instance-level `model` field in struct
- Fix context propagation: `runCommand` and `moveToTrash` now accept and propagate caller's `context.Context` instead of creating fresh `context.Background()`
- Fix nil error wrapping in `getSession`: use `fmt.Errorf` with `%w` instead of `fmt.Printf` + bare return
- Fix empty summary injection: guard `input.Messages` append with `summary != ""` check
- Fix `moveToTrash` missing error check on `os.MkdirAll` and add `ctx.Err()` cancellation guard

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

- 修正所有 Provider（claude、compat、copilot、gemini、nvidia、openai）Race Condition：將 `defaultModel` 可變 package 變數改為 struct 實例欄位 `model`
- 修正 Context 傳遞鏈：`runCommand` 與 `moveToTrash` 改為接收並傳遞呼叫方的 `context.Context`，不再自建 `context.Background()`
- 修正 `getSession` 中的 nil error wrapping：改用 `fmt.Errorf` + `%w` 包裝
- 修正空 summary 注入：以 `summary != ""` 守衛後才 append 到 `input.Messages`
- 修正 `moveToTrash` 缺少 `os.MkdirAll` 錯誤處理，並加入 `ctx.Err()` 取消守衛

</details>

### REFACTOR
- Replace `strconv.Unquote` with `json.Unmarshal` in `normalizeArgs` for correct Unicode escape handling
- Deduplicate `time.Now()` call in `execute.go` by caching to `now`
- Convert mutable `var` blocks for API URLs and constants to `const` across all providers

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

- `normalizeArgs` 中以 `json.Unmarshal` 取代 `strconv.Unquote`，正確處理 Unicode 跳脫序列
- `execute.go` 中快取 `time.Now()` 至 `now` 變數，消除重複呼叫
- 將所有 Provider 中的 API URL 與常數由可變 `var` 改為 `const`

</details>

***

## Files Changed

| File | Status | Tag |
|------|--------|-----|
| `internal/agents/provider/claude/new.go` | Modified | FIX |
| `internal/agents/provider/claude/send.go` | Modified | FIX / REFACTOR |
| `internal/agents/provider/compat/new.go` | Modified | FIX |
| `internal/agents/provider/compat/send.go` | Modified | FIX |
| `internal/agents/provider/copilot/login.go` | Modified | REFACTOR |
| `internal/agents/provider/copilot/new.go` | Modified | FIX |
| `internal/agents/provider/copilot/refresh.go` | Modified | REFACTOR |
| `internal/agents/provider/copilot/send.go` | Modified | FIX / REFACTOR |
| `internal/agents/provider/gemini/new.go` | Modified | FIX |
| `internal/agents/provider/gemini/send.go` | Modified | FIX / REFACTOR |
| `internal/agents/provider/nvidia/new.go` | Modified | FIX |
| `internal/agents/provider/nvidia/send.go` | Modified | FIX / REFACTOR |
| `internal/agents/provider/openai/new.go` | Modified | FIX |
| `internal/agents/provider/openai/send.go` | Modified | FIX / REFACTOR |
| `internal/agents/exec/execute.go` | Modified | REFACTOR |
| `internal/agents/exec/getSession.go` | Modified | FIX |
| `internal/tools/executor.go` | Modified | REFACTOR |
| `internal/tools/tools.go` | Modified | FIX |

***

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