Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Sassy `mode` from config file is ignored (only CLI `--mode` works)

未关闭 适合新手
#97 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@galopyz 已经在做这个了。

开始于 2026年8月12日。

  • #99 来自 @galopyz —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
84/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
python
领域
cli

调研方向

从 shell_sage/core.py 开始,将 main() 与 get_opts() 进行比较,并跟踪 mode 如何从配置文件中解析。验证在 mode = sassy 且未使用 --mode 的情况下,ssage 使用 sassy persona,同时显式指定 --mode 时的行为保持不变;还要检查 issue 中描述的空 mode 边界情况。

由索引模型根据 Issue 内容生成。

描述

When mode is set in the shell_sage config file (~/.config/shell_sage/shell_sage.conf), ShellSage still starts in default mode. The --mode sassy CLI flag works correctly, but the config value is never picked up.

Steps to reproduce

  1. Set mode = sassy in ~/.config/shell_sage/shell_sage.conf
  2. Run ssage "Say hello in one sentence" (no --mode flag)
  3. Observe the response

Expected behavior

With mode = sassy in the config, ssage should respond in sassy mode (GLaDOS-style persona).

Actual behavior

ssage responds in the default teaching-assistant persona:

Hello! I'm ShellSage, your command-line teaching assistant — what shell task can I help you with today?

Running ssage --mode sassy "Say hello in one sentence" does produce the sassy persona, confirming the flag path works:

Hello, test subject — congratulations on successfully typing a query; I do hope that wasn't the most challenging part of your day.

Root cause

In shell_sage/core.py, main() never routes mode through get_opts(), which is where config-file values are resolved:

  • main()'s mode parameter defaults to 'default' rather than None
  • The get_opts(...) call does not pass mode=mode
  • get_opts only fills a value from the config when the passed value is None (if v is None: opts[k] = cfg.get(k, default_cfg.get(k)))

So the config value for mode is never read.

Proposed fix (verified working locally)

  1. Change the mode parameter default to None
  2. Pass mode=mode to get_opts(...)
  3. Use opts.mode for validation and the get_sage(...) call

Related edge case

If the config contains a blank mode = (e.g. from a generated config), opts.mode becomes '' and validation fails with is not valid. Must be one of: ['default', 'sassy']. Consider normalizing empty to default (opts.mode = opts.mode or 'default').

Environment

  • Host: solveit (hosted notebook environment), Linux container
  • Python 3.12
  • shell-sage 1.0.9, installed editable from a git clone into an isolated venv (/app/data/aai-venv) — the system site-packages also has a stale shell-sage 1.0.9 which shadows the editable install for the default ssage binary
  • Tested in a detached tmux session (via the fastmux pyskill) to give ssage a real TTY
  • Config file: ~/.config/shell_sage/shell_sage.conf with mode = sassy, vendor_name = deepseek, model = deepseek-v4-flash

Dependency notes (may be relevant to maintainers)

  • The repo's pyproject.toml requires python-fastllm>=0.0.38, but the system environment had fastllm 0.0.36 (no StreamAccum) — one reason testing was done in a venv
  • The venv installed from local clones:
    • python-fastllm 0.0.41 (editable, from /app/data/git/fastllm)
    • fastcore 2.2.11 (editable, from /app/data/git/fastcore)
    • aidialog 0.0.19, fastspec 0.2.0 (satisfied via the fastllm install)
    • shell-sage 1.0.9 (editable, from /app/data/git/shell_sage)
  • Because solveit itself imports fastcore/aidialog/fastllm, packages were deliberately not installed into the system environment — only into the isolated venv
主要语言
Jupyter Notebook
星标
409
派生
44
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AnswerDotAI/shell_sage 的其他 Issue

查看 AnswerDotAI/shell_sage 的全部 Issue

相似的 Issue

更多 CLI Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。