Skip to content

fix(hooks): adapt SessionStart acknowledgment language - #439

Merged
taosu0216 merged 1 commit into
mindfold-ai:mainfrom
lifan-builds:fix/sessionstart-response-language
Jul 20, 2026
Merged

taosu0216 merged 1 commit into
mindfold-ai:mainfrom
lifan-builds:fix/sessionstart-response-language

Conversation

@lifan-builds

@lifan-builds lifan-builds commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • preserve Trellis's one-shot SessionStart proof-of-load acknowledgment
  • choose its language from the user message that triggers the first visible reply
  • fall back to an explicitly established project communication language, then Trellis SessionStart ✓
  • prevent the acknowledgment from changing the language of the remaining response
  • apply byte-equivalent wording across shared hooks, Codex, OpenCode, and Pi while keeping Copilot notice-free
  • preserve existing payload shapes, context timing, OpenCode persistence/deduplication, and Pi memoization

Why

The existing notice requires a fixed Chinese sentence. Because the notice is model-visible after startup, /clear, and compaction, it can steer an otherwise non-Chinese conversation into Chinese.

The acknowledgment was intentionally added as cross-platform proof that otherwise-hidden SessionStart context loaded, so this change keeps that observability instead of removing it. Language selection happens when the first visible reply is generated, when the triggering user message is normally available. No OS-locale or repository-content guessing is introduced.

Validation

  • full pre-commit suite: 333 core tests passed (1 skipped), 1,389 CLI tests passed
  • focused SessionStart/OpenCode/Pi tests: 396 passed
  • ESLint passed
  • TypeScript typecheck passed
  • basedpyright passed with 0 errors (64 pre-existing unused re-export warnings)
  • all four live notices verified byte-equivalent
  • fixed-Chinese wording and Copilot exclusion audits passed
  • git diff --check passed

Fixes #412

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added adaptive first-reply acknowledgments based on the user’s request language, with project-language and language-neutral fallbacks.
    • Session-start context now includes additional startup information while preserving one-time acknowledgment behavior.
    • Acknowledgments remain consistent with the response language and are not repeated during the session.
  • Documentation

    • Updated platform integration guidance and validation requirements for adaptive acknowledgments.
  • Tests

    • Expanded coverage for acknowledgment content, ordering, persistence, and suppression of duplicate context injections.

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 561dd9c6-e862-4b44-b38e-397da2f9fbbd

📥 Commits

Reviewing files that changed from the base of the PR and between c6f85dc and d08d7b4.

📒 Files selected for processing (8)
  • .trellis/spec/cli/backend/platform-integration.md
  • packages/cli/src/templates/codex/hooks/session-start.py
  • packages/cli/src/templates/opencode/lib/session-utils.js
  • packages/cli/src/templates/pi/extensions/trellis/index.ts.txt
  • packages/cli/src/templates/shared-hooks/session-start.py
  • packages/cli/test/regression.test.ts
  • packages/cli/test/templates/opencode.test.ts
  • packages/cli/test/templates/pi.test.ts

📝 Walkthrough

Walkthrough

SessionStart first-reply notices no longer require Chinese. Specifications and platform templates now define adaptive language selection with a neutral fallback, while tests validate payload structure, notice content, ordering, and reinjection behavior.

Changes

Adaptive SessionStart acknowledgment

Layer / File(s) Summary
Adaptive notice contract
.trellis/spec/cli/backend/platform-integration.md
Defines request-language, project-language, and neutral-fallback selection, plus one-shot emission and Pi startup-context requirements.
Template notice propagation
packages/cli/src/templates/{shared-hooks,codex/hooks,opencode/lib,pi/extensions}/...
Updates platform-specific FIRST_REPLY_NOTICE prompts with adaptive language rules, continuation behavior, and no-repeat constraints.
Behavior and payload validation
packages/cli/test/regression.test.ts, packages/cli/test/templates/{opencode,pi}.test.ts
Validates adaptive notice content, payload shapes, ordering, negative language assertions, and suppression of history-based reinjection.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

Suggested reviewers: taosu0216

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: making SessionStart acknowledgment language adaptive.
Linked Issues check ✅ Passed The PR replaces the hard-coded Chinese SessionStart reply with adaptive language selection and a neutral fallback, matching #412.
Out of Scope Changes check ✅ Passed The modified hooks and tests all support the SessionStart language-adaptation objective, with no unrelated changes evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

❤️ Share

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

@taosu0216 taosu0216 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed in depth: notice wording verified byte-equivalent across shared/Codex/OpenCode/Pi templates, Copilot stays notice-free, full CLI suite 1389/1389 green, no payload-shape regressions. Thanks for the careful fix!

@taosu0216
taosu0216 merged commit c0b2065 into mindfold-ai:main Jul 20, 2026
1 check passed
taosu0216 added a commit that referenced this pull request Jul 20, 2026
docs(spec): refresh contracts for #439/#445/#448 merge batch
abelhou pushed a commit to abelhou/Trellis that referenced this pull request Jul 20, 2026
…dfold-ai#448 merge batch

Fill gaps left after mindfold-ai#439 (SessionStart language-adaptive notice) and mindfold-ai#445
(Codex native SubagentStart dispatch) already updated platform-integration.md,
and cover mindfold-ai#448's five behavior changes: preferOffline removal, `trellis
platforms --json`, task.py list/current --json + display_status roll-up,
base_branch/stale-branch git helpers, channel spawn --sandbox, and the Pi
skills .pi/skills/ -> .agents/skills/ move.
Xio-Shark pushed a commit to Xio-Shark/Trellis that referenced this pull request Sep 17, 2026
Xio-Shark pushed a commit to Xio-Shark/Trellis that referenced this pull request Sep 17, 2026
…dfold-ai#448 merge batch

Fill gaps left after mindfold-ai#439 (SessionStart language-adaptive notice) and mindfold-ai#445
(Codex native SubagentStart dispatch) already updated platform-integration.md,
and cover mindfold-ai#448's five behavior changes: preferOffline removal, `trellis
platforms --json`, task.py list/current --json + display_status roll-up,
base_branch/stale-branch git helpers, channel spawn --sandbox, and the Pi
skills .pi/skills/ -> .agents/skills/ move.
Xio-Shark pushed a commit to Xio-Shark/Trellis that referenced this pull request Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SessionStart hook hard-codes Chinese in the first assistant response

2 participants