Copilot commented on code in PR #8586:
URL: https://github.com/apache/texera/pull/8586#discussion_r4050103385
##########
agent-service/src/agent/tools/workflow-execution-tools.ts:
##########
@@ -272,6 +275,7 @@ async function executeWorkflowHttp(
maxOperatorResultCharLimit: config.maxOperatorResultCharLimit ??
DEFAULT_AGENT_SETTINGS.maxOperatorResultCharLimit,
maxOperatorResultCellCharLimit:
config.maxOperatorResultCellCharLimit ??
DEFAULT_AGENT_SETTINGS.maxOperatorResultCellCharLimit,
+ ...(config.warehouseId !== undefined ? { warehouseId: config.warehouseId }
: {}),
Review Comment:
The final forwarding hop is untested: `workflow-execution-tools.spec.ts` has
no `warehouseId` assertion, while the added server and `TexeraAgent` tests stop
at the delegate/config boundary. Deleting this spread would leave the new tests
green but make enabled deployments reject every agent execution. Add
request-body tests for both a selected warehouse and the omitted-field case.
##########
agent-service/src/server.ts:
##########
@@ -492,6 +496,14 @@ export function buildApp() {
wsLog.info({ agentId, preview: msg.content.substring(0, 50) },
"received command");
+ // The prompt carries the workspace's current warehouse pick, so a
run
+ // uses what the user has selected now rather than whatever was
+ // selected when the agent was created. An absent field IS the
+ // current selection — none — so it clears a previous pick rather
+ // than leaving a stale id to be sent (and refused while the
feature
+ // is off) forever (#7751).
+ agent.setDelegateWarehouse(typeof msg.warehouseId === "number" ?
msg.warehouseId : undefined);
Review Comment:
Concurrent prompt handlers can overwrite the warehouse of a run already in
progress. The WebSocket endpoint accepts multiple clients and does not
serialize prompts; `TexeraAgent.sendMessage()` first awaits
`refreshWorkflowFromBackend()` and its execution tools later read the mutable
`delegateConfig`. A second prompt can therefore execute this line before the
first prompt runs a tool, causing the first run to write to the second prompt's
warehouse. Snapshot the warehouse per prompt/run (or atomically
reject/serialize overlapping prompts before mutating shared state) instead of
storing it as agent-wide mutable state.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]