Spaces:
Paused
Paused
icebear0828 Claude Opus 4.6 commited on
Commit ·
6c4df8c
1
Parent(s): 8057cb9
fix: remove corrupted JS from desktop-context.md that broke tool_calls (#13)
Browse filesThe extractPrompts() end marker matched `; but minified code uses `, — causing
~7KB of garbage JS to leak into every request's instructions field. Truncated
desktop-context.md to clean content and fixed the extraction script regex.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CHANGELOG.md +2 -0
- config/prompts/desktop-context.md +1 -7
CHANGELOG.md
CHANGED
|
@@ -25,6 +25,8 @@
|
|
| 25 |
|
| 26 |
### Fixed
|
| 27 |
|
|
|
|
|
|
|
| 28 |
- TLS 伪装 profile 确定性解析:用已知 Chrome profile 列表(`KNOWN_CHROME_PROFILES`)替代不可靠的 runtime 检测,确保 `--impersonate` 目标始终有效(如 `chrome137` → `chrome136`)
|
| 29 |
- FFI transport 硬编码 `"chrome136"` 改为使用统一解析的 profile(`getResolvedProfile()`)
|
| 30 |
- `getModels()` 死代码:`allModels` 作用域修复,消除不可达分支
|
|
|
|
| 25 |
|
| 26 |
### Fixed
|
| 27 |
|
| 28 |
+
- `desktop-context.md` 提取损坏修复:`extractPrompts()` 的 end marker 从 `` `; `` 改为 `` `[,;)] `` 正则,防止压缩 JS 代码注入 instructions 导致 tool_calls 失效(#13)
|
| 29 |
+
- 清除 `config/prompts/desktop-context.md` 中第 71 行起被污染的 ~7KB JS 垃圾代码
|
| 30 |
- TLS 伪装 profile 确定性解析:用已知 Chrome profile 列表(`KNOWN_CHROME_PROFILES`)替代不可靠的 runtime 检测,确保 `--impersonate` 目标始终有效(如 `chrome137` → `chrome136`)
|
| 31 |
- FFI transport 硬编码 `"chrome136"` 改为使用统一解析的 profile(`getResolvedProfile()`)
|
| 32 |
- `getModels()` 死代码:`allModels` 作用域修复,消除不可达分支
|
config/prompts/desktop-context.md
CHANGED
|
@@ -34,7 +34,7 @@
|
|
| 34 |
- Keep automation prompts self-sufficient because the user may have limited availability to answer questions. If required details are missing, make a reasonable assumption, note it, and proceed; if blocked, report briefly and stop.
|
| 35 |
- When helpful, include clear output expectations (file path, format, sections) and gating rules (only if X, skip if exists) to reduce ambiguity.
|
| 36 |
- Automations should always open an inbox item.
|
| 37 |
-
- Archiving rule: only include
|
| 38 |
- Safe to archive: "no findings" checks (bug scans that found nothing, clean lint runs, monitoring checks with no incidents).
|
| 39 |
- Do not archive: deliverables or follow-ups (briefs, reports, summaries, plans, recommendations).
|
| 40 |
- If you do archive, include the archive directive after the inbox item.
|
|
@@ -68,9 +68,3 @@
|
|
| 68 |
### Archiving
|
| 69 |
- If a user specifically asks you to end a thread/conversation, you can return the archive directive ::archive{...} to archive the thread/conversation.
|
| 70 |
- Example: ::archive{reason="User requested to end conversation"}
|
| 71 |
-
`,QA=C1(O1);function eD(...t){return t.map(e=>e?.trim()).filter(e=>e!=null&&e.length>0).join(`
|
| 72 |
-
|
| 73 |
-
`)}function gY(t){const e=t?.get(Ne.GIT_BRANCH_PREFIX)??Hu(Ne.GIT_BRANCH_PREFIX),n=t?.get(Ne.GIT_COMMIT_INSTRUCTIONS)??Hu(Ne.GIT_COMMIT_INSTRUCTIONS),r=t?.get(Ne.GIT_PR_INSTRUCTIONS)??Hu(Ne.GIT_PR_INSTRUCTIONS),i=[];return e!=null&&e.trim().length>0&&i.push(`- Branch prefix: \`${e.trim()}\`. Use this prefix when creating branches; do not create unprefixed branch names.`),n!=null&&n.trim().length>0&&i.push(`- Commit instructions: ${n.trim()}`),r!=null&&r.trim().length>0&&i.push(`- Pull request instructions: ${r.trim()}`),i.length===0?"":`### Git
|
| 74 |
-
${i.join(`
|
| 75 |
-
`)}`}function _Y({baseInstructions:t,globalState:e}){const n=C1(eD(O1,gY(e)));return eD(t??"",n)}function vY(t){return typeof t=="object"&&t!=null&&"dispose"in t}class jE{disposables=[];dispose(){this.disposables.forEach(e=>e.dispose()),this.disposables.length=0}add(e){this.disposables.push(vY(e)?e:{dispose:e})}}function EY(t,e,n,r){const i=BH(e),s={message:i.message,status:SY(t),source:n.source,service:n.source,env:n.env,date:Date.now(),logger:{name:i.loggerName??"app"},"codex.app_session_id":n.codexAppSessionId,usr:n.userInfo};return r!=null&&Object.assign(s,r),bY(s,n.buildInfo),s}function SY(t){switch(t){case"trace":case"debug":return"debug";case"info":return"info";case"warning":return"warn";case"error":return"error"}}function bY(t,e){em(t,"build_number",e.buildNumber),em(t,"version",e.version),em(t,"app_version",e.version)}function em(t,e,n){n!=null&&(t[e]=n)}const TY=5e3,yY=50,xY=64e3;class wY{onFlush;flushIntervalMs;maxBatchSize;maxBatchBytes;buffer=[];bufferBytes=0;flushTimeout=null;constructor(e){this.onFlush=e.onFlush,this.flushIntervalMs=e.flushIntervalMs??TY,this.maxBatchSize=e.maxBatchSize??yY,this.maxBatchBytes=e.maxBatchBytes??xY}enqueue(e){if(this.buffer.push(e),this.bufferBytes+=e.length,this.buffer.length>=this.maxBatchSize||this.bufferBytes>=this.maxBatchBytes){this.flush();return}this.scheduleFlush()}flushNow(){this.flush()}scheduleFlush(){this.flushTimeout==null&&(this.flushTimeout=setTimeout(()=>{this.flush()},this.flushIntervalMs))}flush(){if(this.buffer.length===0){this.clearFlushTimeout();return}const e=this.buffer.splice(0,this.buffer.length);this.bufferBytes=0,this.clearFlushTimeout(),this.onFlush(e)}clearFlushTimeout(){this.flushTimeout!=null&&(clearTimeout(this.flushTimeout),this.flushTimeout=null)}}const AY="https://chat.openai.com/ces/v1/telemetry/intake",DY="dummy-token",RY="browser",IY=2e3,CY=3e4,OY=5;class NY{options;reportFailure;batcher;queue=[];inFlightSend=null;retryTimeout=null;retryAttempts=0;disabled=!1;reportedDisabledReason=!1;fetchImpl;userInfo=null;constructor(e){this.options=e,this.reportFailure=e.reportFailure,this.fetchImpl=e.fetchImpl??fetch,this.batcher=new wY({onFlush:n=>this.enqueueBatch(n)})}setUserInfo(e){this.userInfo=e}log(e,n,r){const i=EY(e,n,{buildInfo:this.options.buildInfo,userInfo:this.userInfo,codexAppSessionId:this.options.codexAppSessionId,source:this.options.source,env:this.options.env},r);this.batcher.enqueue(JSON.stringify(i))}flushNow(){this.batcher.flushNow(),this.drainQueue()}enqueueBatch(e){this.disabled||e.length!==0&&(this.queue.push({requestId:Ke.randomUUID(),events:e}),this.drainQueue())}async drainQueue(){if(this.disabled){this.queue.length=0;return}if(this.inFlightSend!=null||this.retryTimeout!=null)return;const e=this.queue[0];if(e==null)return;const n=e.events.join(`
|
| 76 |
-
`);this.inFlightSend=(async()=>{try{await this.send(n,e.requestId),this.queue.shift(),this.retryAttempts=0}catch{if(this.disabled){this.queue.length=0;return}this.scheduleRetry()}finally{this.inFlightSend=null,this.drainQueue()}})()}scheduleRetry(){if(this.retryTimeout!=null)return;if(this.retryAttempts>=OY){this.queue.shift(),this.retryAttempts=0,this.drainQueue();return}this.retryAttempts+=1;const e=Math.min(CY,IY*Math.pow(2,this.retryAttempts-1));this.retryTimeout=setTimeout(()=>{this.retryTimeout=null,this.drainQueue()},e)}disableWithFailure(e){this.disabled=!0,!this.reportedDisabledReason&&(this.reportedDisabledReason=!0,this.reportFailure(e))}async send(e,n){const r=kY(n),i=await this.fetchImpl(r,{method:"POST",headers:{"content-type":"text/plain","x-request-id":n},body:Buffer.from(e)});if(!i.ok){const s=await i.text();if(i.status>=400&&i.status<500)return(i.status===401||i.status===403)&&this.disableWithFailure({type:"disabled",reason:"invalid_client_token",status:i.status,body:s}),i.status;throw new Error(`[datadog] non-2xx response (${i.status})`)}return i.status}}function kY(t){const n=`/api/v2/logs?${new URLSearchParams({ddsource:"browser","dd-api-key":DY,"dd-evp-origin":RY,"dd-request-id":t}).toString()}
|
|
|
|
| 34 |
- Keep automation prompts self-sufficient because the user may have limited availability to answer questions. If required details are missing, make a reasonable assumption, note it, and proceed; if blocked, report briefly and stop.
|
| 35 |
- When helpful, include clear output expectations (file path, format, sections) and gating rules (only if X, skip if exists) to reduce ambiguity.
|
| 36 |
- Automations should always open an inbox item.
|
| 37 |
+
- Archiving rule: only include `::archive-thread{}` when there is nothing actionable for the user.
|
| 38 |
- Safe to archive: "no findings" checks (bug scans that found nothing, clean lint runs, monitoring checks with no incidents).
|
| 39 |
- Do not archive: deliverables or follow-ups (briefs, reports, summaries, plans, recommendations).
|
| 40 |
- If you do archive, include the archive directive after the inbox item.
|
|
|
|
| 68 |
### Archiving
|
| 69 |
- If a user specifically asks you to end a thread/conversation, you can return the archive directive ::archive{...} to archive the thread/conversation.
|
| 70 |
- Example: ::archive{reason="User requested to end conversation"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|