Complete agent attribution coverage - #181
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-01a01147-8d44-7468-ac98-bf40b04e3cee Co-authored-by: Amp <amp@ampcode.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a5074c2ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| add_column :coplan_library_events, :agent_name, :string | ||
| add_column :coplan_library_events, :api_token_id, :string, limit: 36 | ||
| add_index :coplan_library_events, :api_token_id | ||
| add_foreign_key :coplan_library_events, :coplan_api_tokens, column: :api_token_id |
There was a problem hiding this comment.
Allow deleting tokens that have library audit events
When a token has produced a library or folder event, this restrictive foreign key prevents the existing ActiveAdmin token deletion action from deleting it; it also causes User#destroy to fail because the user destroys associated API tokens. This newly affects tokens used only for library organization. Preserve the append-only event while allowing credential cleanup by nullifying api_token_id on token deletion, either through the foreign key or a corresponding dependent association.
Useful? React with 👍 / 👎.
Why
PR #178 attributed agent-created content, plan events, and comments, but two API audit paths still lost full agent identity: comment deletion events and library/folder events.
What
Risk Assessment
Low — this extends nullable audit metadata and leaves human/web attribution behavior unchanged.
Testing
Generated with Amp