-
Notifications
You must be signed in to change notification settings - Fork 305
fix: sub-session thinking state derived from child agent, not parent session #2149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,10 +74,13 @@ func (r *LocalRuntime) handleRunSkill(ctx context.Context, sess *session.Session | |
| AgentName: ca, | ||
| Title: "Skill: " + params.Name, | ||
| ToolsApproved: sess.ToolsApproved, | ||
| Thinking: sess.Thinking, | ||
| } | ||
|
|
||
| s := newSubSession(sess, cfg, a) | ||
| // Skills run as the same agent, so they inherit the session's current | ||
| // thinking state (which may have been toggled by the user via /think) | ||
| // rather than the agent's static config default. | ||
| s.Thinking = sess.Thinking | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 CRITICAL: Skill sub-session thinking state changes are lost after completion The code explicitly overrides Impact: If a user toggles thinking via Recommendation: Either restore back-propagation for skills specifically, or document that thinking toggles during skill execution are intentionally scoped to the skill only. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 CRITICAL: Unsynchronized read of sess.Thinking creates data race The code reads Impact: Data race that could cause undefined behavior, especially under concurrent skill execution or user commands. Recommendation: Either protect |
||
|
|
||
| return r.runSubSessionForwarding(ctx, sess, s, span, evts, ca) | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 CRITICAL: Back-propagation of thinking state removed affects skill execution
The removal of
parent.Thinking = child.ThinkingfromrunSubSessionForwarding()is correct for task transfers (where different agents have their own thinking config), but incorrect for skills (which run as the same agent and should maintain user thinking preferences).Impact: Skills inherit the initial thinking state via the explicit override at skill_runner.go:83, but user
/thinktoggles during skill execution won't persist to the parent session. This creates inconsistent behavior between task transfers (correct) and skills (bug).Recommendation: Add conditional back-propagation for skills, or refactor to use separate code paths for task transfers vs. skill execution.