Skip to content

fix(code): stop replaying accepted /goal objective as a user turn - #4944

Closed
Mason Daugherty (mdrxy) wants to merge 5 commits into
mainfrom
open-swe/code-goal-objective-no-replay
Closed

fix(code): stop replaying accepted /goal objective as a user turn#4944
Mason Daugherty (mdrxy) wants to merge 5 commits into
mainfrom
open-swe/code-goal-objective-no-replay

Conversation

@mdrxy

Copy link
Copy Markdown
Member

When a newly created /goal's acceptance criteria are approved, the objective is no longer echoed and re-submitted a second time.


Previously, accepting the proposed criteria for a brand-new goal replayed the objective through _handle_user_message, which mounted a second > <objective> user message and re-sent the text — even though the objective was already shown in the /goal <objective> command echo. The result was the same text appearing twice in the transcript.

Goal creation now continues work the same way amendments and resumes already do, via the hidden _continue_goal_work control message that points the model at get_goal. Nothing objective-related is re-shown or re-submitted as a visible user turn, and the behavior stays consistent between a live session and a reloaded thread.

Made by Open SWE

Once a newly created goal's acceptance criteria are approved, the
objective was re-submitted and re-rendered as a second `> <objective>`
user message on top of the `/goal <objective>` command echo, so the
same text appeared twice. Goal creation now continues through the same
hidden control message used by amend/resume (`_continue_goal_work`),
pointing the model at `get_goal` instead of replaying the objective.

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
@github-actions github-actions Bot added dcode Related to `deepagents-code` fix A bug fix (PATCH) internal User is a member of the `langchain-ai` GitHub organization open-swe size: S 50-199 LOC labels Jul 22, 2026
@mdrxy
Mason Daugherty (mdrxy) marked this pull request as ready for review July 22, 2026 04:37

@open-swe open-swe Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open SWE Review found 1 potential issue.

Open in WebView Open SWE trace

Comment thread libs/code/deepagents_code/app.py Outdated
@mdrxy

Copy link
Copy Markdown
Member Author

Superseded by #4980.

The replacement preserves this PR’s fix for the duplicate objective/user turn, but implements the post-acceptance continuation together with the durable goal-state notice from #4412. This gives persistence, restoration, summarization, transcript filtering, and the get_goal handoff one coordinated contract, including the persistence-failure case identified in review.

Closing this PR in favor of #4980.

Mason Daugherty (mdrxy) added a commit that referenced this pull request Jul 23, 2026
Supersedes #4412
Supersedes #4944

Accepted goals now transition into agent work through one coordinated
internal protocol: a durable notice records the authoritative goal
state, while a hidden continuation resumes work without replaying the
objective as another user message.

---

The previous PRs addressed two symptoms at the same transition. #4944
changed how work resumes after goal acceptance, while #4412 introduced
persisted notices that tell the agent when goal tools are relevant.
Landing them independently would create overlapping internal-message
lifecycles with separate persistence, restoration, summarization, and
transcript-filtering behavior.

This replacement gives the two message types explicit roles:

- The goal-state notice is the durable source of truth.
- The continuation is a one-time trigger emitted only after that state
is available.

It also handles persistence failure without directing the agent to
nonexistent saved state and keeps all internal goal-control messages out
of user-visible and grader transcripts. Goal-specific filtering remains
in `deepagents-code`; the replacement does not change the Deep Agents
SDK.
Marcelo5444 pushed a commit to Marcelo5444/deepagents that referenced this pull request Jul 30, 2026
Supersedes langchain-ai#4412
Supersedes langchain-ai#4944

Accepted goals now transition into agent work through one coordinated
internal protocol: a durable notice records the authoritative goal
state, while a hidden continuation resumes work without replaying the
objective as another user message.

---

The previous PRs addressed two symptoms at the same transition. langchain-ai#4944
changed how work resumes after goal acceptance, while langchain-ai#4412 introduced
persisted notices that tell the agent when goal tools are relevant.
Landing them independently would create overlapping internal-message
lifecycles with separate persistence, restoration, summarization, and
transcript-filtering behavior.

This replacement gives the two message types explicit roles:

- The goal-state notice is the durable source of truth.
- The continuation is a one-time trigger emitted only after that state
is available.

It also handles persistence failure without directing the agent to
nonexistent saved state and keeps all internal goal-control messages out
of user-visible and grader transcripts. Goal-specific filtering remains
in `deepagents-code`; the replacement does not change the Deep Agents
SDK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dcode Related to `deepagents-code` fix A bug fix (PATCH) internal User is a member of the `langchain-ai` GitHub organization open-swe size: S 50-199 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant