Skip to content

[codex] fix Trae SOLO message sending#2

Open
Winn1y wants to merge 1 commit into
vilmire:mainfrom
Winn1y:codex-fix-trae-solo-send
Open

[codex] fix Trae SOLO message sending#2
Winn1y wants to merge 1 commit into
vilmire:mainfrom
Winn1y:codex-fix-trae-solo-send

Conversation

@Winn1y

@Winn1y Winn1y commented May 23, 2026

Copy link
Copy Markdown

Summary

  • 修复 Trae SOLO 模式下消息已发送后,daemon 自动确认误点终止/取消类按钮的问题。
  • 自动确认现在会跳过 Stop/Cancel/Terminate 等破坏性按钮,并优先选择安全按钮。
  • 补充 approval-utils 覆盖 destructive button 的单测。

Root Cause

Trae SOLO 发送后会进入生成态并显示终止类操作;原先自动确认逻辑在没有匹配到正向按钮时会回退点击第一个按钮,导致消息明明已发出却被自动终止。

Validation

  • node adhdev-providers\tests\trae-send-message.test.js
  • node adhdev-providers\validate.js adhdev-providers\ide\trae\provider.json
  • npm.cmd run test -w packages/daemon-core -- approval-utils.test.ts
  • npm.cmd run typecheck -w packages/daemon-core

@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@Winn1y Winn1y marked this pull request as ready for review May 23, 2026 12:08

@vilmire vilmire left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-wise LGTM. I reviewed the diff and validated locally with:

  • npm run test -w packages/daemon-core -- approval-utils.test.ts
  • npm run typecheck -w packages/daemon-core
  • npm run test -w packages/daemon-core
  • npm run build -w packages/daemon-core

The PR correctly avoids auto-approving destructive Stop/Cancel/Terminate-style buttons and covers the unsafe-button behavior in tests.

Merge is still blocked by the failing CLA check. Please sign the CLA by commenting exactly:

I have read the CLA Document and I hereby sign the CLA

Once the CLA check passes, this should be safe to merge.

@Winn1y

Winn1y commented May 24, 2026

Copy link
Copy Markdown
Author

Do I need to do anything? @vilmire

@Winn1y Winn1y force-pushed the codex-fix-trae-solo-send branch from d32eb0e to 2bb6540 Compare May 24, 2026 20:32
@vilmire

vilmire commented May 25, 2026

Copy link
Copy Markdown
Owner

@Winn1y Yes — the only required action right now is to sign the CLA.

Please add a new PR comment with exactly this text:

I have read the CLA Document and I hereby sign the CLA

After the CLA bot marks this as signed, I can continue with the review/merge process. Thanks!

Example:
image

vilmire added a commit that referenced this pull request Jun 1, 2026
…s file, pending guard, cooldown sweep

appendRemoteLedgerEntries (#1):
- dedup now uses tail:1000 instead of full O(n) readLedgerEntries;
  P2P replication is cursor-based so duplicates appear in the recent tail

Archive rotation (#4):
- compactLedger now rotates .archive.jsonl to .archive.N.jsonl (max 5)
  when the archive exceeds 50MB before appending new entries

Worker JSON extraction validation (#5):
- extractJsonObjectFromSummary now requires at least one mesh worker result
  field (changedFiles|errors|gitStatus|nextAction|validationResults) before
  accepting a JSON block; prevents false positives from tool/log JSON in
  the final summary

Archived counts file (#6):
- compactLedger writes cumulative counts to <meshId>.archived-counts.json
- getLedgerSummary reads and merges archived counts so taskCompleted/Failed/
  Stalled and totalEntries are accurate even after compaction

Pending events size guard (#2):
- queuePendingMeshCoordinatorEvent trims the pending-events.jsonl to the
  last 50 events when it exceeds 100KB before appending; prevents unbounded
  growth when coordinator stops draining

autoLaunchCooldownUntil cleanup (#3):
- sweepExpiredCooldowns() removes expired entries from the cooldown Map
  whenever a new cooldown is set; inline check at read site also cleans up
  the checked key; prevents long-lived daemon Map accumulation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
vilmire added a commit that referenced this pull request Jun 1, 2026
…ntext tail bound

Atomic drain (#1):
- drainPendingMeshCoordinatorEvents: rename-then-read with atomicDrainFile()
  so concurrent coordinators cannot both consume the same pending events file.
  renameSync is atomic on POSIX: only one caller wins; the other returns null
  and gets an empty result, eliminating duplicate event delivery.

Ledger read cache (#3):
- readLedgerEntries: 100ms TTL in-process cache via getCachedRawEntries().
  Absorbs repeated reads within a single event-processing burst (agent:stopped
  triggers 4+ ledger reads for the same file in one synchronous cycle).
- invalidateLedgerCache() called on every write: appendLedgerEntry,
  appendRemoteLedgerEntries, compactLedger — ensures readers always see fresh
  data after any mutation.
- Cache is keyed by meshId (not opts), with filters applied to the cached slice.

getSessionRecoveryContext tail bound (#2):
- Bounded to tail:500 instead of full O(n) scan. task_dispatched is never
  archived (ARCHIVABLE_KINDS excludes it), so dispatch history is always
  present in the active file. The 30-min failure window means consecutiveNode-
  Failures never needs deep history. tail:500 covers all realistic use cases.

Tests: 7 new tests (4 cache, 3 atomic drain), all 92 mesh tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants