mateclaw/mateclaw-server/src/test/java/vip/mate/agent
倪程伟 a1221ac02d feat(mcp): type on-behalf-of identity by channel/trust (#459)
The identity forwarded to opt-in MCP servers was a one-dimensional string
(ChatOrigin.requesterId): a MateClaw username for web logins, but a webchat
visitorId for visitors and an IM sender id for IM — indistinguishable to the
REST backend. The signed-token mode (d204b702) made this worse: an RS256
signature over an unauthenticated visitorId reads as "MateClaw authenticated
this user" to any backend that trusts the signature.

Introduce an identity-typing dimension at McpIdentityForwardService:

- classify() branches on ChatOrigin: authenticated (web login, sub=immutable
  userId), anonymous (webchat visitor, trust=anonymous), external (IM sender,
  trust=external), or none (cron/system → nothing injected, fail-closed).
- mint() adds `trust` and `channel_type` claims; plaintext value is prefixed
  `trust:subject` so backends can tell the kinds apart without a JWT.

The immutable userId reaches resolve() without coupling it to the user store:
JwtAuthFilter stamps user.id into auth.setDetails() (both JWT and PAT paths),
and ChatController.memoryOrigin carries it on a new ChatOrigin.requesterUserId
field (only-add, per the record's evolution rule).

Resolves the webchat semantic mismatch raised in #459 and the "sub should be
an immutable user id" follow-up. 82 tests green (4 identity classes covered
with claim assertions + full ChatOrigin/MCP regression).

(cherry picked from commit b5d2cfbf98b39848d7139c743a0b81fea71e8ffe)
2026-07-01 19:02:49 +08:00
..
binding fix(mcp): cascade-delete agent-tool bindings when an MCP server is removed 2026-06-29 15:03:09 +08:00
context feat(mcp): type on-behalf-of identity by channel/trust (#459) 2026-07-01 19:02:49 +08:00
delegation feat(agent): add SessionListTool for enumerating live sub-agents 2026-06-23 18:22:10 +08:00
graph fix(agent): normalize replayed tool-call arguments to valid JSON (#410) 2026-06-26 11:19:19 +08:00
progress feat(agent): inject stale-ledger reminder when the model stops updating 2026-05-24 23:00:35 +08:00
service chore(test): backfill mateclaw-server/src/test/ that earlier PRIVATE_ITEMS pattern accidentally excluded 2026-05-12 17:38:08 +08:00
AgentAuthoringToolTest.java feat(agent): digital-employee builder skill to auto-create agents and chain them into a workflow (#165) 2026-05-21 16:26:04 +08:00
AgentGraphBuilderBasePathResolutionTest.java fix(tool): close three sandbox follow-up gaps surfaced by review 2026-05-25 17:55:56 +08:00
AgentGraphBuilderIdentityBlockTest.java feat(agent): append static About You identity block to system prompt 2026-06-08 20:53:39 +08:00
AgentGraphBuilderIT.java feat(approval): grant-based auto-approve with safety floor and resolution log 2026-05-27 14:07:39 +08:00
AgentGraphBuilderPreferenceTest.java feat(agent): per-employee model-chain preference (provider + model, repeatable provider) 2026-06-28 13:05:48 +08:00
AgentServiceUniquenessTest.java chore(test): backfill mateclaw-server/src/test/ that earlier PRIVATE_ITEMS pattern accidentally excluded 2026-05-12 17:38:08 +08:00
AgentToolSetTest.java chore(test): backfill mateclaw-server/src/test/ that earlier PRIVATE_ITEMS pattern accidentally excluded 2026-05-12 17:38:08 +08:00
BaseAgentApprovalSanitizationTest.java chore(test): backfill mateclaw-server/src/test/ that earlier PRIVATE_ITEMS pattern accidentally excluded 2026-05-12 17:38:08 +08:00
BaseAgentCarryRecentImageTest.java feat(agent): retain image context across turns for follow-ups (#303) 2026-06-11 13:53:56 +08:00
BaseAgentCronIsolationTest.java fix(cron): isolate scheduled-job runs from shared conversation (#142) 2026-05-17 07:58:10 +08:00
BaseAgentDirectToolHistoryScrubTest.java chore(test): backfill mateclaw-server/src/test/ that earlier PRIVATE_ITEMS pattern accidentally excluded 2026-05-12 17:38:08 +08:00
BaseAgentHeadOrphanRepairTest.java fix(agent): make head-orphan repair order-sensitive — a later same-id assistant does not redeem an earlier orphan 2026-05-13 09:03:16 +08:00
BaseAgentImageCaptionPersistTest.java feat(agent): retain image context across turns for follow-ups (#303) 2026-06-11 13:53:56 +08:00
BaseAgentMultimodalSkipNoticeTest.java feat(agent): retain image context across turns for follow-ups (#303) 2026-06-11 13:53:56 +08:00
BaseAgentToolCallReplayTest.java fix(agent): structured tool-call replay + final-answer-only content (#120) 2026-05-14 07:46:30 +08:00
GraphEventPublisherIterationTest.java chore(test): backfill mateclaw-server/src/test/ that earlier PRIVATE_ITEMS pattern accidentally excluded 2026-05-12 17:38:08 +08:00