Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/coding_agent_rl/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ async def generate(args, base_sample: Sample, sampling_params: dict[str, Any]):
)
return _abort_result(base_sample, f"exception:{type(e).__name__}", instance_id)
finally:
await state.adapter.finish_session(session_id) # idempotent
await state.adapter.drop_session(session_id) # cleanup only, idempotent


def _log_timeout_diagnostic(t0: float, instance_id: str) -> None:
Expand Down Expand Up @@ -282,7 +282,9 @@ def _abort_result(sample: Sample, reason: str, instance_id: str) -> list[Sample]
sample.response = ""
sample.response_length = 1
sample.loss_mask = [0]
sample.rollout_log_probs = [0.0]
sample.reward = 0.0
sample.remove_sample = True
sample.status = Sample.Status.ABORTED
sample.metadata = {**(sample.metadata or {}), "abort_reason": reason}
logger.warning("[coding_agent_rl] %s aborted: %s", instance_id, reason)
Expand Down
6 changes: 3 additions & 3 deletions examples/coding_agent_rl/run_qwen36_35b_a3b_swe_8nodes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ PERF_ARGS=(
)

ALGO_ARGS=(
--advantage-estimator gspo
--advantage-estimator grpo
--kl-loss-coef 0.00
--kl-loss-type low_var_kl
--kl-coef 0.00
--entropy-coef 0.00
--eps-clip 1e-4
--eps-clip-high 2e-4
--eps-clip 0.2
--eps-clip-high 0.28
)

OPTIMIZER_ARGS=(
Expand Down
7 changes: 6 additions & 1 deletion slime/agent/adapters/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ async def finish_session(
self,
sid: str,
*,
base_sample=None,
base_sample,
reward: float = 0.0,
extra_metadata: dict | None = None,
wait_timeout: float = 5.0,
Expand All @@ -264,6 +264,11 @@ async def finish_session(
)
return samples

async def drop_session(self, sid: str, *, wait_timeout: float = 5.0) -> None:
await self.shutdown_session(sid, wait_timeout=wait_timeout)
self.store.pop(sid, None)
self.manager.drop_session(sid)

# -- shared request pipeline ---------------------------------------------

def _check_turn_cap(self, sid: str) -> web.Response | None:
Expand Down
6 changes: 4 additions & 2 deletions slime/agent/harness/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ async def run_command(sb: Sandbox, *, workdir: str, start_cmd: str, env: dict[st
check=False,
)
if ec == 0:
exit_code = int((out or "").strip())
break
exit_code_text = (out or "").strip()
if exit_code_text:
exit_code = int(exit_code_text)
break
return exit_code


Expand Down
4 changes: 4 additions & 0 deletions slime/agent/trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ def get_trajectory(
self._turn_count.pop(sid, None)
return samples

def drop_session(self, sid: str) -> None:
self._trees.pop(sid, None)
self._turn_count.pop(sid, None)

# -------------------- internals ----------------------------------------

def _find_mount_point(self, root: MessageNode, messages: list[dict[str, Any]]) -> tuple[MessageNode, int]:
Expand Down
Loading