Skip to content

Commit

Permalink
fix(autofix): Fix coding step rethinking (#1896)
Browse files Browse the repository at this point in the history
We were using the wrong memory key when rethinking in the coding step,
causing it to be missing the memory and error out.
  • Loading branch information
roaga authored Feb 10, 2025
1 parent 2747f20 commit 556ee9a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/seer/automation/autofix/components/coding/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,22 @@ def invoke(self, request: CodingRequest) -> CodingOutput | None:

custom_solution = request.solution if isinstance(request.solution, str) else None

if not request.initial_memory:
agent.memory.insert(
0,
Message(
role="user",
content=CodingPrompts.format_fix_msg(
has_tools=not is_obvious,
custom_solution=custom_solution,
mode=request.mode,
),
),
)

response = agent.run(
RunConfig(
system_prompt=CodingPrompts.format_system_msg(has_tools=not is_obvious),
prompt=CodingPrompts.format_fix_msg(
has_tools=not is_obvious, custom_solution=custom_solution, mode=request.mode
),
model=AnthropicProvider.model("claude-3-5-sonnet-v2@20241022"),
memory_storage_key="code",
run_name="Code",
Expand Down
4 changes: 2 additions & 2 deletions src/seer/automation/autofix/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def receive_user_message(request: AutofixUpdateRequest):
is_solution_step = step_to_restart.key == "solution_processing"
is_root_cause_step = step_to_restart.key == "root_cause_analysis_processing"
memory = (
context.get_memory("plan_and_code")
context.get_memory("code")
if is_coding_step
else (
context.get_memory("root_cause_analysis")
Expand Down Expand Up @@ -461,7 +461,7 @@ def restart_from_point_with_feedback(
is_solution_step = step_to_restart.key == "solution_processing"
is_root_cause_step = step_to_restart.key == "root_cause_analysis_processing"
memory = (
context.get_memory("plan_and_code")
context.get_memory("code")
if is_coding_step
else (
context.get_memory("root_cause_analysis")
Expand Down

0 comments on commit 556ee9a

Please sign in to comment.