Skip to content

fix(opencode): populate agent/model on task-tool subagent child sessions#30741

Closed
FlorianOtel wants to merge 2 commits into
anomalyco:devfrom
FlorianOtel:fix/task-agent-model
Closed

fix(opencode): populate agent/model on task-tool subagent child sessions#30741
FlorianOtel wants to merge 2 commits into
anomalyco:devfrom
FlorianOtel:fix/task-agent-model

Conversation

@FlorianOtel

Copy link
Copy Markdown

After ddc30cd made agent and model explicit inputs to Session.create(), the task.ts call site was never updated to pass them. The model value is already derived for the prompt invocation but sits after the create call. Child sessions ended up with NULL agent and model in the DB, breaking attribution for downstream consumers (telemetry, status-line, etc.).

Hoist the parent-message fetch and model derivation above sessions.create() so the values are available at row-creation time, then pass agent: next.name and model (converted to Session.Model's { id, providerID } shape) explicitly. The prompt-invocation model keeps its own { modelID, providerID } variable.

Adds regression tests (Tests A/B/C) in test/tool/task.test.ts.

Fixes regression introduced by: ddc30cd feat(core): add session metadata support (#23068)

Issue for this PR

Closes #30734

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

After ddc30cd made agent and model explicit inputs to Session.create(),
the task.ts call site was never updated to pass them. The model value is
already derived for the prompt invocation but sits after the create call.
Child sessions ended up with NULL agent and model in the DB, breaking
attribution for downstream consumers (telemetry, status-line, etc.).

Hoist the parent-message fetch and model derivation above sessions.create()
so the values are available at row-creation time, then pass agent: next.name
and model (converted to Session.Model's { id, providerID } shape) explicitly.
The prompt-invocation model keeps its own { modelID, providerID } variable.

Adds regression tests (Tests A/B/C) in test/tool/task.test.ts.

Fixes regression introduced by: ddc30cd feat(core): add session metadata support (#23068)

How did you verify your code works?

Local build + test + local deployment

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

After ddc30cd made agent and model explicit inputs to Session.create(),
the task.ts call site was never updated to pass them. The model value is
already derived for the prompt invocation but sits after the create call.
Child sessions ended up with NULL agent and model in the DB, breaking
attribution for downstream consumers (telemetry, status-line, etc.).

Hoist the parent-message fetch and model derivation above sessions.create()
so the values are available at row-creation time, then pass agent: next.name
and model (converted to Session.Model's { id, providerID } shape) explicitly.
The prompt-invocation model keeps its own { modelID, providerID } variable.

Adds regression tests (Tests A/B/C) in test/tool/task.test.ts.

Fixes regression introduced by: ddc30cd feat(core): add session metadata support (anomalyco#23068)
@FlorianOtel

Copy link
Copy Markdown
Author

Superseded by #30786 — see issue #30734 thread for details.

@FlorianOtel FlorianOtel closed this Jun 4, 2026
@FlorianOtel FlorianOtel deleted the fix/task-agent-model branch June 4, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression introduced by merged PR #23068 -- bug fix

1 participant