feat: v0.16.0 — session attribution (user, process ancestry, agent provider)#32
Merged
Merged
Conversation
…rovider Adds attribution.py with collect_attribution() that captures OS user, hostname, PID/PPID, process ancestry chain, agent provider (detected from env vars and process names), and git context (repo, branch, commit). Attribution is stored in SessionMeta.attribution dict and written to meta.json at session start. hooks.py now calls collect_attribution() on every session-start event. Closes #22 Co-authored-by: Ona <no-reply@ona.com>
__dataclass_fields__ is an implementation detail. dataclasses.fields() is the public API and works correctly across Python 3.10–3.13. Co-authored-by: Ona <no-reply@ona.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #22
What
Adds
attribution.pythat captures who/what started a session and stores it inSessionMeta.attribution.Captured fields
os_userpwd.getpwuid/$USERhostnamesocket.gethostname()pid/ppidos.getpid()/os.getppid()process_ancestry/proc/<pid>/commchain (Linux)agent_providerANTHROPIC_API_KEY,CURSOR_SESSION_ID, etc.) + process namesgit_repo/branch/commitgit remote get-url/rev-parseworking_diros.getcwd()hooks.pycallscollect_attribution()on everysession-startevent. Attribution is written tometa.jsonand never modified.Tests
tests/test_attribution.py— 8 tests.