Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#38 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
ai

Hướng nghiên cứu

Bắt đầu trong src/agents/openai-sdk.ts tại buildInstructions và kiểm tra cách systemPrompt được nối với baseInstructions. Bổ sung kiểm thử cho các prompt rỗng và chỉ chứa khoảng trắng, xác minh rằng đầu ra của chúng khớp với trường hợp undefined và không có dòng trống ở cuối.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
2
Fork
1
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của joewalker/loop-the-loop

Tất cả issue của joewalker/loop-the-loop

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.