Skip to content

feat: run-context stamp on approval prompts, notifications, and audit#114

Merged
Ram9199 merged 1 commit into
mainfrom
feat/run-context-stamp
Jun 13, 2026
Merged

feat: run-context stamp on approval prompts, notifications, and audit#114
Ram9199 merged 1 commit into
mainfrom
feat/run-context-stamp

Conversation

@Ram9199

@Ram9199 Ram9199 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Closes #109. Second in the founder-dogfood self-identity chain; builds on the SelfIdentity primitive from #108 (#113).

Principle: a permission tool must clearly identify which copy of itself is guarding the user. At the trust boundary — an approval prompt — nothing named the asking install. During dogfood this meant a stale copy could prompt anonymously and you had to ps aux | grep to find out which process was live.

What

New agent_sudo/run_context.py: a process-wide stamp of {version, install_type, client, workspace, pid}, built from self_identity. Captured by the acting process, so the value stored on an approval record is the requester's identity — which the separate approval-helper process then displays verbatim instead of recomputing its own.

Three surfaces, same identity:

  • Approval prompt — helper prints a From: line:
    From: agent-sudo 0.5.6 (editable) · client=antigravity · ws=/Volumes/Storage/Agent_Sudo · pid=61771
  • Desktop notification — compact identity line in the body: via agent-sudo 0.5.6 (editable)
  • Audit entriesrun_context stamped once at AuditLogger's write choke point, so every record (decisions + approval lifecycle) names its producer.

Client comes from MCP initializeclientInfo.name (defaults to cli for console-script, unknown otherwise). Workspace is set in build_server.

Scope discipline

  • ApprovalRequest gains one optional, additive run_context field — older records and external producers deserialize unchanged; to_dict omits it when absent.
  • Audit stamp is additive: covered by the hash chain, ignored by older readers. No schema redesign, no approval-flow changes.

Tests / validation

  • New tests/test_run_context.py (12 cases): field shape, client/workspace resolution, stamp formatting, audit stamping, approval-record round-trip + legacy-record tolerance.
  • Updated the one notification-content test for the new body line (asserts invariants, not the env-dependent stamp).
  • Full suite: 484 passed. ruff clean.
  • Docs: security_model.md notes the additive run_context block.

Add agent_sudo/run_context.py: a process-wide stamp (version, install_type,
client, workspace, pid) built from the self_identity primitive (#108). The
acting process captures it, so the approval-helper (a separate process) shows
the requester's identity rather than its own.

Wire the three surfaces:
- approval prompt: helper prints a 'From:' line from the record's run_context
- notification: identity line in the body
- audit: stamped once at AuditLogger's write choke point (all entries)

Client comes from MCP initialize clientInfo.name; workspace from build_server.
ApprovalRequest gains one optional, additive run_context field (older records
and external producers deserialize unchanged). No approval-flow or audit-schema
redesign beyond this field.

Closes #109
@Ram9199 Ram9199 merged commit 1725ae3 into main Jun 13, 2026
5 checks passed
@Ram9199 Ram9199 deleted the feat/run-context-stamp branch June 13, 2026 05:33
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.

Run-context stamp on approvals, notifications, and audit entries

1 participant