fix(server): honor repository commit conventions#21561

open3
main
worktree-git-10/repository-commit-conventions
opened8d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 5d ago

Problem

Repository conventions mode still forced generated commit subjects into the house format: it truncated them at 72 characters and removed final periods, even when AGENTS.md asked for something else.

Change

Repository instructions now precede commit-history examples, and the house message format is a fallback in repository mode. The shared provider sanitizer, Muse, and the final Git commit boundary preserve the generated subject format. Identical AGENTS.md/CLAUDE.md contents are included once. Settings and the user guide name the supported instruction files and explain how to use conventions kept in README or CONTRIBUTING.

Repository conventions is already the default writing mode. This change removes the hard 72-character cap and final-period stripping throughout that mode, including repositories without instruction files or history; the prompt still supplies the house format as a default. Custom and Conventional Commits modes retain their existing normalization.

Rebuilt from @tachytelicdetonation’s #12475 because text generation moved into provider-core after that contribution. Compared the complete original diff: instruction precedence, deduplication, prompt defaults, subject preservation, Settings guidance and documentation are retained; provider normalization also fixes the gap in the original PoC.

Scope and approval

This replaces #12475 and addresses #11917. The maintainer requested this takeover and provider-core port. Product approval for changing the default Repository conventions output remains pending with the central coordinator; no approval exemption is claimed. Landing and merge decisions belong to that coordinator.

Fixes #11917

Verification

  • Three added regression tests replace the original four, in existing suites. On unchanged main: 242 passed and three failed. After: all 258 focused GitManager, Codex, prompt, sanitizer and Muse tests pass.
  • Scoped server, provider-core, Muse and web typechecks; targeted lint and formatting pass.
  • Two independent full-diff review rounds using Claude Opus 5.5 and GPT-6-Sol. The first found omitted source guidance; the second found no remaining blockers.
  • Running Linux server: authenticated WebSocket commit RPC through a deterministic Codex CLI fixture, real provider normalization and GitManager, into a disposable Git repository. Repository mode preserved a 90-character subject and its final period; Conventional Commits and Custom modes kept their 72-character normalization. Captured prompts confirmed explicit instructions precede history. Runtime proof.
  • Browser: verified the Settings guidance with matching 1280×800 viewport, fixture and scroll position. Before uses the exact base component; after uses the published head.

Before:

Before: Settings incorrectly claims change-request-title history is sampled

After:

After: Settings names repository instruction files and README convention guidance

Live model compliance was not measured: generation used a deterministic fixture. Native macOS/Windows, Electron desktop, iOS/Android and relay/tunnel flows were not run. All clients use the shared GitManager behavior; mobile has no equivalent Settings description.

Remaining gate at the published head: CI jobs that ran pass, and CodeRabbit reviewed the current head without findings. Macroscope Approvability is neutral and explicitly requires human approval: removing the hard subject cap and punctuation stripping also changes the already-default Repository conventions mode in repositories without instruction files or history. Correctness passed. This product decision remains for a maintainer; neutral is not approval.

Implementation: Codex GPT-6.1-Sol (high), tests: GPT-6-Astra (high), coordinated in T3 Code through the Codex harness.

Fixes #11917 GitCafe: https://git.cafe/pingdotgg/t3code/issues/11917

Checks

22 successful · 9 skipped · 1 neutral
All checks passed
1afd963

Added 3 commits

  • fix(web): clarify repository writing conventions1afd963
  • fix(git): honor repository commit message conventions4408be4
  • test(git): cover repository commit conventions end to enda7b5bbe
Synced from GitHub

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — This PR changes the behavior of the default Repository conventions mode: repository instructions now outrank history examples, and generated commit subjects can retain repository-specific punctuation and exceed 72 characters. The change is focused and tested, but it alters the default product path and its persisted commit output.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
CodexLive turn WebSocket decoded20.9 KiB20.9 KiB0 B (0.0%)29.3 KiB✅
CodexLive turn messages220 (0.0%)8✅
ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiB✅
ClaudeLive turn messages220 (0.0%)8✅

Baseline: 1451e7c · PR result: 1afd963 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 6a2af65d-1767-4743-8b36-8e70e6426db6
📥 Commits

Reviewing files that changed from the base of the PR and between 1451e7cb23034d29774338608368a15d8845df36 and 1afd96342895086cc01bfd132a208f3d77f832e5.

📒 Files selected for processing: 10
  • apps/server/src/git/GitManager.test.ts
  • apps/server/src/git/GitManager.ts
  • apps/server/src/textGeneration/CodexTextGeneration.test.ts
  • apps/web/src/components/settings/SourceControlWritingSettings.tsx
  • docs/user/source-control.md
  • packages/provider-core/src/server/textGenerationOperations.ts
  • packages/provider-core/src/server/textGenerationPrompts.test.ts
  • packages/provider-core/src/server/textGenerationPrompts.ts
  • packages/provider-core/src/server/textGenerationUtils.ts
  • packages/provider-muse/src/server/textGeneration.ts

Limit details: You’ve used all 10 included reviews currently available.

📝 Walkthrough

Commit-message generation now gives repository instructions precedence over recent commit subjects and applies repository-convention-specific subject sanitization. Settings and user documentation describe which repository instruction files are used.

Changes: Repository-convention commit messages

Layer / File(s)Summary
Repository instruction context and prompt rules
apps/server/src/git/GitManager.ts, packages/provider-core/src/server/textGenerationPrompts.ts, apps/server/src/git/GitManager.test.ts, packages/provider-core/src/server/textGenerationPrompts.test.ts, apps/web/src/components/settings/SourceControlWritingSettings.tsx, docs/user/source-control.md
Repository-convention context places AGENTS.md and distinct CLAUDE.md instructions before recent commit subjects. The prompt, settings text, documentation, and tests describe instruction precedence.
Policy-aware subject sanitization
packages/provider-core/src/server/textGenerationUtils.ts, apps/server/src/git/GitManager.ts, packages/provider-core/src/server/textGenerationOperations.ts, packages/provider-muse/src/server/textGeneration.ts, apps/server/src/textGeneration/CodexTextGeneration.test.ts, apps/server/src/git/GitManager.test.ts
Generation paths pass the policy kind to subject sanitization. For repository conventions, the sanitizer preserves the first trimmed line, including its punctuation and length. Tests cover long, period-terminated subjects.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

mermaid
1sequenceDiagram
2 participant GitManager
3 participant TextGenerationProvider
4 participant buildCommitMessagePrompt
5 participant sanitizeCommitSubject
6 GitManager->>TextGenerationProvider: repository policy and instructions
7 TextGenerationProvider->>buildCommitMessagePrompt: policy and instructions
8 buildCommitMessagePrompt-->>TextGenerationProvider: commit-message prompt
9 TextGenerationProvider->>sanitizeCommitSubject: generated subject and policy kind
10 sanitizeCommitSubject-->>TextGenerationProvider: sanitized subject

Suggested reviewers: maria-rcks

Merge Risk: ⚪ Minimal · up to 1afd9

The repository-convention commit-message changes appear ready to merge after normal checks.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main change: honoring repository commit conventions.
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Description checkPassedThe pull request includes all required sections: Problem, Change, Scope and approval, and Verification. It provides issue links, approval status, focused test results, manual verification, screenshots…
Full details: Description check

Explanation

The pull request includes all required sections: Problem, Change, Scope and approval, and Verification. It provides issue links, approval status, focused test results, manual verification, screenshots, untested environments, and agent details. Product approval remains pending, but the description clearly identifies this gate.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.