-
Name Previous Value Current Value Priority
Normal
Major
-
-
| Type |
Enhancement
|
| Priority |
Major
|
| Assignee | |
| Labels |
No labels
|
Issue Votes (0)
| Name | Previous Value | Current Value |
|---|---|---|
Priority | Normal | Major |
| Type |
Enhancement
|
| Priority |
Major
|
| Assignee | |
| Labels |
No labels
|
TL;DR
Expose the AI model name configured on the AI user as a new environment variable in the Workspace Spec - e.g.
$TASK_MODEL- in the Command to Run Task, alongside the existing$TASK_PROMPT,$TASK_SYSTEM_PROMPT, and$TASK_USER_PROMPTvariables. This lets automation commands likeopencode run --model "$TASK_MODEL" --auto "$TASK_PROMPT"orclaude --model "$TASK_MODEL" ...pick up the configured model without hardcoding it.Priority:
major- this is actively burning through AI credits (see Motivation) and is time-sensitive.Problem
There is no variable exposing the name of the model to be used, so the run-task command cannot forward it to the coding agent's
--modeloption. Today the model name is configured on the AI user viaAiSetting.getModelSetting().getName()(server-core/src/main/java/io/onedev/server/model/support/AiModelSetting.java), but it is not surfaced to the task command.Request
Expose the AI model name as an environment variable available to the Command to Run Task, e.g.
$TASK_MODEL, and document it alongside the existing prompt variables. This would let commands such as:opencode run --model "$TASK_MODEL" --auto "$TASK_PROMPT"claude --dangerously-skip-permissions --model "$TASK_MODEL" --system-prompt "$TASK_SYSTEM_PROMPT" -p --verbose "$TASK_USER_PROMPT"pick up the model configured on the AI user without hardcoding it.
Motivation
--modelflag entirely - in which case the coding agent silently falls back to its own default, which is often a premium-priced model. Every automated task run then consumes more credits than intended, even when a cheaper model would suffice.AiSetting.getModelSetting().getName()), but the task command can't see it. Changing models currently means hand-editing every automation command instead of updating a single setting.opencodeorclaudeare forced to duplicate model configuration outside of OneDev, defeating the purpose of configuring it on the AI user.$TASK_MODELwould have an immediate, measurable impact on credit consumption.Background
When configuring Task Automation (workspace spec → Command to Run Task), the command currently has access to only the following environment variables, injected by the shell decorators:
$TASK_PROMPT– combined system + user prompt$TASK_SYSTEM_PROMPT– system prompt only$TASK_USER_PROMPT– user prompt onlyReference points:
server-core/src/main/java/io/onedev/server/model/support/workspace/spec/TaskAutomation.java(field description ofrunTaskCmd)server-core/src/main/java/io/onedev/server/model/support/workspace/spec/shell/PosixShell.java,PowerShell.java,WindowsBatchShell.java(decorateRunPromptCommand)Notes