Codex Task Notify
Get a notification when a Codex task finishes, whether you are working on local Windows, in WSL, or over Remote SSH.
为 Codex 提供任务完成通知,支持本地 Windows、WSL 和 Remote SSH。
Quick Start
- Install the extension
- Reload VS Code if prompted
- Run
Codex Task Notify: Test Notification
- Run Codex as usual
快速开始
- 安装扩展
- 如果 VS Code 提示重载,按提示重载
- 运行
Codex Task Notify: Test Notification
- 像平时一样运行 Codex
What You Get
- Automatically watches real Codex session files under
.codex/sessions and notifies on task_complete
- Shows a Windows desktop notification when available
- Falls back to a VS Code notification when desktop notification is unavailable
- Works with local Windows workspaces, Remote WSL, and Remote SSH
- Supports optional cost estimation, ntfy push, sound, and webhooks
- Keeps local-time 8-hour cost statistics, including subagent costs
- Keeps a local per-completion cost audit ledger for comparing estimates with provider usage
你会得到什么
- 直接监听
.codex/sessions 下真实的 Codex 会话文件,并在出现 task_complete 时通知
- 在可用时优先显示 Windows 桌面通知
- 当桌面通知不可用时,回退为 VS Code 内通知
- 支持本地 Windows 工作区、Remote WSL 和 Remote SSH
- 支持可选的成本估算、ntfy 推送、声音提醒和 Webhook
- 按本机时区保留 8 小时成本统计,包含子 agent 成本
- 保留逐完成事件的本地成本审计账本,便于同 provider 用量核对
子 agent 会话文件可能带有只读的父会话历史快照。扩展只将其作为 token 基线,子 agent 成本只记录启动后的增量,不会把父会话累计 token 归到子 agent。
Useful Commands
Codex Task Notify: Test Notification
Codex Task Notify: Test Error Notification
Codex Task Notify: Show Diagnostics
Codex Task Notify: Show Monitor Performance
Codex Task Notify: Show Recent History
Codex Task Notify: Show Recent Costs
Codex Task Notify: Show 8-Hour Cost Statistics
Codex Task Notify: Show Cost Audit Ledger
The test commands exercise notification delivery only, including enabled external channels. They do not create Codex turns or cost records. Show Monitor Performance shows polling duration and file I/O since activation, with summaries for the latest 120 polls. Durations include file I/O waits and do not represent exclusive CPU time; metrics reset when the extension host restarts.
常用命令
Codex Task Notify: Test Notification
Codex Task Notify: Test Error Notification
Codex Task Notify: Show Diagnostics
Codex Task Notify: Show Monitor Performance
Codex Task Notify: Show Recent History
Codex Task Notify: Show Recent Costs
Codex Task Notify: Show 8-Hour Cost Statistics
Codex Task Notify: Show Cost Audit Ledger
测试命令只验证通知投递,包括已启用的外部通道;不会创建 Codex 任务或成本记录。Show Monitor Performance 可查看扩展启动以来的轮询耗时、文件 I/O 和最近 120 次轮询的统计。耗时包含文件 I/O 等待,不代表插件独占 CPU 时间;扩展宿主重启后统计会重置。
When You May Need Settings
- If your Codex session directory is not in the default location, set
codexTaskNotify.sessionsRoot
- If you want notification clicks to bring VS Code to the front, keep
codexTaskNotify.windowsNotification.openVsCodeOnClick enabled
- If you use custom pricing, add
codexTaskNotify.costEstimation.customModelPricing
Default locations:
- Local Windows:
%USERPROFILE%\\.codex\\sessions
- Remote SSH or WSL: the extension tries to infer the remote home directory and then uses
~/.codex/sessions
Minimal example:
{
"codexTaskNotify.sessionsRoot": "",
"codexTaskNotify.windowsNotification.openVsCodeOnClick": true
}
Cost estimation example:
{
"codexTaskNotify.costEstimation.enabled": true,
"codexTaskNotify.costEstimation.customModelPricing": {
"gpt-5.4": {
"inputPerMillionUsd": 2.5,
"cachedInputPerMillionUsd": 0.25,
"outputPerMillionUsd": 15
}
}
}
什么时候你可能需要改设置
- 如果你的 Codex 会话目录不在默认位置,设置
codexTaskNotify.sessionsRoot
- 如果你希望点击通知时把 VS Code 切回前台,保持
codexTaskNotify.windowsNotification.openVsCodeOnClick 为启用状态
- 如果你使用自定义价格,设置
codexTaskNotify.costEstimation.customModelPricing
默认位置:
- 本地 Windows:
%USERPROFILE%\\.codex\\sessions
- Remote SSH 或 WSL:扩展会尝试推断远程 home 目录,再使用
~/.codex/sessions
最小示例:
{
"codexTaskNotify.sessionsRoot": "",
"codexTaskNotify.windowsNotification.openVsCodeOnClick": true
}
成本估算示例:
{
"codexTaskNotify.costEstimation.enabled": true,
"codexTaskNotify.costEstimation.customModelPricing": {
"gpt-5.4": {
"inputPerMillionUsd": 2.5,
"cachedInputPerMillionUsd": 0.25,
"outputPerMillionUsd": 15
}
}
}
Optional Channels
ntfy
{
"codexTaskNotify.notificationChannels.ntfy.enabled": true,
"codexTaskNotify.notificationChannels.ntfy.topicUrl": "https://ntfy.sh/your-topic-name",
"codexTaskNotify.notificationChannels.ntfy.priority": 3,
"codexTaskNotify.notificationChannels.ntfy.tags": "computer"
}
If your topic is private or protected, also set:
{
"codexTaskNotify.notificationChannels.ntfy.accessToken": "YOUR_NTFY_ACCESS_TOKEN"
}
Sound
{
"codexTaskNotify.notificationChannels.sound.enabled": true,
"codexTaskNotify.notificationChannels.sound.windowsSound": "Notification.Default"
}
Webhook
{
"codexTaskNotify.notificationChannels.webhook.enabled": true,
"codexTaskNotify.notificationChannels.webhook.url": "https://example.com/your-notify-endpoint"
}
可选通知通道
ntfy
{
"codexTaskNotify.notificationChannels.ntfy.enabled": true,
"codexTaskNotify.notificationChannels.ntfy.topicUrl": "https://ntfy.sh/your-topic-name",
"codexTaskNotify.notificationChannels.ntfy.priority": 3,
"codexTaskNotify.notificationChannels.ntfy.tags": "computer"
}
如果 topic 是私有或受保护的,再额外设置:
{
"codexTaskNotify.notificationChannels.ntfy.accessToken": "YOUR_NTFY_ACCESS_TOKEN"
}
声音通知
{
"codexTaskNotify.notificationChannels.sound.enabled": true,
"codexTaskNotify.notificationChannels.sound.windowsSound": "Notification.Default"
}
Webhook
{
"codexTaskNotify.notificationChannels.webhook.enabled": true,
"codexTaskNotify.notificationChannels.webhook.url": "https://example.com/your-notify-endpoint"
}
Troubleshooting
- Run
Codex Task Notify: Test Notification to verify the local notification path
- Run
Codex Task Notify: Show Diagnostics if notifications do not appear
- If your Codex home is custom or remote detection is wrong, set
codexTaskNotify.sessionsRoot
If you need script-based automation, the extension also provides:
Codex Task Notify: Install Local CLI
Codex Task Notify: Install Workspace CLI
排查问题
- 运行
Codex Task Notify: Test Notification,确认本地通知链路可用
- 如果通知没有出现,运行
Codex Task Notify: Show Diagnostics
- 如果你的 Codex 主目录是自定义位置,或者远程路径识别不对,手动设置
codexTaskNotify.sessionsRoot
如果你确实需要脚本化自动化,扩展也提供:
Codex Task Notify: Install Local CLI
Codex Task Notify: Install Workspace CLI