Skip to content

refactor: 收口 workflow caller credential 与 typed tool request#1728

Open
jason-aelf wants to merge 24 commits into
devfrom
auto-work-dev
Open

refactor: 收口 workflow caller credential 与 typed tool request#1728
jason-aelf wants to merge 24 commits into
devfrom
auto-work-dev

Conversation

@jason-aelf
Copy link
Copy Markdown
Collaborator

@jason-aelf jason-aelf commented Jun 3, 2026

Summary

  • 收口 workflow caller credential:用强类型 WorkflowCallerCredential 替代旧的 connector_http_authorization 字符串/connector runtime context,并在 proto、application request、run execution context 与 actor state 中统一承载。
  • 将 direct workflow tool_call 执行切到 WorkflowToolExecutionRequest,显式携带 runIdstepIdexecutionIdcallIdscopeId 与 caller credential,避免工具执行走丢失上下文的 plain path。
  • 保持边界职责清晰:Capability API 入口只提取 caller bearer,connector 边界按需重建 Bearer header,Workflow.Integration.AI 边界再映射为 AgentToolExecutionContext,并在 committed state redaction 中清空敏感凭据。
  • 收紧 tool approval 链路:抽出 ToolCallMiddlewareChainFactory 保证 approval middleware 位于工具中间件链首位,并为 denied / timeout / pending / middleware termination 提供 ToolCallTerminationKind typed status。
  • 更新 scope/service/workflow/capability API、LLM/tool 模块与相关测试,覆盖 caller credential 传播、tool request 上下文、approval 终止状态、ScopeId 桥接和 endpoint 行为。

Test plan

  • gh pr checks 1728
  • GitHub checks passing: changes, fast-gates, host-composition-smoke, projection-provider-e2e, slow-test-guards, coverage-quality, codecov/patch
  • Not run locally in this session.

jason-aelf and others added 6 commits June 1, 2026 14:53
通过强类型 tool execution port 统一 workflow 直调工具执行路径,避免缺失审批管线时继续裸执行工具。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
覆盖 timeout 与 pending approval 通过执行端口映射 typed status,避免 workflow direct tool_call 回归到绕过审批链路。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tool-call-approval

修复 workflow tool_call 审批中间件旁路
Remove the lossy runtime LLM override mirror so llm_call derives its child request from the workflow ToolContext single source of truth.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
合并 #1664:修复 workflow llm_call ToolContext 传播。

Review-gate: architect/tests/quality 均 approve。
CI: all required checks completed successfully.

⟦AI:AUTO-LOOP⟧
@jason-aelf jason-aelf requested a review from louis4li as a code owner June 3, 2026 02:26
Codex Conflict Resolver and others added 5 commits June 3, 2026 11:59
Drop workflow runtime AgentToolExecutionContext storage/forwarding from tool_call and llm_call paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	src/Aevatar.AI.Abstractions/Middleware/IToolCallMiddleware.cs
#	src/Aevatar.AI.Core/AIGAgentBase.cs
#	src/Aevatar.AI.Core/Middleware/ToolApprovalMiddleware.cs
#	src/Aevatar.Bootstrap.Extensions.AI/ServiceCollectionExtensions.cs
#	src/workflow/Aevatar.Workflow.Core/Execution/WorkflowExecutionRuntimeContext.cs
#	src/workflow/Aevatar.Workflow.Core/Execution/WorkflowRequestMetadataRuntimeContextAccess.cs
#	src/workflow/Aevatar.Workflow.Core/Modules/LLMCallModule.cs
#	src/workflow/Aevatar.Workflow.Core/Modules/ToolCallModule.cs
#	src/workflow/Aevatar.Workflow.Core/WorkflowRunGAgent.cs
#	test/Aevatar.Integration.Tests/WorkflowAdditionalModulesCoverageTests.cs
#	test/Aevatar.Integration.Tests/WorkflowCoreModulesCoverageTests.cs
#	test/Aevatar.Integration.Tests/WorkflowGAgentCoverageTests.cs
#	test/Aevatar.Workflow.Core.Tests/Execution/WorkflowExecutionContextAdapterTests.cs
#	test/Aevatar.Workflow.Core.Tests/Execution/WorkflowExecutionRuntimeContextTests.cs
通过 workflow-owned connector_http_authorization 将可信 HTTP bearer 传到 llm_call/direct tool_call,并只在 Workflow.Integration.AI 边界转换为 AI tool context,避免 metadata 与公开观察面泄露。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

❌ Patch coverage is 95.19774% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.17%. Comparing base (d73dd6c) to head (cd15a7c).
⚠️ Report is 35 commits behind head on dev.

