Repository navigation
Commit 2ee9784
fix(server): Codex resumes a thread that is still closing after unsubscribe
With thread_unload_delay_secs=0, Codex replies to thread/unsubscribe before its
unload finishes and rejects thread/resume with "thread <id> is closing" until it
emits thread/closed. The linked-environment reload (unsubscribe, then resume)
failed the turn when it hit that window.
unloadThread now arms a per-thread signal that the existing thread/closed handler
completes. On the closing error, resumeNativeThread waits for it (at most 10
seconds, not at all when the thread already closed) and resumes once more.
AI-assisted; verified with the tests and tools listed above.
Co-Authored-By: Claude Opus 5.5 <[email protected]>1 parent 5e90d1e commit 2ee9784
3 files changed
Lines changed: 127 additions & 8 deletions
File tree
- apps/server/src
- orchestration-v2/Adapters
- provider
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3094 | 3094 | | |
3095 | 3095 | | |
3096 | 3096 | | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
| 3114 | + | |
| 3115 | + | |
| 3116 | + | |
| 3117 | + | |
| 3118 | + | |
| 3119 | + | |
| 3120 | + | |
| 3121 | + | |
| 3122 | + | |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
| 3139 | + | |
| 3140 | + | |
| 3141 | + | |
| 3142 | + | |
| 3143 | + | |
| 3144 | + | |
| 3145 | + | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
3097 | 3200 | | |
3098 | 3201 | | |
3099 | 3202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1935 | 1935 | | |
1936 | 1936 | | |
1937 | 1937 | | |
| 1938 | + | |
| 1939 | + | |
1938 | 1940 | | |
1939 | 1941 | | |
1940 | 1942 | | |
| |||
4868 | 4870 | | |
4869 | 4871 | | |
4870 | 4872 | | |
| 4873 | + | |
| 4874 | + | |
| 4875 | + | |
4871 | 4876 | | |
4872 | 4877 | | |
4873 | 4878 | | |
| |||
6826 | 6831 | | |
6827 | 6832 | | |
6828 | 6833 | | |
6829 | | - | |
| 6834 | + | |
| 6835 | + | |
6830 | 6836 | | |
6831 | 6837 | | |
6832 | 6838 | | |
6833 | 6839 | | |
6834 | 6840 | | |
6835 | 6841 | | |
6836 | 6842 | | |
6837 | | - | |
6838 | | - | |
6839 | | - | |
6840 | | - | |
6841 | | - | |
6842 | | - | |
| 6843 | + | |
| 6844 | + | |
| 6845 | + | |
| 6846 | + | |
| 6847 | + | |
| 6848 | + | |
| 6849 | + | |
| 6850 | + | |
| 6851 | + | |
| 6852 | + | |
| 6853 | + | |
| 6854 | + | |
| 6855 | + | |
| 6856 | + | |
| 6857 | + | |
| 6858 | + | |
6843 | 6859 | | |
6844 | 6860 | | |
6845 | 6861 | | |
| |||
7381 | 7397 | | |
7382 | 7398 | | |
7383 | 7399 | | |
| 7400 | + | |
7384 | 7401 | | |
7385 | 7402 | | |
7386 | 7403 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
0 commit comments