-
Answer
Short version: OneDev does not auto-inject Markdown reference syntax into the agent system prompt. Agents learn the useful forms mainly from the
todcompanion skills (and any custom system prompt / project instructions you add).1. Is this injected by the OneDev runtime?
No. For task automation, the runtime builds the prompt roughly as:
- A small fixed
### Rulesblock (e.g. that the agent is talking to an AI user, and to wait for sub-agents) - The AI user's optional system prompt from AI settings (if set)
- The
### Usertask text
There is no built-in injection of
issue #…/pr #…/build #…rules.Docs for context: Working with AI User (optional system prompt) and Working with Workspaces (templates ship
tod+ companion skills).2. Is there a schema/tool that enforces the Markdown syntax?
No enforcing schema or tool. Nothing validates comment text against OneDev reference syntax before posting.
What does exist:
todcompanion skills (onedev/todskills/) teach agents workflow conventions. In particular,work-on-issue/submit-issue-worktell the agent that when a comment mentions a pull request, use the exact formpr #<number>.- The
using-todskill documents CLI reference forms (123,#123,project#123,KEY-123). Those are fortodarguments, not a full Markdown linking guide.
Why prefixes matter (and a correction)
Issue / PR / build numbers are independent. In Markdown, a bare
#123is still recognized, but it is treated as an issue reference. So for PRs/builds you need an explicit type prefix, e.g.pr #45,build #67(alsopull request #45).Cross-project forms use project path or key before the number, with the type prefix in front when needed:
- Same project:
issue #45,pr #12,build #98 - Other project by path:
issue path/to/project#45,pr path/to/project#12 - Other project by key:
issue OD-45,pr OD-12(orOD-45for an issue)
The proposed
path/to/project#issue-45form is not the syntax OneDev parses.3. Recommended way to keep custom agents from falling back to GitHub-style
#123- Install
tod+ companion skills in the agent environment (workspace templates / images already do this; see tod skills README). - For stricter habit-forming, put short reference rules in the AI user's system prompt, and/or in project
AGENTS.md/ agent rules / a small custom skill—especially: never use bare#Nwhen you mean a PR or build; usepr #N/build #N. - Relying only on a default system-prompt append for every AI user is not how the product works today; that would be a product change rather than current behavior.
If this answers the question, we can close the issue. If you want the default system-prompt append implemented as a product change, say so and we can follow up.
- A small fixed
-
@servicedesk I do concede that a default system prompt append for AI users doesn't sound like it would be the best thing to do. It sounds like a workaround fix, and I'm trying to understand if there's a better fix. Would it be better to update the tod skills docs instead?
My only concern in doing it that way is that I have seen the ai agent not accurately use the TOD syntax. Hence the reason for my call to explicitly append the system prompt during workspace runtime.
Pros/cons? Your recommendation?
-
@zaakiy Yes — updating the
todcompanion skills is the better primary fix. Pros/cons and recommendation below.Skills docs vs system-prompt append
Update todskillsAppend to AI user system prompt Pros Ships with workspace/ todinstalls; loaded when agents run issue/PR workflows; versioned and reviewable; can document Markdown forms separately from CLI refsAlways present every turn for that AI user; may help when a skill isn't loaded or is skimmed Cons Advisory only — models can still ignore skills (matching what you've seen); sparse coverage today ( pr #<n>is mentioned in a few workflows, but there's no full Markdown linking section)Token cost on every prompt; applies even when not writing references; still not enforced; a product-wide default append is a product change and feels like a workaround (as you noted) Neither approach enforces syntax. Agents that mis-use references can ignore skills and system prompts. Hard guarantees would need validation/linting of posted text (a separate product feature).
Recommendation
-
Prefer improving
todskills as the main fix: add a clear Markdown reference section (same-projectissue #N/pr #N/build #N, cross-project forms, and “bare#Nmeans issue”) tousing-tod, and reinforce it in comment-drafting steps ofwork-on-issue/submit-issue-work. That targets the real gap — CLI refs are documented; Markdown linking for comments is only lightly covered. -
Use an optional system prompt (or project
AGENTS.md) only as site-level reinforcement if you still see failures after the skills update — short, high-signal rules, not a long append for every AI user by default. -
Do not make a default runtime system-prompt append the primary design; skills + optional local reinforcement is cleaner and matches how agents are already steered today.
If this recommendation works for you, we can close this question. If you'd like a follow-up to actually expand the
todskills (or explore comment-time validation), say which you prefer. -
-
@servicedesk please create an issue for option one. Please note that I believe it's not in this project. I believe it should be created in the tod project. https://code.onedev.io/onedev/tod
CC @robin
-
@zaakiy Created the follow-up for option one in the tod project: issue onedev/tod#9 (assigned to robin). Linked it as Related to this issue. Closing this question as answered — please continue any discussion there.
-
Previous Value Current Value Open
Closed
| Type |
Question
|
| Priority |
Normal
|
| Assignee | |
| Labels |
No labels
|
Summary
How do OneDev AI agents running in workspaces know how to construct links to issues, PRs, and builds?
Description
When an AI agent operates within a OneDev workspace, it often needs to reference other assets. However, OneDev requires explicit prefixes to prevent conflicts (e.g., writing
issue #123,pr #45, orbuild #67instead of just#123).If the agent needs to reference an asset in another project, it must use the cross-project syntax (e.g.,
path/to/project#issue-123).Questions
#123shorthand?Proposed Soution
The following text should be added by default to the system prompt of every AI user:
Append to System Prompt
Request
Create this as a new issue and submitted to @robin for approval