Skip to content

feat(client): add caller_name to audit_tool_call (#2912)#218

Merged
saurabhjain1592 merged 2 commits into
mainfrom
feat/2912-caller-name-audit
Jul 17, 2026
Merged

feat(client): add caller_name to audit_tool_call (#2912)#218
saurabhjain1592 merged 2 commits into
mainfrom
feat/2912-caller-name-audit

Conversation

@gzak

@gzak gzak commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds caller_name to AuditToolCallRequest (axonflow/types.py) — the correctly-named replacement for tool_type, which every real caller (claude_code/codex/cursor/openclaw) actually used to identify which client made the call, not any property of the tool.
  • tool_type is kept as a deprecated input fallback, not removed — backward compatible for existing callers during the deprecation window.
  • client.audit_tool_call (axonflow/client.py) forwards caller_name the same way tool_type is forwarded today; docstring example and debug logging updated accordingly.
  • Mirrors the platform-side resolution implemented in getaxonflow/axonflow-enterprise#2953: caller_name if supplied -> legacy tool_type if supplied -> a default.

Implements getaxonflow/axonflow-enterprise#2912, sub-issue of epic #2905.

Post-merge update (see #219): axonflow-enterprise#2953 has since merged to axonflow-enterprise main and shipped in platform v9.11.0. That merge folded in #2903, which changed the neither-supplied default from "claude_code" to "unknown". #219 adds real-stack coverage for that scenario and corrects this PR's now-stale "#2953 open, not yet merged" note.

Test plan

  • tests/test_audit_tool_call.py — new unit tests: caller_name sent alone, tool_type alone (backward compat), both supplied together, plus a type-level model_validate test with caller_name.
  • runtime-e2e/caller_name_audit/test.py — real-stack proof (no mocks) driving the actual SDK's audit_tool_call against a live agent+orchestrator, polling GET /api/v1/audit/tenant/{tenant_id} and asserting caller_name (and the legacy tool_type fallback) reach policy_details.caller_name on the persisted audit row.
  • Full unit suite: 1051 passed, 29 skipped (coverage 82.29%, threshold 75%).
  • scripts/lint-no-mocks-in-runtime-e2e.sh — clean.
  • ruff check — clean on all touched files.
  • CHANGELOG.md [Unreleased] updated.

@gzak
gzak force-pushed the feat/2912-caller-name-audit branch from 044b460 to 628f22e Compare July 17, 2026 18:38
tool_type on AuditToolCallRequest was misleadingly named -- every real
caller (claude_code/codex/cursor/openclaw) used it to identify which
client made the call, not any property of the tool. Add caller_name
as the correctly-named field; tool_type stays as a deprecated input
fallback (not removed) during the deprecation window, mirroring the
platform-side resolution added in getaxonflow/axonflow-enterprise#2953
(caller_name if supplied -> legacy tool_type if supplied -> default).

Implements getaxonflow/axonflow-enterprise#2912, sub-issue of epic #2905.

Signed-off-by: Gregory Zak <gzak@getaxonflow.com>
@gzak
gzak force-pushed the feat/2912-caller-name-audit branch from 628f22e to b15924e Compare July 17, 2026 18:45
@gzak

gzak commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

R3 review passed cleanly, but the final CI run on the pushed commit surfaced 3 real, fixable failures (final sweep before considering this done):

  1. ruff formatruntime-e2e/caller_name_audit/test.py wasn't formatted. Fixed.
  2. Wire-shape contract — same class of issue as the sibling Go SDK PR: caller_name is new drift not yet in tests/fixtures/wire_shape_baseline.json. Regenerated the baseline against the correctly pinned community-mirror SHA via scripts/refresh_wire_shape_baseline.py.
  3. test_committed_baseline_has_no_unannotated_drift_entries — the new baseline entry needs a note classification (spec-bug-pending / deprecated-pending-removal / acknowledged-sdk-superset / sdk-aggregation). Added acknowledged-sdk-superset referencing #2912/#2953, matching the pattern used by Budget's pre-existing entry.

Full suite now green: 1051 passed, 29 skipped, 82.29% coverage.

A pre-#2953 platform silently drops caller_name, so a caller who sets
only caller_name on an older platform gets the default with no in-IDE
attribution hint. Add the platform-floor caveat (requires v9.11.0+; set
tool_type as a fallback on older platforms) to the caller_name field doc
comment.

Also add the "platform support not yet on main" prerequisite section to the runtime-e2e README, matching the TS/Java SDKs.

getaxonflow/axonflow-enterprise#2912

Signed-off-by: Saurabh Jain <saurabh.jain@getaxonflow.com>
@saurabhjain1592
saurabhjain1592 merged commit 5d1809e into main Jul 17, 2026
18 checks passed
@saurabhjain1592
saurabhjain1592 deleted the feat/2912-caller-name-audit branch July 17, 2026 20:43
gzak added a commit that referenced this pull request Jul 20, 2026
…te (#2912) (#219)

axonflow-enterprise#2953 (caller_name) has merged and shipped in platform
v9.11.0; it folded in #2903, which changed the fallback default written to
policy_details.caller_name when neither caller_name nor tool_type is
supplied from "claude_code" to "unknown" (an unidentified caller must not
be silently attributed to a specific client).

- runtime-e2e/caller_name_audit/test.py: add a third real-stack scenario
  asserting the neither-supplied case resolves to "unknown", not
  "claude_code". Verified against a freshly built axonflow-enterprise
  main (commit 7a5984ec7+, platform v9.11.0) — confirmed via direct
  platform inspection (audit_logs.policy_details) and through this SDK's
  own audit_tool_call before landing the assertion.
- runtime-e2e/caller_name_audit/README.md: replace the stale "#2953 is an
  open PR, not yet merged" prerequisite note (accurate when PR #218
  merged, no longer true) with the current v9.11.0 platform requirement;
  document the third scenario.

No axonflow SDK code changes -- caller_name/tool_type were already both
independently settable, so the SDK needed no "dual-send" cutover.

Signed-off-by: Gregory Zak <gzak@getaxonflow.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