Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit 1fac094

Browse files
authored
feat(agent): tell cloud agents to upload deliverables as artifacts (#3944)
1 parent d117c82 commit 1fac094

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎packages/agent/src/server/agent-server.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3625,6 +3625,10 @@ Optimize for the fewest shell round trips.
36253625
- Read multiple files at once.
36263626
- Never rerun a command solely to reproduce output you already have.`;
36273627

3628+
const artifactInstructions = `
3629+
## Delivering non-code files (artifacts)
3630+
When you create a non-code file the user should be able to download (such as a report, chart, image, archive, or data file), call the \`upload_artifact\` tool with its path before your final reply. In your final reply, link to the download URL returned by the tool—never link to the file's local workspace path. Files left in the workspace don't reach the user. Don't upload source code or repository changes—those belong in a commit or PR.`;
3631+
36283632
const whyContextInstruction = ` - Add a brief **Why** to the body — one or two sentences capturing the reason the user asked for this change (the motivation, not a restatement of the diff). Keep it short.`;
36293633
const publicRepoSafetyInstruction = ` - **Public-repo safety.** Treat the target repository as public-readable unless you have verified otherwise. The PR title, description, and commit messages must not contain private operational scale (exact event counts, internal row volumes, customer-usage percentages), customer names / emails / companies, references to internal tickets or incidents, the contents of Slack threads (do not quote or paraphrase what was said), or unreleased roadmap details. Linking to the originating Slack thread is fine and encouraged — Slack links are auth-gated and useful as context — as are channel references like "raised in #team-foo". Describe findings qualitatively ("present on nearly all X events, absent from Y") rather than with quantitative figures pulled from analytics queries — the reasoning that uses those numbers can stay in the thread; the PR copy cannot.`;
36303634
const prMentionSafetyInstruction = ` - **Never guess a GitHub identity.** Do NOT \`@\`-mention, tag, assign, request review from, or attribute the PR to a person (in the title, description, commit message, or reviewers) using a name or handle taken from Slack or this thread. A Slack display name or handle is NOT a GitHub username. Finding a similar-looking handle in the repo's git history, CODEOWNERS, or existing PRs/issues does NOT confirm it belongs to this person: repository presence proves the handle exists, not that it is the person you mean, so treating it as a match still \`@\`-tags an unrelated account (e.g. Slack "Ross" is not necessarily GitHub \`@ross\`, even if some \`@ross\` has committed to the repo). Only \`@\`-mention a GitHub \`@handle\` the user gave you explicitly in this thread. Otherwise refer to people by plain-text name, or omit the mention entirely.`;
@@ -3652,7 +3656,7 @@ Do the requested work, but stop with local changes ready for review.
36523656
Important:
36533657
- Do NOT create new commits, push to the branch, or update the pull request unless the user explicitly asks.
36543658
- Do NOT create a new branch or a new pull request unless the user explicitly asks.
3655-
${signedCommitInstructions}${prLinkInstructions}${shellEfficiencyInstructions}
3659+
${signedCommitInstructions}${prLinkInstructions}${shellEfficiencyInstructions}${artifactInstructions}
36563660
`;
36573661
}
36583662

@@ -3673,7 +3677,7 @@ After completing the requested changes:
36733677
Important:
36743678
- Do NOT create a new branch or a new pull request unless the user explicitly asks.
36753679
- Do NOT push fixes for review comments without replying to and resolving each related thread.
3676-
${signedCommitInstructions}${prLinkInstructions}${shellEfficiencyInstructions}
3680+
${signedCommitInstructions}${prLinkInstructions}${shellEfficiencyInstructions}${artifactInstructions}
36773681
`;
36783682
}
36793683

@@ -3725,7 +3729,7 @@ ${publishInstructions}
37253729
37263730
Important:
37273731
- Prefer using MCP tools to answer questions with real data over giving generic advice.
3728-
${signedCommitInstructions}${prLinkInstructions}${shellEfficiencyInstructions}
3732+
${signedCommitInstructions}${prLinkInstructions}${shellEfficiencyInstructions}${artifactInstructions}
37293733
`;
37303734
}
37313735

@@ -3743,7 +3747,7 @@ ${publicRepoSafetyInstruction.trimStart()}
37433747
${prMentionSafetyInstruction.trimStart()}
37443748
- End the PR description with a horizontal rule followed by this footer line: ${prFooter}
37453749
- Always create the PR as a draft.
3746-
${signedCommitInstructions}${prLinkInstructions}${shellEfficiencyInstructions}
3750+
${signedCommitInstructions}${prLinkInstructions}${shellEfficiencyInstructions}${artifactInstructions}
37473751
`;
37483752
}
37493753

@@ -3771,7 +3775,7 @@ ${prFooter}
37713775
37723776
Important:
37733777
- Always create the PR as a draft. Do not ask for confirmation.
3774-
${signedCommitInstructions}${prLinkInstructions}${shellEfficiencyInstructions}
3778+
${signedCommitInstructions}${prLinkInstructions}${shellEfficiencyInstructions}${artifactInstructions}
37753779
`;
37763780
}
37773781

0 commit comments

Comments
 (0)