Compare commits

...

6 Commits

Author SHA1 Message Date
Dotta
fdb20d5d08 Merge pull request #550 from mvanhorn/osc/529-fix-missing-agents-md-fallback
Some checks failed
Release / preview_stable (push) Has been cancelled
Release / publish_stable (push) Has been cancelled
Release / publish_canary (push) Has been cancelled
Release / verify_stable (push) Has been cancelled
Refresh Lockfile / refresh (push) Has been cancelled
Release / verify_canary (push) Has been cancelled
fix: graceful fallback when AGENTS.md is missing in claude-local adapter
2026-03-21 11:17:35 -05:00
Dotta
5bf6fd1270 Merge pull request #551 from mvanhorn/osc/272-fix-comment-image-attachments
fix: embed uploaded images inline in comments via paperclip button
2026-03-21 11:16:49 -05:00
Matt Van Horn
280536092e fix(adapters): add success log when agent instructions file is loaded
Matches the pattern in codex-local and cursor-local adapters,
giving operators consistent feedback about whether instructions
were actually loaded.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 09:07:26 -07:00
Matt Van Horn
2ba0f5914f fix(ui): escape brackets in filename and use paragraph break for inline images
Escape `[` and `]` in filenames to prevent malformed markdown when
attaching images. Use `\n\n` instead of `\n` so the image renders
as its own paragraph instead of inline with preceding text.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 09:02:20 -07:00
Matt Van Horn
d114927814 fix: embed uploaded images inline in comments via paperclip button
The paperclip button in comments uploaded images to the issue-level
attachment section but didn't insert a markdown image reference into
the comment body. Now it uses the imageUploadHandler to get the URL
and appends an inline image to the comment text.

Fixes #272

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 16:50:57 -07:00
Matt Van Horn
b41c00a9ef fix: graceful fallback when AGENTS.md is missing in claude-local adapter
The codex-local and cursor-local adapters already wrap the
instructionsFilePath read in try/catch, logging a warning and
continuing without instructions. The claude-local adapter was missing
this handling, causing ENOENT crashes when the instructions file
doesn't exist.

Fixes #529

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 16:46:48 -07:00
2 changed files with 26 additions and 9 deletions

View File

@@ -344,13 +344,23 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
// When instructionsFilePath is configured, create a combined temp file that
// includes both the file content and the path directive, so we only need
// --append-system-prompt-file (Claude CLI forbids using both flags together).
let effectiveInstructionsFilePath = instructionsFilePath;
let effectiveInstructionsFilePath: string | undefined = instructionsFilePath;
if (instructionsFilePath) {
const instructionsContent = await fs.readFile(instructionsFilePath, "utf-8");
const pathDirective = `\nThe above agent instructions were loaded from ${instructionsFilePath}. Resolve any relative file references from ${instructionsFileDir}.`;
const combinedPath = path.join(skillsDir, "agent-instructions.md");
await fs.writeFile(combinedPath, instructionsContent + pathDirective, "utf-8");
effectiveInstructionsFilePath = combinedPath;
try {
const instructionsContent = await fs.readFile(instructionsFilePath, "utf-8");
const pathDirective = `\nThe above agent instructions were loaded from ${instructionsFilePath}. Resolve any relative file references from ${instructionsFileDir}.`;
const combinedPath = path.join(skillsDir, "agent-instructions.md");
await fs.writeFile(combinedPath, instructionsContent + pathDirective, "utf-8");
effectiveInstructionsFilePath = combinedPath;
await onLog("stderr", `[paperclip] Loaded agent instructions file: ${instructionsFilePath}\n`);
} catch (err) {
const reason = err instanceof Error ? err.message : String(err);
await onLog(
"stderr",
`[paperclip] Warning: could not read agent instructions file "${instructionsFilePath}": ${reason}\n`,
);
effectiveInstructionsFilePath = undefined;
}
}
const runtimeSessionParams = parseObject(runtime.sessionParams);

View File

@@ -377,10 +377,17 @@ export function CommentThread({
async function handleAttachFile(evt: ChangeEvent<HTMLInputElement>) {
const file = evt.target.files?.[0];
if (!file || !onAttachImage) return;
if (!file) return;
setAttaching(true);
try {
await onAttachImage(file);
if (imageUploadHandler) {
const url = await imageUploadHandler(file);
const safeName = file.name.replace(/[[\]]/g, "\\$&");
const markdown = `![${safeName}](${url})`;
setBody((prev) => prev ? `${prev}\n\n${markdown}` : markdown);
} else if (onAttachImage) {
await onAttachImage(file);
}
} finally {
setAttaching(false);
if (attachInputRef.current) attachInputRef.current.value = "";
@@ -415,7 +422,7 @@ export function CommentThread({
contentClassName="min-h-[60px] text-sm"
/>
<div className="flex items-center justify-end gap-3">
{onAttachImage && (
{(imageUploadHandler || onAttachImage) && (
<div className="mr-auto flex items-center gap-3">
<input
ref={attachInputRef}