Skip to content

bug(profiles): a session started with --name skips the startup profile switch (session_info breaks the own-start check) #3417

Done

Description

@gazton33

Before submitting

  • I searched open and closed issues and did not find a report of this problem.
  • I reviewed this report and removed credentials, tokens, private paths, hostnames, and other sensitive data.

Problem

With a per-worktree profile declaration (.pi/gentle-ai/profile.json), a session launched with pi --name <label> never runs the startup profile switch: it keeps the default orchestrator model and shows no startup profile notice. Pi writes a session_info entry for --name before session_start (pi-coding-agent dist/main.js:626-632). isSessionOwnStart (extensions/gentle-ai.ts:7304-7313 in 4.9.0) counts that entry as earlier history and returns false, so startupProfile stays undefined and the switch block (around :12913) is skipped. It fails silently, because the reached block always notifies (:12932-12933). Related: #2862 (same "a fresh session has no entries" assumption in gentle-agents) and #2853 (own-start predicate).

Steps to reproduce

  1. In a Git worktree, write .pi/gentle-ai/profile.json = {"kind":"gentle-pi.agent_model_profile_pin","version":1,"profile":"<name>"} for a profile whose orchestrator model differs from the current default.
  2. Launch gentle-shell from that worktree with no other arguments: the status bar shows the profile's orchestrator model (observed: deepseek-v4-flash · high · nan (repo)).
  3. Launch gentle-shell -- --name test from the same worktree: the status bar keeps the default model with the profile label (observed: claude-opus-5-5 · high · nan (repo)), and no startup profile notice is shown.

Workaround: also pass --model/--thinking matching the profile.

Expected and actual behavior

Expected: metadata-only entries such as session_info are ignored by the own-start test, so a named fresh session applies the declared profile like an unnamed one.
Actual: with --name, the declared profile's orchestrator model is silently not applied.

gentle-pi version

4.9.0

Pi version

1.5.2

Operating system

Linux

Relevant logs or error output (optional)

No response

Activity

  1. barbatdev commented on Nov 27, 2026

    @barbatdev
    Contributor

    Fixed in #3584 and merged into main. I tested it with and without --name test, and both runs applied the worktree profile and showed the startup notice.

    Closing this as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions