Skip to content

iter57 cluster-065: Lark CardKit Task.Run signal-only + actor-side rich continuation (#939)#940

Merged
loning merged 2 commits into
auto-refact-devfrom
refactor/iter57-cluster-065-lark-card-signal-only
May 24, 2026
Merged

iter57 cluster-065: Lark CardKit Task.Run signal-only + actor-side rich continuation (#939)#940
loning merged 2 commits into
auto-refact-devfrom
refactor/iter57-cluster-065-lark-card-signal-only

Conversation

@loning
Copy link
Copy Markdown
Contributor

@loning loning commented May 24, 2026

摘要

iter57 cluster-065(severity:high)— Lark CardKit Task.Run signal-only + actor-side rich continuation

  • Old:ConversationGAgent.LarkCardStreaming.cs:367,426,494 三个 Task.Run helper 在 actor turn 外构造 rich continuation(错误码 classification、summary、card_id mapping、timestamps),违反 "Actor 单线程事实边界"
  • New:helper 改 signal-only(operation_id + minimal raw result),所有 rich continuation 在 actor handler 拼装;新增 typed LarkCardOperationCompletedEvent proto event

违反:CLAUDE.md「Actor 设计 / 生命周期 / 执行模型 — 回调只发信号」「业务推进内聚」

Phase 9 共识链路

Round Verdict
r1 converge:in-file narrowing vs scheduler port
r2 converge:signal-only Task.Run vs scheduler
r3 escalate:stalled:no-progress
reflector r1 META_RESOLVED:retry-fix(CLAUDE "回调只发信号" 已覆盖 signal-only,narrow 到 rich continuation 构造点)
r4 META_JUDGE_DONE:consensus:structural

详见 issue #939

Scope

  • agents/Aevatar.GAgents.Channel.Runtime/Conversation/ConversationGAgent.LarkCardStreaming.cs(+/− major)
  • agents/Aevatar.GAgents.Channel.Runtime/protos/conversation_events.proto(新 LarkCardOperationCompletedEvent typed event)
  • test/Aevatar.GAgents.ChannelRuntime.Tests/LarkCardOperationSignalTests.cs(新)
  • test/Aevatar.GAgents.Channel.Protocol.Tests/ConversationGAgentDedupTests.cs
  • tools/ci/architecture_guards.sh(新增 source guard)

5 files changed, +886 / −315。

local PASS:architecture_guards + test_stability_guards + LarkCard unit tests(2 passed)

closes #939

🤖 Generated with Claude Code via codex-refactor-loop iter57

⟦AI:AUTO-LOOP⟧

…ch continuation (#939)

Phase 9 r4 consensus(structural framing,reflector retry-fix narrowing 后):
- Task.Run helpers 改 signal-only(operation_id + minimal raw result)
- Rich continuation(错误码/字段 mapping/timestamps)全在 actor handler 拼装
- typed LarkCardOperationCompletedEvent proto event 替代原 helper 内 rich continuation
- architecture_guards.sh 新增 source guard 防 helper 内业务 mapping
- 补 unit test 覆盖 signal-only payload + actor-side reconstruction

closes #939
local PASS:architecture + test_stability + LarkCard unit tests(2 passed)

⟦AI:AUTO-LOOP⟧
@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 24, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr940-omnibus-r1.log
工作目录 /Users/auric/aevatar
timeout 5400s(~90 min 上限)
上下文 omnibus r1 reviewer 派出(架构/测试/质量综合)
下一步自动会做 1. 三 reviewer 完成 verdict marker 2. controller 计算 consensus 3. unanimous → auto-merge / reject → fix r<N+1>
是否需要人介入 ❌ 否(自动推进)

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 24, 2026

📊 状态卡片 — fix 派出

维度
阶段 派出 codex(role=fix)
codex log fix-pr940-r2.log
工作目录 /Users/auric/aevatar
timeout 5400s(~90 min 上限)
上下文 r1 comment(guard awk brace_depth=0 早退失效)→ fix r2 修 guard
下一步自动会做 1. fix r 完成 marker FIX_DONE:... 2. controller commit + push 3. 派 reviewer r<N+1>
是否需要人介入 ❌ 否(自动推进)

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 24, 2026

📊 codex 进展 review-pr940-omnibus-r1 (⏳ 进行中; 已跑 5 min)

`comment` - [architecture_guards.sh](/Users/auric/aevatar/tools/ci/architecture_guards.sh:1273) 的新增 Lark CardKit source guard 当前基本失效。`awk` 在匹配到 `private async Task ExecuteLarkCard*OperationAsync` 签名行后,`brace_depth` 仍为 0,于是 [line 1285](/Users/auric/aevatar/tools/ci/architecture_guards.sh:1285) 立即退出扫描,实际不会进入方法体检查。  
我本地直接运行该 `awk` 片段,输出为空;但同一文件方法体内确实存在 guard pattern 会匹配的字段赋值,例如 [ConversationGAgent.LarkCardStreaming.cs](/Users/auric/aevatar/agents/Aevatar.GAgents.Channel.Runtime/Conversation/ConversationGAgent.LarkCardStreaming.cs:583) 的 `CardMessageId = cardMessageId`。这意味着后续把 rich continuation mapping 放回 helper 时,guard 可能不会拦住。

功能代码本身看起来符合主要方向:Task.Run helper 发 `LarkCardOperationCompletedEvent`,actor handler 重建 rich continuation,未扩到 Nyx / AgentRun。测试覆盖了 signal payload 和 actor reconstruction。

验证:
`dotnet test test/Aevatar.GAgents.ChannelRuntime.Tests/Aevatar.GAgents.ChannelRuntime.Tests.csproj --filter LarkCardOperationSignalTests --nologo` 通过,2/2。  
`bash tools/ci/test_stability_guards.sh` 通过。  
GitHub checks 查询时 `fast-gates`、`slow-test-guards` 已通过,`coverage-quality`、`event-sourcing-regression`、`host-composition-smoke` 仍 pending。

REVIEW_DONE:940:omnibus:comment  
⟦AI:AUTO-LOOP⟧
tokens used
155,951
**Finding**

`comment` - [architecture_guards.sh](/Users/auric/aevatar/tools/ci/architecture_guards.sh:1273) 的新增 Lark CardKit source guard 当前基本失效。`awk` 在匹配到 `private async Task ExecuteLarkCard*OperationAsync` 签名行后,`brace_depth` 仍为 0,于是 [line 1285](/Users/auric/aevatar/tools/ci/architecture_guards.sh:1285) 立即退出扫描,实际不会进入方法体检查。  
我本地直接运行该 `awk` 片段,输出为空;但同一文件方法体内确实存在 guard pattern 会匹配的字段赋值,例如 [ConversationGAgent.LarkCardStreaming.cs](/Users/auric/aevatar/agents/Aevatar.GAgents.Channel.Runtime/Conversation/ConversationGAgent.LarkCardStreaming.cs:583) 的 `CardMessageId = cardMessageId`。这意味着后续把 rich continuation mapping 放回 helper 时,guard 可能不会拦住。

功能代码本身看起来符合主要方向:Task.Run helper 发 `LarkCardOperationCompletedEvent`,actor handler 重建 rich continuation,未扩到 Nyx / AgentRun。测试覆盖了 signal payload 和 actor reconstruction。

验证:
`dotnet test test/Aevatar.GAgents.ChannelRuntime.Tests/Aevatar.GAgents.ChannelRuntime.Tests.csproj --filter LarkCardOperationSignalTests --nologo` 通过,2/2。  
`bash tools/ci/test_stability_guards.sh` 通过。  
GitHub checks 查询时 `fast-gates`、`slow-test-guards` 已通过,`coverage-quality`、`event-sourcing-regression`、`host-composition-smoke` 仍 pending。

自动更新每 10 分钟;edit-in-place 不堆评论;codex 完成后此 comment 自动删除(per Auric "完成后删掉就好了 否则太占空间")。
🤖 controller progress reporter

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 24, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr940-omnibus-r3.log
工作目录 /Users/auric/aevatar
timeout 5400s(~90 min 上限)
上下文 fix r2 done → omnibus r3 reviewer 验证 guard 修对
下一步自动会做 1. 三 reviewer 完成 verdict marker 2. controller 计算 consensus 3. unanimous → auto-merge / reject → fix r<N+1>
是否需要人介入 ❌ 否(自动推进)

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 24, 2026

Verified r3 against head 10c8eb3.

Checks performed:

  • Baseline bash tools/ci/architecture_guards.sh passes on PR head.
  • Temporary ErrorCode = "create_threw" helper probe fails the guard at the inserted line.
  • Temporary CardMessageId = "mapped-outside-signal" helper probe fails the guard at the inserted line.
  • Temporary DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() helper probe fails the guard at the inserted line.
  • After removing probes, git status --short is clean, git diff --check passes, and bash tools/ci/architecture_guards.sh passes again.

Verdict: approve.

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 24, 2026

📊 codex 进展 review-pr940-omnibus-r3 (⏳ 进行中; 已跑 8 min)


codex
approve

Verified PR #940 r3 head `10c8eb32`. `architecture_guards.sh` now enters the helper method body and catches temporary probes for:

- `ErrorCode = "create_threw"`
- `CardMessageId = "mapped-outside-signal"`
- `DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()`

After removing probes, worktree is clean, `git diff --check` passes, and `bash tools/ci/architecture_guards.sh` passes. Formal approve was blocked by GitHub because the authenticated account owns the PR, so I posted the approve verdict as a PR comment: https://github.com/aevatarAI/aevatar/pull/940#issuecomment-4527120622

REVIEW_DONE:940:omnibus:approve
⟦AI:AUTO-LOOP⟧
tokens used
92,488
approve

Verified PR #940 r3 head `10c8eb32`. `architecture_guards.sh` now enters the helper method body and catches temporary probes for:

- `ErrorCode = "create_threw"`
- `CardMessageId = "mapped-outside-signal"`
- `DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()`

After removing probes, worktree is clean, `git diff --check` passes, and `bash tools/ci/architecture_guards.sh` passes. Formal approve was blocked by GitHub because the authenticated account owns the PR, so I posted the approve verdict as a PR comment: https://github.com/aevatarAI/aevatar/pull/940#issuecomment-4527120622

自动更新每 10 分钟;edit-in-place 不堆评论;codex 完成后此 comment 自动删除(per Auric "完成后删掉就好了 否则太占空间")。
🤖 controller progress reporter

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.52%. Comparing base (f82a239) to head (10c8eb3).
⚠️ Report is 33 commits behind head on auto-refact-dev.

@@                 Coverage Diff                 @@
##           auto-refact-dev     #940      +/-   ##
===================================================
+ Coverage            82.83%   83.52%   +0.69%     
===================================================
  Files                  998      988      -10     
  Lines                63092    63645     +553     
  Branches              8161     8220      +59     
===================================================
+ Hits                 52261    53160     +899     
+ Misses                7304     6924     -380     
- Partials              3527     3561      +34     
Flag Coverage Δ
ci 83.52% <ø> (+0.69%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 64 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

loning added a commit that referenced this pull request May 24, 2026
…eaming + Nyx relay (#946) (#950)

* iter57 cluster-068: 扩展 #940 LarkCardOperationCompletedEvent typed-signal 至 text streaming + Nyx relay (#946)

Phase 9 r3 consensus(reflector r1 救场 + r2/r3 converge):
- 扩展 #940 LarkCardOperationCompletedEvent typed-signal 到 ConversationGAgent text streaming + Nyx relay text 操作
- 删 unsafe execution shape(rich continuation 移到 actor handler)
- actor-owned in-flight text operation state + generation matching + timeout + stale rejection + coalescing
- 保留 CardKit/text behavior + CI guard 覆盖新 signal-only text helper
- 不引入 new actor / port / envelope / topology / docs/canon

closes #946
local PASS:architecture + test_stability + build + LarkCardOperationSignalTests + ConversationGAgentDedupTests

⟦AI:AUTO-LOOP⟧

* iter57 cluster-068 fix r2: sanitize NyxRelayTextOperationTimeoutFiredEvent payload(不泄露 reply_token)

PR #950 r1 reject blocker:
- timeout payload Chunk = chunk.Clone() 把 runtime-only reply_token / reply_token_expires_at_unix_ms 写入 durable scheduler state
- 泄露 Nyx relay credentials

修:
- timeout payload sanitize,只 carry typed fields needed for reconciliation
- 不带 reply_token / expires_at 进 durable payload
- 新增 NyxRelayTextOperationTimeoutPayloadTests:capture scheduled callback,验证 typed + serialized bytes 不含 credentials
- 826/826 tests pass

⟦AI:AUTO-LOOP⟧
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant