Repository navigation
feat: add a rule that AI commits link their session (CC018) - #698
Closed
shenxianpeng wants to merge 1 commit into
Closed
shenxianpeng wants to merge 1 commit into
shenxianpeng wants to merge 1 commit into
Conversation
A new [commit] setting, require_ai_session, asks a commit attributed to an AI tool to link the session that produced it. The disclosure says a tool was used; the link says where the record of what it did is kept. It is off by default and is not built under ai_attribution = "forbid". A link is a line a known tool writes for the purpose (Agent-Logs-Url:, Entire-Checkpoint:, Claude-Session:, a Claude Code or Devin session URL, a Codex task link) or one of the project's own ai_session_trailers with a value. The tool is read as CC305 reads it. Entire joins the catalog: its Entire-Checkpoint: trailer is a stamp, so forbid and disclose now see commits that carry only that trailer.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/ai-prohibited-patterns #698 +/- ##
=============================================================
Coverage 100.00% 100.00%
=============================================================
Files 15 15
Lines 2712 2774 +62
Branches 536 549 +13
=============================================================
+ Hits 2712 2774 +62 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.



Stacked on #697: it reuses
_ai_tool_behind, so it targets that branch. Once #697 merges, retarget this tomain.Before:
The AI rules say whether a tool was used and how that is said (CC013–CC017). They never ask where the record of what the tool did is kept. Agents already write that link (Copilot's
Agent-Logs-Url:, the Claude Code session URL, Devin and Codex task links), and the Entire CLI writesEntire-Checkpoint:. A project that wants every AI commit traceable to its session had no way to require the link.After:
The same message with
Entire-Checkpoint: 01M4X1NYD0BAHNW448QYK3CBC7orAgent-Logs-Url: https://...passes, and so does a commit with no AI tool behind it.How:
ai_session), run by--message. It is off untilcommit.require_ai_session = true, also settable with--require-ai-sessionandCCHK_REQUIRE_AI_SESSION.warn = ["CC018"]turns the failure into a warning. Underforbidit is not built, because an AI commit already fails CC013 there.ai_disclosure_trailers.session=True(Agent-Logs-Url:,Claude-Session:, the Claude Code session URL line, the Devin session link, the Codex task link,Entire-Checkpoint:), or a trailer from the newcommit.ai_session_trailers(--ai-session-trailers,CCHK_AI_SESSION_TRAILERS) with a value. That list is for in-house agent platforms and is empty by default. The trailer names are checked likeai_disclosure_trailers.detect_session_links()returns the subset ofdetect_ai_signatures()that links a session.detect_ai_signatures()keeps the same output, andALL_PATTERNSkeeps its 5-tuple shape.Assisted-by: the entire teamstays Generic AI).To review before a release:
require_ai_session,ai_session_trailers,--require-ai-session,--ai-session-trailers,CCHK_REQUIRE_AI_SESSION,CCHK_AI_SESSION_TRAILERS, CC018.forbidanddisclose, a commit whose only AI mark isEntire-Checkpoint:is now detected. Underdisclose, the fix proposesAssisted-by: Entire, the same wayAgent-Logs-Url:alone proposesAssisted-by: GitHub Copilot. But Entire records sessions, it is not the assistant, so you may prefer a different suggestion there.Entire-Checkpoint: 01M4X1NYD0BAHNW448QYK3CBC7). Entire's blog says only that the checkpoint ID is "stored in a commit trailer", without naming it.--ai-attribution-only, because, like CC017, it reads the commit author.#cc018docs link works once the rules page on the site lists the rule. The SchemaStore schema needs the two new keys.Tests: 1758 passed and coverage stays at 100%. One test,
test_load_config_file_permission_error, fails only because this machine runs as root, and it fails on the base branch too.