Skip to content

Commit

Permalink
🐛 Added back the reset of the repository before we send the response …
Browse files Browse the repository at this point in the history
…back (#671)

* Adding back the reset of the repository before we send the response back

* This was causing bugs on the front end, where the files being read from
  disk, were not the reset versions, and therefore the patches were
failing.

* The internals of the reset, should still allow for multiple calls,
  this should not hurt anything and we still get the benifit of
resetting on exception.

Signed-off-by: Shawn Hurley <shawn@hurley.page>

* Fixed using ExitStack semantics

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>

---------

Signed-off-by: Shawn Hurley <shawn@hurley.page>
Signed-off-by: JonahSussman <sussmanjonah@gmail.com>
Co-authored-by: Shawn Hurley <shawn@hurley.page>
  • Loading branch information
JonahSussman and shawn-hurley authored Feb 19, 2025
1 parent 47ee50b commit 4daeed1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions kai/rpc_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,12 @@ def get_codeplan_agent_solution(

chatter.get().chat_simple("Getting solution!")

overall_result = GetCodeplanAgentSolutionResult(
encountered_errors=[],
modified_files=[],
diff="",
)

# ExitStack calls its callbacks in reverse order upon exiting the with
# block, **even if an exception is raised**.
with ExitStack() as defer:
Expand Down Expand Up @@ -572,12 +578,6 @@ def get_codeplan_agent_solution(
params.max_iterations, app.task_manager.get_next_task
)

overall_result = GetCodeplanAgentSolutionResult(
encountered_errors=[],
modified_files=[],
diff="",
)

initial_solved_tasks = app.task_manager.processed_tasks
initial_ignored_tasks = set(app.task_manager.ignored_tasks)

Expand Down Expand Up @@ -636,10 +636,10 @@ def get_codeplan_agent_solution(

chatter.get().chat_simple("Finished!")

server.send_response(
id=id,
result=overall_result.model_dump(), # Must dump as a dict for some reason?
)
server.send_response(
id=id,
result=overall_result.model_dump(), # Must dump as a dict for some reason?
)


P = ParamSpec("P")
Expand Down

0 comments on commit 4daeed1

Please sign in to comment.