codex 无法用自带工具修改文本和代码 Begin Patch/End Patch/apply_patch

2026-09-01 16:59 1

这个教程大概率会大海捞针,太冷门了不知道为什么,但是如果cc-switch切换官号用就没问题


太痛苦了,如果有佬也遇到解决的希望能帮帮忙


问题情况:无法用自带工具修改文本和代码,全都是用Begin Patch/End Patch/apply_patch 进行修改代码,一直重试非常多次才能修改成功,无Edited记录,跟25年时候win+国模+claudecode cli一样,各种修改失败




@'
*** Begin Patch
*** Update File: C:\Users\jc\Desktop\luang\highway-maintenance-2026\test.txt
@@
-请在这里输入现在的年月日
+现在的年月日:2026年9月1日
*** End Patch
'@ | apply_patch

测试要模拟修改的文本或者代码


期望的效果(但是看不到,而且没有无Edited记录):




已尝试以下教程(包括删掉sub2api供应商重新导入ccs到cc-switch):


codex调用工具有问题,还有一个就是UTF格式兼容的问题 ^-^
我目前的方法是把它反代出来接入别的工具使用,比如用vscode就接入copilot ^-^


CCSwitch的模板非常简略,甚至漏洞百出,能用的功能全都给你关了.
[官方全是true,默认模板几乎全是flase]

codex apply_patch工具用不了的原因是…

使用中转站没有codex-auto-review模型无法获得自动审批服务。

与其自己魔改CCSwitch的模板不如直接拿官方的models.json来用 …


我用这个提示词后就有edited记录了,你可以试试
## 文件编辑约束(全局强制)

- 项目文件的创建 / 修改 / 删除,统一使用 `apply_patch`
- 禁止通过 shell / 脚本写文件(`Set-Content`、`Out-File`、`>`、`>>`、`write_text`、`cat`/heredoc 等)
- Shell 仅用于读查与执行:搜索、git、编译、测试、装依…


codex CLI/codex App接入第三方api就看不到高亮edit代码了吗? ^-^
全是命令行,codex官方api就能看到高亮edit编辑/删除代码,第三方api没办法高亮吗? ^-^




版本 26.825.51511

