Skip to content

fix(shell): cd の存在しないパスで external_directory を要求しない - #60

Open
yukihamada wants to merge 1 commit into
headless-model-fallbackfrom
fix-cd-missing-path
Open

yukihamada wants to merge 1 commit into
headless-model-fallbackfrom
fix-cd-missing-path

Conversation

@yukihamada

Copy link
Copy Markdown
Owner

内容

cd /privat のように存在しないディレクトリへ移動しようとすると、シェル内で失敗するだけなのに external_directory の許可(/*)を要求していました。

原因

packages/sente/src/tool/shell.ts のパススキャンが、対象がディレクトリでない場合に path.dirname(resolved) を外部ディレクトリとして登録していました。cd /privat は / に解決されるため、ルート全体の許可要求になっていました。

修正

  • cd 系コマンド(CWD)で対象が実在するディレクトリでない場合は、スキャン対象に加えないようにしました。cd ../ や外部の実在ディレクトリへの移動は従来どおり要求します。
  • あわせて、タイトル生成の失敗が Effect.orDie + Effect.ignore で完全に無音になっていたのを、警告ログに残すよう変更しました。既定タイトルのまま残る原因を追えるようにするためです。

検証

  • 追加した回帰テスト: does not ask for external_directory when cd targets a missing path
  • bun test test/tool/shell.test.ts test/session/title.test.ts → 30 pass / 0 fail
  • bun typecheck → 成功

未確認

タイトルが「消える」現象そのものは、手元のログとDBでは再現できませんでした(failed to generate title は0件、直近20セッションはすべてタイトルあり)。生成失敗の可視化までを本PRの範囲としています。

存在しないパスへの cd はシェル内で失敗するだけで何にも触れないが、
パススキャンが親ディレクトリを外部扱いして / 全体の許可を求めていた。
あわせてタイトル生成の失敗を無音にせず警告ログに残す。
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@yukihamada

Copy link
Copy Markdown
Owner Author

CI の unit 失敗について(既存の失敗)

unit (linux) / unit (windows) が赤ですが、今回の差分に起因する失敗ではありません。

今回の差分での検証

  • bun test test/tool/shell.test.ts test/session/title.test.ts → 30 pass / 0 fail
  • bun typecheck → 成功
  • check-standards / check-compliance → pass

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant