Repository navigation
Description
audit_log exists in packages/db/src/schema/comms.ts with a well designed set of columns: actor type, actor id, actor name, action, entity type, entity id, a before and after JSONB pair, and an IP address, indexed on organisation and time.
Nothing writes to it. Not one row, ever.
This matters more than the other dormant tables because of what people assume when they see it. An admin evaluating Orbit for a team, reading the schema, will conclude there is an audit trail. There is not. If somebody removes a member, changes a role, deletes a project or rotates an integration token, there is no record of it anywhere.
issue_activity covers changes to issues and is a different thing. It is a product feature for showing history on an issue, scoped to issues, and it does not record administrative actions at all.
What to build
Write the log. Every administrative and destructive action produces a row:
- Member invited, role changed, removed
- Team created, renamed, deleted, membership changed
- Workspace settings changed, including the allowed email domains
- Integration connected, disconnected, token rotated
- Project or doc deleted, archived, or its visibility changed
- Doc share link created or revoked
- API key created or revoked, once those exist
- Sign-in method changes, and session revocation
The before and after columns mean the log can answer what a setting used to be, which is usually the actual question. Use them. Never put a secret, a token or a password hash in either one.
Read the log. An admin only view under settings, filterable by actor, action, entity and date, with the newest first. The index audit_log_org_idx on organisation and time already supports that ordering.
Retain the log. Decide and document a retention policy. Unbounded growth on a busy workspace is a real problem, and a self hoster needs to know whether this table will grow forever. Whatever you pick, put it in docs/self-hosting.md.
Things to get right
- The log is append only. No update path, no delete path, no API that can rewrite history. If retention deletes old rows, that is a scheduled job and not a user action.
actor_typedefaults touserand the column exists for a reason. MCP agents and automation rules act too, and an audit entry that attributes an agent's action to the human who authorised its token is misleading. Record both: the agent as actor, the granting user as the principal behind it. Themcp_grantrow already binds a client and user to a workspace, so the information is available.- The IP address column is personal data. Say in the docs that it is collected, and consider making it optional for self hosters who would rather not.
- Failures to write must not fail the action. If the audit insert throws, the role change should still happen and the failure should be loud in the logs. An audit system that can take down the app is worse than no audit system. Reasonable people disagree about this for compliance reasons, so say what you chose.
Files
packages/db/src/schema/comms.tspackages/core/src/org/andpackages/core/src/auth/for the actions to instrument- A new settings route under
apps/web/src/app/(app)/settings/ packages/shared/src/policyfor the admin gatedocs/self-hosting.md
Scope note
Writing the log and viewing the log can be two pull requests. Writing it first is more valuable, because a log with no viewer can still be queried in Postgres, while a viewer with no log shows an empty table.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity
imshashank commentedon Aug 8, 2026
Shares its hardest question with #215.
audit_log.actor_typealready exists and already defaults touser, which anticipated that agents and automation act too. #215 makes agents a first class actor with their own identity. The two issues have to agree on how an action is attributed when an agent does it on behalf of a human who authorised it, and the answer should be the same in the activity feed and in the audit log.Whichever lands first should decide it, and say so on the other thread. #193 has the same question for rule driven changes.