Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

openai-sdk: empty systemPrompt produces trailing blank lines in agent instructions

オープン 初心者向け
#38 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
typescript
領域
ai

調査の方向性

src/agents/openai-sdk.ts の buildInstructions から始め、systemPrompt が baseInstructions とどのように結合されているかを確認します。空のプロンプトと空白文字のみのプロンプトのテストを追加し、それらの出力が undefined の場合と一致し、末尾に空行がないことを検証します。

索引モデルが issue の本文から書いたものです。

説明

bug S4

Observed behavior

buildInstructions in src/agents/openai-sdk.ts only branches on systemPrompt === undefined:

return systemPrompt === undefined
  ? baseInstructions
  : `${baseInstructions}\n\n${systemPrompt}`;

When systemPrompt is the empty string (or whitespace-only), the join produces ...this mode.\n\n and the resulting instructions value ends with trailing blank lines.

import { buildSandboxAgentOptions } from 'loop-the-loop/agents/openai-sdk';
const opts = buildSandboxAgentOptions({ systemPrompt: '' }, false, '/repo');
console.log(/\n\s*$/.test(opts.instructions));  // true

This mirrors the codex-cli issue fixed in #17.

Expected behavior

An empty or whitespace-only systemPrompt should be treated as if it were omitted, so the rendered instructions match the systemPrompt === undefined output exactly (no trailing blank lines, no extra separator).

Possible fix

const trimmed = systemPrompt?.trim();
return trimmed ? `${baseInstructions}\n\n${trimmed}` : baseInstructions;

Add a test that passes systemPrompt: '' and asserts the result equals the undefined case.

Severity: S4. Trailing whitespace is cosmetic and unlikely to confuse the model, but the inconsistency is easy to fix.

主要言語
TypeScript
スター
2
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

joewalker/loop-the-loop のほかの issue

joewalker/loop-the-loop の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。