发布于 2026年8月30日
![image|478x417](upload://5KJ8vrLzwpFoHWqAAMvI0sj9WbY.png)

最新回复 (4)
  • 迷糊.YOU 09-02 09:00
    1

    其实就需要个wire_api = “responses”


    [model_providers.codex_local_access]

    name = “Codex Manager”

    base_url = “https://xxxxx.xxx”

    wire_api = “responses” //流式响应(没有这个就走命令行)

    model_context_window = 1000000 //1M上下文

    model_auto_compact_token_limit = 900000 //上下文使用90%开始压缩


    这样懂不?

  • 楼主 09-02 15:41
    2

    wire_api = “responses” 是默认配置着的


    model_provider = "custom"
    model = "gpt-5.6-sol"
    service_tier = "default"
    approval_policy = "never"
    approvals_reviewer = "user"
    sandbox_mode = "danger-full-access"
    personality = "friendly"
    model_reasoning_effort = "high"
    notify = [ "C:\\Users\\jc\\AppData\\Local\\OpenAI\\Codex\\runtimes\\cua_node\\415ffebf3d576e9b\\bin\\node_modules\\@oai\\sky\\bin\\windows\\codex-computer-use.exe", "turn-ended" ]
    disable_response_storage = true

    [model_providers.custom]
    name = "Sub2API"
    base_url = "http://*:18081"
    wire_api = "responses"
    requires_openai_auth = true
    experimental_bearer_token = "sk-*"

    [marketplaces.openai-primary-runtime]
    source_type = "local"
    source = '\\?\C:\Users\jc\.cache\codex-runtimes\codex-primary-runtime\plugins\openai-primary-runtime'

    [marketplaces.kuangrui-codex-plugins]
    last_updated = "2026-08-28T10:07:39Z"
    last_revision = "d0f9b3ab472e593302ea1e4d9d0293f1e1162829"
    source_type = "git"
    source = "https://git.内网插件库.com/*/*-codex-plugins.git"

    [marketplaces.openai-bundled]
    source_type = "local"
    source = '\\?\C:\Users\jc\.codex\.tmp\bundled-marketplaces\openai-bundled'
    [desktop]
    hotkey-window-projectless-default-enabled = true
    notifications-turn-mode = "always"
    selected-avatar-id = "codex"
    keepRemoteControlAwakeWhilePluggedIn = true
    git-pr-instructions = "使用简体中文"
    git-commit-instructions = "使用简体中文"
    show-context-window-usage = true
    enabled-reasoning-efforts = ["low", "medium", "high", "xhigh", "ultra", "max"]
    conversationDetailMode = "STEPS_COMMANDS"
    followUpQueueMode = "queue"
    defaultTerminalLocation = "bottom"
    "browser-family-enabled:chrome" = true
    toys-confetti-enabled = true
    integratedTerminalShell = "powershell"

    [desktop.open-in-target-preferences]
    global = "vscode"
    [desktop.open-in-target-preferences.perPath]
    'C:\Users\jc\.codex\worktrees\d6af\highway-maintenance-android-2026' = "vscode"
    'C:\Users\jc\.codex\worktrees\6b50\highway-maintenance-2026' = "intellij"
    'C:\Users\jc\.codex\worktrees\8e48\hotel-manage' = "pycharm"
    'C:\Users\jc\Desktop\luang\demo\measurement-change-tool' = "vscode"
    'C:\Users\jc\Desktop\luang\highway-maintenance-2026' = "vscode"

    [marketplaces.ponytail]
    last_updated = "2026-08-28T10:08:05Z"
    last_revision = "2ed6c52c9d7e5e56942508591085fd45dea277d3"
    source_type = "git"
    source = "https://github.com/DietrichGebert/ponytail.git"
    [windows]
    sandbox = "elevated"

    [memories]
    generate_memories = true
    use_memories = true

    [tui]
    status_line = ["model-with-reasoning", "current-dir", "project-name", "git-branch", "pull-request-number", "branch-changes", "run-state", "context-used", "five-hour-limit", "weekly-limit", "used-tokens", "thread-title", "task-progress"]
    status_line_use_colors = true
    pet = "custom:clawd-4"
    resume_cwd = "session"

    [tui.model_availability_nux]
    "gpt-5.5" = 4
    "gpt-5.6-sol" = 2

    [plugins."documents@openai-primary-runtime"]
    enabled = true

    [plugins."spreadsheets@openai-primary-runtime"]
    enabled = true

    [plugins."presentations@openai-primary-runtime"]
    enabled = true

    [projects.'c:\users\jc\documents\codex\2026-09-01\bang-2']
    trust_level = "trusted"

    [plugins."notion@openai-curated"]
    enabled = true

    [plugins."github@openai-curated"]
    enabled = true

    [plugins."pdf@openai-primary-runtime"]
    enabled = true

    [plugins."template-creator@openai-primary-runtime"]
    enabled = true
    [plugins."visualize@openai-bundled"]
    enabled = true

    [plugins."release-26-highway-android@kuangrui-codex-plugins"]
    enabled = true

    [plugins."aliyun-ssl-certificate@kuangrui-codex-plugins"]
    enabled = true

    [plugins."computer-use@openai-bundled"]
    enabled = true
    [features]
    hooks = true
    memories = true
    terminal_resize_reflow = true
    network_proxy = true
    external_migration = true
    prevent_idle_sleep = true
    js_repl = false
    plugins = true
    fast_mode = true
    computer_use = true
    codex_hooks = true
    apply_patch_freeform = true
    shell_snapshot = true
    elevated_windows_sandbox = true

    [shell_environment_policy.set]
    NODE_REPL_TRUSTED_BROWSER_CLIENT_SHA256S = "3b9d8dcc6dc968887e8a969c63dae6380e3c1c59ff5c474eb32df08c353dad87"
    [hooks.state]

    [hooks.state.'C:\Users\jc\.codex\hooks.json:stop:0:0']
    trusted_hash = "sha256:8a371b4f244854b51a1d6bed1ae8922963f0c5eb8de133392e651901fc65fdb4"
    enabled = true

    [hooks.state.'C:\Users\jc\.codex\hooks.json:permission_request:0:0']
    trusted_hash = "sha256:ccf52ec6c56ba31d360d1dd7b767c2a13eba2e2329b254a40247e455fbcb244b"
    enabled = true

    [hooks.state.'C:\Users\jc\.codex\hooks.json:permission_request:0:1']
    trusted_hash = "sha256:074c93e0861886842a1e27289c080dd52750304d27ba74a6a327cecdb863b0f8"
    enabled = true

    [hooks.state.'C:\Users\jc\.codex\hooks.json:user_prompt_submit:0:0']
    trusted_hash = "sha256:c681fec74f15ba550f8fc6f88d3fd3659617e900665fde1c51fbf38f4548625f"
    enabled = false

    [hooks.state.'C:\Users\jc\.codex\hooks.json:pre_tool_use:0:0']
    trusted_hash = "sha256:55343a767ba304604202bae8b9ec20441eaa855f333da877f75c9444b0aa27aa"

    [hooks.state.'C:\Users\jc\.codex\hooks.json:stop:0:1']
    trusted_hash = "sha256:ddad782e17c27c089c2cd000025f580459a27c6f2ecdf8de6acd1480f48bbd95"
    enabled = true

    [hooks.state.'C:\Users\jc\.codex\hooks.json:post_tool_use:0:0']
    trusted_hash = "sha256:dbbbf7b11b76fc4b654ff8a8b512d86e1f25a543aafa4300f59a5a3a43d6dba9"

    [hooks.state.'C:\Users\jc\.codex\hooks.json:user_prompt_submit:0:1']
    trusted_hash = "sha256:4755d6aedad83ce7596a5b5dbfc68a9a15f427bcd7bead116a987a102f26b8c3"

    [hooks.state.'C:\Users\jc\.codex\hooks.json:session_start:0:0']
    trusted_hash = "sha256:77e32e79e6f804f4af5635655b810c0d522690892987b82d45514eb98558e38f"

    [hooks.state.'C:\Users\jc\.codex\hooks.json:stop:0:2']
    trusted_hash = "sha256:3c44047b82ef679734a6a5d83e80148e5d29cd5924352ca4cc1f7c6d6d3ff0f9"
    enabled = true

    [hooks.state.'C:\Users\jc\.codex\hooks.json:user_prompt_submit:1:0']
    trusted_hash = "sha256:7a450f2c2bab614b71305693337237dc8de28ca5346aac06ef6d15bc9e8dd557"
    [hooks.state.'C:\Users\jc\.codex\hooks.json:permission_request:0:2']
    trusted_hash = "sha256:76e464f33ecf698d2f7d702b77919589d3691e2f2da17543c492fe012953cd25"
    enabled = true

    [hooks.state.'C:\Users\jc\.codex\hooks.json:stop:1:0']
    trusted_hash = "sha256:18cd1762ce9e87abd859d4dcf83d80fdf1c4d418b06d6c7361037c0167244562"
    [hooks.state.'C:\Users\jc\.codex\hooks.json:user_prompt_submit:0:2']
    trusted_hash = "sha256:ebf18d381a7c202decc93ae8f423a0fac0e578296457eeda5a9a1ae1162bf697"
    enabled = true

    [hooks.state."ponytail@ponytail:hooks/claude-codex-hooks.json:session_start:0:0"]
    trusted_hash = "sha256:5f81d38f47448a1581c08ec877e044d9e04dd6f814dce3f2671f7a8edadd719b"
    enabled = true

    [hooks.state."ponytail@ponytail:hooks/claude-codex-hooks.json:user_prompt_submit:0:0"]
    trusted_hash = "sha256:6a6f42bc3b58d6262db38bfd74d7f340fcca2b09cdb134aad365063f0bfefca4"
    enabled = true

    [hooks.state."ponytail@ponytail:hooks/claude-codex-hooks.json:subagent_start:0:0"]
    trusted_hash = "sha256:1423b56c1322f96c8f74c51c1e7ae9a047b904c1fa43ee9165d462fd7a6e70ef"
    enabled = true

    [hooks.state.'C:\Users\jc\.codex\hooks.json:pre_tool_use:1:0']
    trusted_hash = "sha256:0d23e0d75c7c445ac0fa3e77d76d483b6e3d7df0ebd3806306d7fc0330b012a3"

    [hooks.state.'C:\Users\jc\.codex\hooks.json:permission_request:1:0']
    trusted_hash = "sha256:c115583518c7c6b9745a072dcd773a18270b2105889e55e18c072fd90b08301d"

    [hooks.state.'C:\Users\jc\.codex\hooks.json:post_tool_use:1:0']
    trusted_hash = "sha256:c13660a74616ab59610dab03f4fd7e6ef5872180ce075bd3fe5c698131f3442d"

    [hooks.state.'C:\Users\jc\.codex\hooks.json:session_start:1:0']
    trusted_hash = "sha256:16e7abe0030ec6613cfc955146925135d414c715c1f0071670fd697edd983fb5"

    [hooks.state.'C:\Users\jc\.codex\hooks.json:user_prompt_submit:2:0']
    trusted_hash = "sha256:596fa3647e9575712938045c0f30c3b1d2c3a2f005ccccddac9c0ff6d24c42e7"

    [hooks.state.'C:\Users\jc\.codex\hooks.json:stop:2:0']
    trusted_hash = "sha256:2e5589cd0470b0080533b3cc9c92c9e43e9575559ad5c3f50ef53ea78fadb3d2"
    [plugins."browser@openai-bundled"]
    enabled = true

    [computer_use.windows.always_allowed_app_ids]
    Chrome = true

    [[skills.config]]
    path = 'C:\Users\jc\.codex\skills\ant-manor-adb\SKILL.md'
    enabled = false

    [mcp_servers]

    [mcp_servers.excel]
    type = "stdio"
    command = "cmd"
    args = ["/c", "npx", "--yes", "@negokaz/excel-mcp-server"]

    [mcp_servers.excel.env]
    EXCEL_MCP_PAGING_CELLS_LIMIT = "4000"

    [mcp_servers.mui-mcp]
    type = "stdio"
    command = "cmd"
    args = ["/c", "npx", "-y", "@mui/mcp@latest"]

    [mcp_servers.mysql]
    type = "stdio"
    command = "cmd"
    args = ["/c", 'C:\\Users\\jc\\Desktop\\luang\\mcp\\mysql-mcp-wrapper.bat']

    [mcp_servers.node_repl]
    type = "stdio"
    command = 'C:\Users\jc\AppData\Local\OpenAI\Codex\bin\34ab3e1324cc55b5\node_repl.exe'
    startup_timeout_sec = 120

    [mcp_servers.node_repl.env]
    NODE_REPL_NATIVE_PIPE_CONNECT_TIMEOUT_MS = "1000"
    NODE_REPL_NODE_MODULE_DIRS = 'C:\Users\jc\.codex\plugins\cache\openai-bundled\computer-use\26.527.31326\node_modules'
    NODE_REPL_NODE_PATH = 'C:\Users\jc\AppData\Local\OpenAI\Codex\bin\5b9024f90663758b\node.exe'
    NODE_REPL_TRUSTED_CODE_PATHS = 'C:\Users\jc\.codex'
    CODEX_HOME = 'C:\Users\jc\.codex'
    NODE_REPL_TRUSTED_BROWSER_CLIENT_SHA256S = "0b0d41e7a14a4903d2f95b0b3f427ed796b12c8edca2fa392a03df43997075ae,e13c388c2427308a68dffc803e1f28316077b719672e4518a621ae6ab56ad7cf"
    BROWSER_USE_AVAILABLE_BACKENDS = "chrome,iab"
    NODE_REPL_INSTRUCTIONS_USE_CASE_BROWSER = "Control the in-app browser in conjunction with the Browser Plugin."
    NODE_REPL_INSTRUCTIONS_USE_CASE_CHROME = "Control the Chrome browser in conjunction with the Chrome Plugin. Prefer this method of controlling Chrome over alternatives (such as Computer Use) unless the user explicitly mentions an alternative."
    BROWSER_USE_CODEX_APP_BUILD_FLAVOR = "prod"
    CODEX_CLI_PATH = 'C:\Users\jc\AppData\Local\OpenAI\Codex\bin\7dea4a003bc76627\codex.exe'

    [mcp_servers.notion]
    type = "http"
    url = "https://mcp.notion.com/mcp"

    [projects.'c:\users\jc\documents\codex\2026-08-27\new-chat']
    trust_level = "trusted"

    [projects.'c:\users\jc\desktop\luang\hotel-manage']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-27\realtime-voice-chat-5']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-27\zhe']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-27\https-github-com-2977094657-https-github']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-27\ni-ba']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-27\realtime-voice-chat-6']
    trust_level = "trusted"

    [projects.'c:\users\jc']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-27\c-users-jc-downloads-leveldatastudio-1']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-27\bang']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-27\realtime-voice-chat-7']
    trust_level = "trusted"

    [projects.'c:\users\jc\desktop\luang\highway-maintenance-2026']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-27\realtime-voice-chat-8']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex']
    trust_level = "trusted"

    [projects.'\\?\unc\183.250.165.231\e\services\hotel-manage']
    trust_level = "trusted"

    [projects.'c:\users\jc\desktop\luang\demo\sub2api-source']
    trust_level = "trusted"

    [projects.'c:\users\jc\desktop\luang\demo\audio-transcriber']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-28\ponytail-plugin-ponytail-ponytail-use-ponytail']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-28\jsonl']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-28\b-pr-up']
    trust_level = "trusted"

    [projects.'c:\users\jc\desktop\luang\demo\weclaw']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-30\highway-workspace-cleanup-20260830']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-30\verify-release-plugin-git']
    trust_level = "trusted"

    [projects.'c:\users\jc\desktop\luang\roadway-maintenance-2025']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-31\wei']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-31\wei-j']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-31\wei-j-2']
    trust_level = "trusted"

    [projects.'c:\users\jc\desktop\luang\demo\codex-useage-win']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-31\build-a-little-pixel-art-platformer']
    trust_level = "trusted"

    [projects.'c:\users\jc\desktop\luang\highway-maintenance-android-2026']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-08-31\2025-sites-project-appgprj-6a9531e8d030819190cc36aa27fd5533']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-09-01\new-chat-3']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-09-01\new-chat-4']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-09-01\new-chat-5']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-09-01\new-chat-6']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-09-01\realtime-voice-chat-3']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-09-01\new-chat-7']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-09-01\realtime-voice-chat-4']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-09-01\new-chat-8']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-09-01\x20-called-x20-idea-apply-patch']
    trust_level = "trusted"

    [projects.'c:\users\jc\documents\codex\2026-09-01\ce-sh']
    trust_level = "trusted"

    [plugins."chrome@openai-bundled"]
    enabled = true

    [plugins."codex-app-tools@openai-bundled"]
    enabled = true

    [plugins."ponytail@ponytail"]
    enabled = true

    [plugins."sites@openai-bundled"]
    enabled = true

  • 迷糊.YOU 09-02 17:06
    3

    你这个sub2api显示的什么响应呢?流式响应吗?^-^我不加那个参数就和你一样,加了才正常

  • 楼主 09-02 17:13
    4

    https://chatgpt.com/s/cx_6a97e84c0b5081918f0aeb4513f1b2e5


    可以蛮看看这个呢,这是我官号排查的结果,分享的对话链接,我现在也在抽空排查,sub2api没动过任何配置呢,别人用我的站都可以用,我自己电脑不行

* 帖子来源Linux.do
返回