openai-sdk: empty systemPrompt produces trailing blank lines in agent instructions
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ả
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của joewalker/loop-the-loop
-
bug S4
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
joewalker/loop-the-loop#88 ·
-
Git exec(): child killed by a signal rejects with new Error('') and loses the signal informationĐang mởbug S3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
joewalker/loop-the-loop#84 ·
-
bug S3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
joewalker/loop-the-loop#83 ·
-
bug S3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
joewalker/loop-the-loop#82 ·
-
bug S4
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
joewalker/loop-the-loop#79 ·
Tất cả issue của joewalker/loop-the-loop
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
gnosis/gnosis_vpn#661 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
content-freshness: staleOwnedContent doc comments still say 'complete receipt' (follow-up to #7912)Đang mởtriage:bug-verified
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 1 ngày
-
fix: reject sourceStorage/packagedStorage bucket that differs from the stack default (fail loud)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Eyevinn/open-videocore#1300 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
nextjs-tracking
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
cloudflare/vinext#4390 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kind/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
kubernetes-sigs/headlamp#8175 ·
Maintainer thường phản hồi trong vòng 2 ngày