Files with missing lines Patch % Lines
...ow/Aevatar.Workflow.Core/Modules/ToolCallModule.cs 88.88% 0 Missing and 4 partials ⚠️
...flow.Infrastructure/CapabilityApi/ChatEndpoints.cs 66.66% 0 Missing and 3 partials ⚠️
...Service.Hosting/Endpoints/ScopeServiceEndpoints.cs 92.00% 0 Missing and 2 partials ⚠️
...on/WorkflowCallerCredentialRuntimeContextAccess.cs 94.59% 0 Missing and 2 partials ⚠️
...xecution/WorkflowRunExecutionContextStateAccess.cs 90.00% 0 Missing and 2 partials ⚠️
...orkflow/Aevatar.Workflow.Core/WorkflowRunGAgent.cs 85.71% 0 Missing and 2 partials ⚠️
...ervice.Hosting/Endpoints/ScopeWorkflowEndpoints.cs 92.85% 0 Missing and 1 partial ⚠️
...vatar.Workflow.Core/Modules/ConnectorCallModule.cs 80.00% 0 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##              dev    #1728      +/-   ##
==========================================
+ Coverage   84.06%   84.17%   +0.11%     
==========================================
  Files        1028     1050      +22     
  Lines       68513    70848    +2335     
  Branches     8885     9158     +273     
==========================================
+ Hits        57593    59639    +2046     
- Misses       7032     7192     +160     
- Partials     3888     4017     +129     
Flag Coverage Δ
ci 84.17% <95.19%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
....AI.Abstractions/Middleware/IToolCallMiddleware.cs 100.00% <100.00%> (ø)
src/Aevatar.AI.Core/AIGAgentBase.cs 82.64% <100.00%> (+0.31%) ⬆️
...vatar.AI.Core/Middleware/ToolApprovalMiddleware.cs 95.49% <100.00%> (+3.26%) ⬆️
....Core/Middleware/ToolCallMiddlewareChainFactory.cs 100.00% <100.00%> (ø)
...strap.Extensions.AI/ServiceCollectionExtensions.cs 85.38% <ø> (ø)
...bstractions/Execution/IWorkflowExecutionContext.cs 50.00% <100.00%> (+16.66%) ⬆️
...low.Abstractions/WorkflowCallerCredentialTokens.cs 100.00% <100.00%> (ø)
...ication.Abstractions/Runs/WorkflowChatRunModels.cs 94.62% <100.00%> (+0.05%) ⬆️
...ication/Runs/WorkflowChatRequestEnvelopeFactory.cs 90.32% <100.00%> (+1.03%) ⬆️
...lication/Runs/WorkflowChatRunInteractionService.cs 91.33% <100.00%> (+0.13%) ⬆️
... and 21 more

... and 32 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.

jason-aelf and others added 4 commits June 3, 2026 21:28
覆盖 scoped workflow 不把 HTTP bearer 写入 LLM control,以及 role-side typed bearer 进入工具上下文的回归路径,回应 tests reviewer r1 的阻塞意见。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jason-aelf jason-aelf requested a review from eanzhao as a code owner June 3, 2026 15:08
jason-aelf and others added 7 commits June 4, 2026 19:43
将 workflow-wide bearer carrier 从 connector 命名收口为 WorkflowCallerCredential,并保持 connector/AI 边界映射各自独立,避免 metadata 或 connector context 承载 run 级 caller credential。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
按 review-gate 反馈移除 workflow 内部 NyxID/provider 命名和 HTTP header 形态,只在 connector 边界重建 Bearer header 并保持 AI mapping 在 Integration.AI。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
实现 #1777 WorkflowCallerCredential caller 凭据收口
* 实现 workflow tool typed request 收口

将 workflow tool 执行统一到 WorkflowToolExecutionRequest,避免 direct tool_call 走丢失上下文的 plain path。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 补充 workflow ScopeId 桥接测试

覆盖 WorkflowRunGAgent actor state 到 WorkflowExecutionContextAdapter 的 ScopeId 传播,回应 #1784 review-gate 的测试缺口。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 补充 workflow tool request 覆盖

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jason-aelf jason-aelf changed the title fix: propagate workflow tool call context refactor: 收口 workflow caller credential 与 typed tool request Jun 5, 2026
jason-aelf and others added 2 commits June 5, 2026 08:54
* 实现 workflow caller credential 后续收口

将 workflow-owned raw bearer、route preference 与 AI provider/tool credential 映射边界收口,避免 Workflow 层感知 NyxID 或通用 bag 语义。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 修复 workflow caller credential review 反馈

去除 credential 字段的 invalid sentinel 语义,并补齐应用层 invalid caller credential 短路测试,确保 provider/tool credential 边界保持单一语义。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 补充 workflow caller credential 覆盖

为 PR #1825 的 codecov/patch 缺口补充测试,覆盖 malformed bearer 在 workflow 与 scope endpoint 的短路行为。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 补充 scoped AGUI 路由偏好覆盖

修复 PR #1825 review-gate r2 tests reject,确保 scoped preferred LLM route 进入 AGUI workflow 请求。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <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