Repository navigation
feat(sdk): extensible agent identity and model provenance - #713
Conversation
Deliver structured harness, model, source, and local session provenance across CLI, SDK, MCP, history, telemetry, and workspace settings. Add collision-safe declarative harness registries, precedence-preserving author resolution, privacy-bounded telemetry, token-minimal help, plugin automatic identity, full documentation, and 100% behavioral coverage.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 59 minutes. |
📝 WalkthroughWalkthroughThe PR adds declarative agent harness detection and structured provenance across settings, CLI, MCP, history, telemetry, and SDK exports. It removes hard-coded agent authorship from examples and plugin workflows, adds validation and tests, and records implementation evidence in project trackers. ChangesAgent identity and provenance
Documentation and workflow guidance
Tracker records
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant MCPClient
participant MCPServer
participant AgentIdentity
participant MutationHistory
MCPClient->>MCPServer: initialize with clientInfo
MCPServer->>AgentIdentity: run tool call with client signals
AgentIdentity->>MCPServer: return harness/model/session provenance
MCPServer->>MutationHistory: execute mutation with resolved identity
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merging this PR will degrade performance by 0.02%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | createQueryFingerprint |
515.2 µs | 517.5 µs | -0.44% |
| ❌ | build index (2000 docs x 80 words) |
160.7 ms | 160.8 ms | -0.07% |
| ❌ | encodeQueryCursor |
101.1 µs | 101.2 µs | -0.05% |
| ❌ | tokenizeAlphaNumeric |
367.4 µs | 367.4 µs | -0.01% |
| ⚡ | stableStringify (nested contract) |
161.1 µs | 160.7 µs | +0.23% |
| ⚡ | decodeQueryCursor |
116.4 µs | 116.2 µs | +0.13% |
| ⚡ | build index (200 docs x 40 words) |
8.4 ms | 8.3 ms | +0.02% |
| ⚡ | tokenize + score query over 2000 docs |
7.5 ms | 7.5 ms | 0% |
| ⚡ | score query over 2000 docs |
5.6 ms | 5.6 ms | 0% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing agent/sdk-agent-identity-provenance (5e61082) with main (d1d0e86)
There was a problem hiding this comment.
Actionable comments posted: 13
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.agents/pm/features/pm-03pq3o.toon:
- Around line 39-59: Update the tracker verification metadata so every recorded
claim is reproducibly supported: in .agents/pm/features/pm-03pq3o.toon lines
39-59, add focused MCP, telemetry, negative-detection, latency, contract, and
packed-consumer test/gate evidence or narrow the claims; in
.agents/pm/issues/pm-sx52hr.toon lines 33-44, add cross-surface help,
registration, documentation, and scaffold-invariant evidence or narrow its
claims. Keep each entry’s tests or verification links aligned with the scope
asserted by its comments and learnings.
In @.agents/pm/history/pm-6uxhe0.jsonl:
- Around line 7-8: Make verification evidence reproducible by updating the PM
test linkage and derived records: in .agents/pm/history/pm-6uxhe0.jsonl lines
7-8, add exact full-suite, coverage, static-gate, and packed-acceptance commands
or narrow the evidence comment; in .agents/pm/history/pm-brxdct.jsonl lines 7-9,
link registry, full-suite, coverage, and packed-acceptance commands; in
.agents/pm/history/pm-qwuber.jsonl lines 9-10, link ADR and telemetry
verification; in .agents/pm/history/pm-sx52hr.jsonl lines 7-9, link complete
help/test and coverage commands; then synchronize
.agents/pm/issues/pm-6uxhe0.toon lines 33-42 through the PM CLI.
In @.agents/pm/history/pm-qwuber.jsonl:
- Around line 6-10: Stop serializing agent_session into tracked PM history
records; update the supported history-writing workflow and its implementation
around history persistence so this field remains local-only while preserving
hash-chain integrity. Do not manually edit existing entries: remediate
.agents/pm/history/pm-qwuber.jsonl lines 6-10,
.agents/pm/history/pm-6uxhe0.jsonl lines 6-9, .agents/pm/history/pm-brxdct.jsonl
lines 6-10, and .agents/pm/history/pm-sx52hr.jsonl lines 6-9 through the
supported PM workflow, with no direct changes required to those append-only
records.
In @.agents/pm/history/pm-zqsrt5.jsonl:
- Around line 8-9: Update the test evidence through the PM CLI’s pm_test
mechanism rather than editing the append-only history file directly: either
append the exact full-suite and 100% coverage commands to match the claims in
the metadata comment, or narrow the comment to only the currently linked MCP and
plugin smoke tests. Ensure all claimed verification is represented by runnable
pm_test entries.
In `@plugins/pm-claude/skills/pm-developer/SKILL.md`:
- Around line 62-63: Add a blank line between each specified Markdown heading
and its following fenced code block:
plugins/pm-claude/skills/pm-developer/SKILL.md lines 62-63 after “### 3. Link
Evidence”, lines 79-80 after “### 6. Close”, and
plugins/pm-claude/skills/pm-planner/SKILL.md lines 71-72 after “### Link
Parent”.
In `@src/core/shared/author.ts`:
- Around line 167-170: Update nonBlank to validate that value is a string before
trimming it, returning undefined for non-string values while preserving the
existing blank-string handling. Ensure the environment lookup path used by
descriptorMatchesSignals safely handles inherited properties such as constructor
and toString without throwing.
- Around line 107-114: Update the pi harness configuration and its argv
detection so ordinary path segments named “pi” cannot trigger attribution;
remove the generic single-token "pi" argv marker or restrict marker matching to
executable basenames (such as argv[0]/argv[1]) instead of all token path
segments, while preserving valid pi CLI detection.
- Around line 229-250: Update currentHarnessSignalDescriptors so built-in,
registered, and workspace harness signal descriptors are reused without
re-normalizing on every call; normalize only localDescriptors (the
signals.descriptors input) at detection time. Preserve collision detection
across the combined descriptor set and the existing descriptor ordering.
- Around line 263-275: The modelFromArgv detection currently receives a
duplicated executable path and drops the first real CLI argument. Update its
callers, including the runtime telemetry caller and the default fallback in
author.ts, to pass process.argv directly or an explicit three-token signal
window without prepending process.execPath; preserve the bounded detection
behavior and existing model parsing logic.
In `@src/core/store/settings-validator.ts`:
- Around line 470-477: Update harnessSignalDescriptor to enforce the same
namespace normalization and literal-size limits currently applied by
normalizeHarnessSignalDescriptor(), including rejecting blank or non-normalized
lowercase values and oversized strings or arrays. Keep these constraints in the
settings schema so invalid harness_signals descriptors are rejected before
mergeSettings() processes them.
In `@tests/unit/core/telemetry/telemetry-runtime.spec.ts`:
- Around line 161-183: Update the test setup around
_testOnly.buildAuthorContextPayloadFields to snapshot and clear the ambient CI
and GITHUB_ACTIONS environment variables alongside the CODEX_* values, restoring
them in the existing cleanup. With those keys removed, replace the
expect.any(Boolean) assertions with deterministic boolean expectations and
ensure the codex descriptor precedence assertions remain stable.
- Around line 236-238: Update the test around buildAuthorContextPayloadFields to
avoid assuming an empty payload when CI environment detection is active: either
snapshot and clear the relevant process.env keys, restoring them in finally, or
assert that the specific model/author fields are absent while allowing
agent_harness_hash. Preserve environment state after the test.
In `@tests/unit/sdk/agent-runtime-primitives.spec.ts`:
- Around line 145-198: Update the test around registerHarnessSignalDescriptors
to guarantee all returned disposers run even when an assertion fails. Wrap the
registration, detection, collision checks, and cleanup assertions in
try/finally, invoking dispose and disposeDuplicate from the finally block while
preserving the existing happy-path expectations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a57e8c44-57a8-4dda-b5ad-08b6e9f6da64
📒 Files selected for processing (63)
.agents/pm/decisions/pm-qwuber.toon.agents/pm/features/pm-03pq3o.toon.agents/pm/features/pm-gnzh.toon.agents/pm/history/pm-03pq3o.jsonl.agents/pm/history/pm-6uxhe0.jsonl.agents/pm/history/pm-brxdct.jsonl.agents/pm/history/pm-gnzh.jsonl.agents/pm/history/pm-qwuber.jsonl.agents/pm/history/pm-sx52hr.jsonl.agents/pm/history/pm-zqsrt5.jsonl.agents/pm/issues/pm-6uxhe0.toon.agents/pm/issues/pm-sx52hr.toon.agents/pm/issues/pm-zqsrt5.toon.agents/pm/tasks/pm-brxdct.toon.mcp.jsondocs/AGENT_RUNTIME_PRIMITIVES.mddocs/CHATGPT_CODEX_PLUGIN_IMPLEMENTATION.mddocs/CLAUDE_CODE_PLUGIN.mddocs/SDK_CUSTOMIZATION_PRIMITIVES.mdplugins/pm-claude/.mcp.jsonplugins/pm-claude/README.mdplugins/pm-claude/agents/pm-coordinator.mdplugins/pm-claude/agents/pm-delivery-chain.mdplugins/pm-claude/agents/pm-triage-agent.mdplugins/pm-claude/agents/pm-verification-agent.mdplugins/pm-claude/commands/pm-audit.mdplugins/pm-claude/commands/pm-developer.mdplugins/pm-claude/commands/pm-init.mdplugins/pm-claude/commands/pm-new.mdplugins/pm-claude/commands/pm-planner.mdplugins/pm-claude/commands/pm-release.mdplugins/pm-claude/commands/pm-start-task.mdplugins/pm-claude/commands/pm-triage.mdplugins/pm-claude/commands/pm-workflow.mdplugins/pm-claude/skills/pm-audit/SKILL.mdplugins/pm-claude/skills/pm-developer/SKILL.mdplugins/pm-claude/skills/pm-planner/SKILL.mdplugins/pm-claude/skills/pm-release/SKILL.mdplugins/pm-claude/skills/pm-workflow/SKILL.mdsrc/cli/error-guidance.tssrc/cli/help-content.tssrc/cli/main.tssrc/cli/register-operations.tssrc/core/history/history.tssrc/core/shared/author.tssrc/core/shared/constants.tssrc/core/store/settings-validator.tssrc/core/store/settings.tssrc/core/telemetry/runtime.tssrc/mcp/server.tssrc/sdk/cli-contracts/tool-parameter-tables.tssrc/sdk/core.tssrc/sdk/index.tssrc/sdk/runtime-primitives.tssrc/types.tstests/fixtures/sdk/public-surface.jsontests/integration/mcp-handshake.spec.tstests/unit/cli/help-content.spec.tstests/unit/core/store/settings-sparse-persistence.spec.tstests/unit/core/store/settings-store.spec.tstests/unit/core/store/settings-validator.spec.tstests/unit/core/telemetry/telemetry-runtime.spec.tstests/unit/sdk/agent-runtime-primitives.spec.ts
💤 Files with no reviewable changes (4)
- plugins/pm-claude/skills/pm-audit/SKILL.md
- plugins/pm-claude/commands/pm-init.md
- plugins/pm-claude/commands/pm-triage.md
- plugins/pm-claude/commands/pm-new.md
Refresh the generated CLI/MCP contract snapshot and isolate telemetry model-only assertions from built-in CI and harness environment signals.
|
CI round 1 fixes are now at exact head @greptileai please review the new exact head. |
|
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 50 minutes. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Keep invocation sessions process-local, scrub branch history, and amend the identity ADR. Bound workspace descriptor validation, cache normalized built-ins, match argv markers by executable basename, tolerate hostile environment prototypes, remove duplicate argv inputs, isolate telemetry tests, and guarantee registration cleanup. Address review feedback while preserving automatic harness/model attribution and 100% coverage.
|
Bot feedback disposition for head 446d00a:
Fresh exact-head reviews requested now: @greptileai please review commit 446d00a. @coderabbitai full review |
|
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 24 minutes. |
|
Fresh-review terminal status for exact head 446d00a: CodeRabbit accepted the request but could not run another billed review because its included limit remains exhausted; Greptile likewise returned free_reviews_limit_reached. Both limits are external availability outcomes, not pending reviews. Sourcery, CodeQL, DeepScan (0 findings), Semgrep, CodeFactor, Hound, coverage, static, smokes, Windows, compatibility, typecheck, security scanners, and benchmarks are terminal green. The complete first CodeRabbit review was dispositioned inline with all 13 threads resolved. |
Record final review and verification evidence, close and release the six actively delivered identity items, leave no item in progress, and regenerate CHANGELOG.md with pm-changelog 2026.7.25. History replay remains drift-free across all 2,028 items.
|
Final tracker/changelog-only head is 5e61082. It closes and releases the six delivered PM items, leaves zero items in progress, and regenerates CHANGELOG.md through pm-changelog 2026.7.25; no implementation code changed after the fully reviewed 446d00a head. @greptileai please review the exact final head. @coderabbitai full review |
|
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 19 minutes. |
|
Final CodeRabbit response acknowledged: the exact-head review request terminated at the external included-review limit with no new findings posted. The final 5e61082 head is tracker/changelog-only after the fully reviewed implementation head, all available checks are terminal green, and the review inventory has zero unresolved threads. |
Summary
PM lineage
Verification
6,376tests across370files100%statements / branches / functions / linespnpm audit --audit-level=low: no known vulnerabilitiesCompatibility and privacy
Existing
authorand legacy history remain compatible. New history fields are optional. Explicit authors remain assertions, configured authors remain configured, and detected harness/model observations are recorded independently. Session identifiers remain local history only and are never sent in telemetry.Summary by cubic
Adds extensible agent identity provenance (harness, model, source, session) with automatic detection across SDK, CLI, MCP, history, and telemetry. Removes hard-wired authors from MCP/help/docs, adds a declarative harness registry, and hardens detection and safety.
New Features
agent_harness,agent_model, andagent_model_source; session stays local-only. Telemetry uses presence-only fields and installation-keyed hashes.agent_identity.harness_signals;registerHarnessSignalDescriptors(...),detectAgentIdentity,runWithHarnessDetectionSignals/runWithWorkspaceHarnessSignalDescriptors. CLI loads workspace descriptors at parse time. MCP reads and keeps client name/version from initialize for bounded detection.authoras an override only;.mcp.jsonand plugin guides removePM_AUTHORand rely on automatic identity.Migration
authorprecedence and legacy history remain compatible; new fields are optional.PM_AUTHORfrom local.mcp.jsonor host configs; rely on automatic identity.@unbrained/pm-clifallback behavior is unchanged.--authorin normal agent flows; use only for intentional external principals or legacy compatibility.agent_identity.harness_signalsin settings to register in-house harnesses.Written for commit 5e61082. Summary will update on new commits.