MSBA-371 · Lesson 9 of 12 · 19 min

Accountability and audit trails

▶ Video coming soon A video version of this lesson is on the way.

Ottoline Brisbane-Teale, Skerry's internal audit lead, had GitHub in scope for Skerry's audit in January 2027, and she had a list of questions about agents. Seraphine forwarded it to Priya, because Tidewater, as a supplier that contributes to the TrailCheck code Skerry ships, had received a short version too. The first question was the one every auditor asks in some form: "For any change in production code, can you show who decided it should be made, who made it, who approved it, and what checks it passed?" The second was new: "Where an agent made the change, can you show which agent, acting for whom, with what instructions and tools?"

The GH-600 outline places these questions in two domains. Under multi-agent coordination it asks candidates to produce artifacts for review and audit, document decisions, handoffs and outcomes, and support post-hoc analysis; it also asks them to retire agents while preserving auditability. Under guardrails it asks for accountability. This lesson brings them together around Ottoline's two questions.

Accountability stays with people

An agent cannot be accountable in the way a person can. It cannot explain itself to an auditor next year, accept responsibility for a mistake or be asked to change its practice. Accountability therefore stays with people, and the design question is which people, for what.

A clear model has three accountable roles for any agent-made change. The requester is accountable for the task: that it was worth doing and correctly described. The approver is accountable for the result: that it was reviewed to the standard the repository requires before it merged. The owner of the agent configuration is accountable for how the agent was set up: its instructions, tools, permissions and the evidence that it was evaluated. GitHub's built-in safeguards for the cloud agent support this split: the person who asked for a pull request cannot be the one who approves it.

Who is accountable for an agent-made change. The agent acts; people answer for the request, the review and the configuration.
RoleAccountable forEvidence
RequesterThe task and its descriptionThe issue or prompt, assignment event in the timeline
Agent (actor, not accountable)Nothing; it acts on someone's behalfCommits, session log, tool calls, pull request
ApproverReview before mergePull request review, required checks, merge event
Configuration ownerInstructions, tools, permissions and evaluation of the agentVersion history of agent files, test-set results, settings audit log

The audit trail for an agent change

An audit trail is the chain of records that lets someone reconstruct what happened. For a change made by the cloud agent, GitHub produces most links of the chain automatically, as long as the team does not break it.

A horizontal chain of six linked boxes: issue and assignment, agent session and log, commits on a copilot branch, pull request with checks, review and merge, deployment. Under each box a label names the record: who asked, what the agent did, what changed, what passed, who approved, what shipped. A bar beneath the chain is labeled audit log events for sessions, settings and policies.
The audit trail for a cloud agent change. Each record links to the next; the enterprise audit log runs underneath.

The issue and assignment record who asked and what they asked for. The session log records what the agent did: the steps, tools called, files read and commands run. The commits record what changed; GitHub signs the cloud agent's commits, and the pull request shows that the agent authored them on behalf of the person who started the task. The pull request records the checks that ran and their results, review comments and approvals. The merge records who merged and when. If the change is deployed, the deployment records and environment approvals complete the chain.

Under the chain sits the audit log. MSBA-370 noted that audit log entries for agent activity record an agent identifier and the user the agent acted for, with events when sessions start, finish or fail, and that an agent sessions view lets administrators see sessions across the enterprise, including those of third-party agents. Settings changes, policy changes and changes to which agents are enabled appear in the audit log too. Skerry streams its audit log to its security information and event management system, as MSBA-290 described, so these events are kept with its other security records.

Answering Ottoline's second question

The second question asked which agent, acting for whom, with what instructions and tools. The first two parts come from the audit log and the pull request. The last part, instructions and tools, is where teams most often have gaps, because instructions change over time.

The answer is version control. Custom instructions, AGENTS.md files, path-specific instructions and custom agent files all live in the repository or in an organization's shared configuration repository, so every version has a commit. To know what instructions an agent had for a given change, find the commit the session started from and read the instruction files as they were at that commit. Tool and MCP configuration kept in repository settings is harder; teams that want a full trail document those settings in the repository too and change them through reviewed pull requests.

