## 事象
[[Codex CLI]]でAIのターンが終わったら通知するように `config.toml` の `notify` を設定したが、通知されるべきタイミングで通知されない。
以下2ファイルを作成。
`~/.codex/config.toml`
```toml
network_access = true
model = "gpt-5-codex"
[tools]
web_search = true
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp@latest"]
# 通知
notify = ["bash", "/Users/tadashi-aikawa/.codex/notify_macos.sh"]
```
`~/.codex/notify_macos.sh`
```bash
#!/bin/bash
# JSONから最後のエージェント発言を抽出
LAST_MESSAGE=$(echo "$1" | jq -r '.["last-assistant-message"] // "Codex task completed"')
# osascriptで通知表示
osascript -e "display notification \"$LAST_MESSAGE\" with title \"Codex\""
# 音
afplay /System/Library/Sounds/Blow.aiff
```
`codex` を起動し、`こんにちは` と入力して返答があっても何も起こらない。**[[Codex CLI]]のプロンプトにエラーメッセージも表示されない**。
### 環境
| 対象 | バージョン |
| ------------- | ------ |
| [[macOS]] | 15.7 |
| [[Ghostty]] | 1.2.0 |
| [[Codex CLI]] | 0.39.0 |
## 原因
設定の書き方が間違っているから。
`~/.codex/config.toml`
```toml
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp@latest"]
# 通知
notify = ["bash", "/Users/tadashi-aikawa/.codex/notify_macos.sh"]
```
ここに記載すると `mpc_servers.context7.notify` とみなされてしまい `notify` は設定されていないものとして扱われる。そのため通知はされないし、エラーも出ない。
## 解決方法
`notify` の設定場所を変える。
```diff
network_access = true
model = "gpt-5-codex"
+
+ # 通知
+ notify = ["bash", "/Users/tadashi-aikawa/.codex/notify_macos.sh"]
[tools]
web_search = true
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp@latest"]
-
- # 通知
- notify = ["bash", "/Users/tadashi-aikawa/.codex/notify_macos.sh"]
```