Skip to content

feat(config): per-project [projects.display] override#792

Open
Cigarrr wants to merge 1 commit intochenhg5:mainfrom
Cigarrr:pr-projects-display-override
Open

feat(config): per-project [projects.display] override#792
Cigarrr wants to merge 1 commit intochenhg5:mainfrom
Cigarrr:pr-projects-display-override

Conversation

@Cigarrr
Copy link
Copy Markdown
Contributor

@Cigarrr Cigarrr commented Apr 27, 2026

Summary

Allow each [[projects]] entry to override individual fields of the global [display] block, on a per-field basis. Useful when you want one project to run quiet while others stay verbose, or vice versa, without splitting into separate cc-connect instances.

Schema

[display]
thinking_messages = true
tool_messages = true

[[projects]]
name = "noisy-project"
[projects.display]
thinking_messages = false  # overrides only this field
tool_messages = false

Each sub-field is independently optional; unset fields fall back to the global [display] value, then to the built-in default.

Resolution order (per field)

  1. [projects.display].<field> — highest precedence
  2. [display].<field>
  3. built-in default

All four DisplayConfig fields participate (ThinkingMessages, ToolMessages, ThinkingMaxLen, ToolMaxLen).

Backward compatibility

  • Projects with no [projects.display] block see no behavior change.
  • Legacy quiet (root or per-project) is preserved: if quiet is in effect AND neither layer set thinking_messages / tool_messages, they default to false — same as before, just extended to honor project-level overrides when present.

Tests

7 new sub-tests in TestEffectiveDisplay_ProjectOverride cover:

  • project overrides global thinking_messages
  • project unset falls back to global
  • both unset falls back to default
  • project overrides max-len fields
  • project quiet still respected when project display unset
  • project display.thinking_messages true overrides project quiet
  • nil project display behaves like before

go test ./... passes (the 4 pre-existing failures on mainTestProcessInteractiveEvents_AppendsReplyFooterWhenEnabled, TestProcessInteractiveEvents_ReplyFooterPrefersSessionRuntimeState, TestResolveLocalDirPath_AcceptsSubdir, TestGetModelAndReasoningEffort_FromRuntimeConfigWhenUnset — are unrelated to this change).

Docs

config.example.toml updated with a commented-out [projects.display] example next to the global [display] section.

Add a `Display *DisplayConfig` field to ProjectConfig so each project can
override the global [display] block on a per-field basis. Useful when
one project should run quiet while others stay verbose, or vice versa.

Schema:

  [display]
  thinking_messages = true
  tool_messages = true

  [[projects]]
  name = "noisy-project"
  [projects.display]
  thinking_messages = false
  tool_messages = false

Resolution order for each field in EffectiveDisplay:
  1. [projects.display].<field>  (highest precedence)
  2. [display].<field>
  3. built-in default

All four DisplayConfig fields (ThinkingMessages, ToolMessages,
ThinkingMaxLen, ToolMaxLen) participate. Legacy `quiet` behavior is
preserved: if quiet is in effect AND neither layer set
thinking_messages / tool_messages, they default to off (existing
semantics, just extended to honor project-level overrides).

Includes 7 new test cases covering project-overrides-global, fallback
chain, max-len overrides, quiet interaction, and nil project display.
Copy link
Copy Markdown
Owner

@chenhg5 chenhg5 left a comment

Choose a reason for hiding this comment

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

Review Summary

Clean implementation of per-project [projects.display] override. The per-field resolution logic is well-designed and backward-compatible.


Good:

  1. Per-field resolution: pickBool / pickInt helpers cleanly implement the precedence: project → global → default.

  2. Legacy quiet preserved: When quiet=true AND neither layer explicitly sets thinking_messages / tool_messages, they default to false. Project-level [projects.display] takes precedence over both global display and quiet.

  3. Comprehensive tests: 7 test cases in TestEffectiveDisplay_ProjectOverride cover all resolution paths.

  4. Documentation: Clear config example showing the per-field override pattern.


LGTM. CI green.

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.

2 participants