從 Slack 使用 Codex
你可以在 Slack 中使用 Codex,從 channels 和 threads 直接啟動 coding tasks。
這一篇用 5 分鐘換什麼:把 Slack 整合從"在 Slack 裡跑 Codex"重新理解成把 Slack thread 轉成 scoped cloud task——真正執行仍在 Codex Cloud,所以前置條件是 GitHub connection / environment / repo map / cloud task 許可權都已就位。讀完後你不會把 Slack 當成本地 CLI 替身。
你可以在 Slack 中使用 Codex,從 channels 和 threads 直接啟動 coding tasks。
mention @Codex 並附上 prompt,Codex 會建立 cloud task,並回復結果。
截圖:
https://developers.openai.com/images/codex/integrations/slack-example.png
Slack 入口的本質不是“讓 Codex 在 Slack 裡跑命令”,而是把 Slack thread 轉成 scoped cloud task。真正執行仍發生在 Codex Cloud environment 中,所以前置條件是 GitHub connection、environment、repo map 和 cloud task 許可權都已經配置好。
設定 Slack App
- 設定 Codex cloud tasks。你需要 Plus、Pro、Business、Enterprise 或 Edu plan,見 ChatGPT pricing;還需要 connected GitHub account,以及至少一個 environment。
- 開啟 Codex settings,為你的 workspace 安裝 Slack app。根據 Slack workspace policies,可能需要 admin approve install。
- 把
@Codex新增到 channel。如果還沒有新增,當你 mention 它時,Slack 會提示你。
啟動任務
- 在 channel 或 thread 中 mention
@Codex,並寫入 prompt。Codex 可以 reference thread 中較早的 messages,所以通常不需要重複上下文。 - 可選:在 prompt 中指定 environment 或 repository,例如
@Codex fix the above in openai/codex。 - 等 Codex reaction(👀),並回復 task link。完成後,Codex 會發布 result,並根據你的 settings,可能在 thread 中附上 answer。
Codex 如何選擇環境和儲存庫
- Codex 會 review 你有 access 的 environments,並選擇最匹配 request 的 environment。如果 request ambiguous,則 fallback 到你最近使用過的 environment。
- task 會基於該 environment repo map 中列出的第一個 repository default branch 執行。如果你需要不同 default 或更多 repositories,請在 Codex 中更新 repo map。
- 如果沒有 suitable environment 或 repository,Codex 會在 Slack 中回覆修復說明,你處理後再 retry。
Slack prompt 怎麼寫
Slack thread 往往上下文嘈雜。推薦在 mention @Codex 的最新訊息裡給一個短任務卡:
@Codex Please fix the failing checkout button test in openai/example-app.
Context:
- Failure is in the thread above.
- Prefer the web environment.
- Keep the change limited to checkout UI/test files.
Done when:
- Relevant tests pass.
- Reply with the task link and summary.如果 thread 很長,不要指望 Codex 自動抓住早期所有細節。把關鍵錯誤、目標儲存庫、環境、限制和驗收寫在最新訊息裡。
適合和不適合的任務
適合:
- thread 裡已經討論清楚的 bug fix。
- 小範圍 test failure。
- 文件或示例更新。
- 從 incident/issue thread 提煉可執行 cloud task。
不適合:
- 需要本機未提交改動的任務,除非你使用支援本地狀態委派的入口。
- 需要生產憑據或人工登入的任務。
- 目標儲存庫、環境或許可權不明確的任務。
- 高風險遷移或釋出動作。
企業資料控制
預設情況下,Codex 會在 thread 中回覆 answer,answer 可能包含它執行環境中的資訊。
如果要避免這種情況,Enterprise admin 可以在 ChatGPT workspace settings 中取消 Allow Codex Slack app to post answers on task completion。
admin 關閉 answers 後,Codex 只會回覆 task link。
資料使用、隱私和安全
當你 mention @Codex 時,Codex 會接收你的 message 和 thread history,用來理解 request 並建立 task。
data handling 遵循 OpenAI 的 Privacy Policy、Terms of Use 以及其他適用 policies。
更多 security 資訊,見 Codex security documentation。
Codex 使用 large language models,可能出錯。始終 review answers 和 diffs。
使用建議和排錯
- Missing connections:如果 Codex 無法確認你的 Slack 或 GitHub connection,它會回覆一個 reconnect link。
- Unexpected environment choice:在 thread 中回覆你希望使用的 environment,例如
Please run this in openai/openai (applied),然後再次 mention@Codex。 - Long or complex threads:在最新 message 中 summarize key details,避免 Codex 漏掉 thread 早期隱藏的 context。
- Workspace posting:部分 Enterprise workspaces 會限制釋出 final answers。遇到這種情況,請開啟 task link 檢視 progress 和 results。
- More help:見 OpenAI Help Center。
管理員檢查清單
上線 Slack integration 前,管理員至少確認:
- Slack app 安裝經過 workspace policy 或 admin approval。
- Codex Cloud environments 已配置 repo map、setup script、secrets 和聯網許可權。
- Enterprise workspace 是否允許 Codex Slack app 在 task completion 後釋出 answers。
- 成員知道
@Codex會接收 message 和 thread history。 - 敏感 thread 不用 Slack 直接委派,或只傳送最小必要摘要。