Seraphine described how Skerry made this routine. Every agent-authored pull request gets a label from a small workflow, and the same workflow adds a comment recording the commit of the shared agent configuration repository and the names of the custom agents and MCP servers in use. "It took a day to build," she said, "and it answers Ottoline's second question in one click."

Documenting decisions, handoffs and outcomes

Records of what happened are not the same as records of why. The study guide asks for documented decisions, handoffs and outcomes, and earlier lessons have shown where each lives.

Decisions live in plan files, pull request descriptions and, for larger choices, decision records: short documents that state a decision, the options considered and the reasons. An agent that records "Kept the old input name, marked deprecated, because two clubs still use it" in its pull request has documented a decision that a later reader would otherwise have to guess. Handoffs live in pull requests, issue comments and escalations, using the five parts from the handoff lesson. Outcomes live in merges, reverts, deployments and the evaluation records from the test set.

A short decision record kept in the repository. It records why a guardrail exists, which an audit trail alone cannot show.
# Decision record 2026-11: agents may not edit workflow files

Status: accepted
Deciders: Priya Nair, Dmitri Kovac

Context
Agent pull requests twice changed .github/workflows files while fixing
unrelated build problems. Workflow changes can alter what runs with
secrets and on which triggers.

Decision
Workflow files are out of scope for all agents. Agent instructions say so,
and a push ruleset requires code owner review for .github/workflows/**.

Consequences
Build problems that need workflow changes are escalated to a person.
Reviewed again after the January audit.

Post-hoc analysis

Post-hoc analysis is investigating after the fact why something happened: a defect shipped, a secret leaked, a change was reverted, an agent behaved strangely. A good audit trail makes it possible; a poor one makes it guesswork. The questions are the same as in error analysis from earlier in the course, applied to a single incident: what was the task, what context and tools did the agent have, what did it do step by step, what checks ran, who reviewed, and where did the chain fail?

Malik ran one on the string-comparison date bug from the evaluation lesson. The issue had no stated intent. The session log showed the agent comparing dates as text because the test fixtures all used the same format. The agent's own tests passed. The required checks passed. The reviewer approved in four minutes and later said he had read the code but not the tests. The analysis found three contributing causes, a specification gap, a reasoning error and a thin review, and none of them alone would have shipped the bug.

Post-hoc analyses should be blameless: their purpose is to fix the system, not to find a person or an agent to blame. They should end with changes, such as a new task in the test set, an instruction, a check or a review habit, and those changes should be tracked like any other work.

Retention

Audit trails are only useful if they still exist when someone needs them. Retention periods differ between record types and plans, so teams should check the current documentation for each. Pull requests, commits and issues persist as long as the repository does. Workflow run logs and artifacts expire under the repository's retention settings. Audit log events are retained for a limited period in GitHub, which is why enterprises with long audit horizons stream them to their own storage, as Skerry does. Session logs for agent sessions should be checked for how long they remain available; if an organization needs them for longer, it should export what it needs.

Lifecycle: changing and retiring agents without losing the trail

Agents change. Instructions are revised, tools are added and removed, models are switched, and some agents are retired altogether. The outline asks candidates to add agents, update, reconfigure or replace them without disruption, and retire them while preserving auditability.

Agent lifecycle practices. Each step leaves evidence that will matter in a later audit.
Lifecycle stepGood practiceWhat it protects
AddIntroduce through a reviewed pull request; run the test set; start in a pilot repositoryEvidence that the agent was evaluated before use
Update or reconfigureChange instruction and agent files through pull requests; run the regression suite; note the change in a changelogA record of what each version could do
ReplaceRun old and new side by side on the test set; switch in one place; keep the old configuration in historyContinuity of work and comparability of results
RetireDisable rather than delete where possible; keep its files in history with a note; record the date and reason; keep its logs under retention rulesThe ability to explain past changes it made

Retirement is where trails are most often broken. Deleting a custom agent's file removes it from the current branch but not from history, which is good; deleting the repository that held a shared agent's configuration removes the history too, which is not. Disabling a third-party agent in enterprise settings stops new sessions; its past sessions and audit log events remain subject to retention. A short retirement note, in the repository that held the agent, saying when and why it was retired and where its records are, answers the question an auditor will eventually ask.

Worked problem

Tidewater's reply to the supplier questionnaire

Priya drafted Tidewater's answers to the agent questions in Skerry's supplier questionnaire.

Show solution
  1. Who decided, made, approved: every agent change starts from an issue assigned by a named person; the cloud agent's commits are signed and attributed; a different person approves under the default branch ruleset; required checks include tests and code scanning.
  2. Which agent, for whom: pull request metadata and the organization audit log record the agent and the user.
  3. Instructions and tools: all instruction and custom agent files are in the repositories, so their state at any commit can be shown; MCP configuration is documented in AGENTS.md and changed only by pull request.
  4. Decisions: a decision record folder in the TrailCheck repository; pull request descriptions follow a required template.
  5. Gaps declared honestly: Tidewater is on GitHub Team and does not stream its audit log; it exports the relevant entries monthly. Session logs are not exported.

Ottoline's follow-up questions

Ottoline's questionnaire had three follow-up questions that show how auditors think about agents. First, could an agent's change reach production without any person seeing it? At both Tidewater and Skerry the answer was no, because rulesets required human approval before merge and deployments went through protected environments, and both organizations could point to the settings and their audit log history. Second, could an agent change its own instructions or permissions? The answer depended on code owner review and push rules on agent files, which both organizations had: Tidewater had put its agent and instruction files under code owner review in the first course. Third, how would the organization know if the answer to either question changed? That required watching the audit log for changes to rulesets, agent policies and protected paths, which Skerry's security information and event management system did with alerts and Tidewater did by reviewing the monthly export.

Ottoline's view, which Seraphine passed on, was that agents did not change what auditors want; they changed how many actors there are and how fast they move. The controls that satisfied her were the same controls that make a fast-moving team trustworthy without agents: separation of duties, versioned configuration, reviewed changes and records that outlive the people who made them.

Common mistakes

  • MistakeTreating the agent as accountable for its changes.

    InsteadName the requester, approver and configuration owner; the agent only acts.

  • MistakeKeeping agent instructions or MCP settings outside version control.

    InsteadStore and change them through reviewed pull requests so any past state can be shown.

  • MistakeRecording what happened but not why.

    InsteadRecord decisions with reasons in plans, pull requests and decision records.

  • MistakeAssuming every log is kept forever.

    InsteadCheck retention for each record type and stream or export what audits need.

  • MistakeDeleting a retired agent's configuration repository.

    InsteadDisable it, keep history, and write a retirement note with date, reason and where records are.

Summary and key terms

  • Agents act; people are accountable as requester, approver and configuration owner.
  • The audit trail runs from issue and assignment through session log, signed commits, pull request checks and review to merge and deployment.
  • Audit log events record the agent and the user it acted for, and session start, finish and failure.
  • Version control shows which instructions and agent files applied to any change.
  • Decisions, handoffs and outcomes should be documented, not only actions.
  • Post-hoc analysis is blameless and ends with tracked changes.
  • Add, update, replace and retire agents in ways that preserve evidence and auditability.
Accountability
Being answerable for a decision or result; it stays with people, not agents.
Audit trail
The linked records that let someone reconstruct who did what, when and why.
Session log
The record of an agent session's steps, tool calls and commands.
Decision record
A short document stating a decision, options considered and reasons.
Post-hoc analysis
An investigation after the fact into why something happened.
Retention
How long a record is kept before it is deleted.
Retirement note
A record of when and why an agent was retired and where its records are kept.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. How can a team show which instructions an agent had for a change made months ago?

    Show answer

    Find the commit the session started from and read the instruction and agent files at that commit.

  2. What three contributing causes did Malik's post-hoc analysis find?

    Show answer

    A specification gap, a reasoning error and a thin review.

  3. Why do some enterprises stream their audit log?

    Show answer

    Because GitHub keeps audit log events for a limited period and audits may need them for longer.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz