Skip to content

Infra: PyBullet env-leak fix, adaptive-thinking SDK, scene-snapshot guard#46

Merged
yichao-liang merged 4 commits into
masterfrom
pr1-infra
Jul 7, 2026
Merged

Infra: PyBullet env-leak fix, adaptive-thinking SDK, scene-snapshot guard#46
yichao-liang merged 4 commits into
masterfrom
pr1-infra

Conversation

@yichao-liang

@yichao-liang yichao-liang commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Stacked PR - merge bottom-up. This branch targets the PR below it, so its diff shows only its own changes.

  1. Infra: PyBullet env-leak fix, adaptive-thinking SDK, scene-snapshot guard #46 Infra fixes (base: master)
  2. Domino: goal-NL cleanup + relax Toppled threshold to 30 deg #47 Domino tuning (base: Infra: PyBullet env-leak fix, adaptive-thinking SDK, scene-snapshot guard #46)
  3. SysID: PHYSICAL_PARAMS system identification via free-running rollout fit #48 SysID / PHYSICAL_PARAMS (base: Domino: goal-NL cleanup + relax Toppled threshold to 30 deg #47)
  4. Fan env: grid-free agent + GT hybrid (wind) simulator #49 Fan env (base: SysID: PHYSICAL_PARAMS system identification via free-running rollout fit #48)
  5. predicatorv3 configs: thin launchers, exp splits, shared use_gt_helpers #50 predicatorv3 configs (base: Fan env: grid-free agent + GT hybrid (wind) simulator #49)
  6. Add pybullet_bridge glue-construction domain #51 Bridge domain (base: predicatorv3 configs: thin launchers, exp splits, shared use_gt_helpers #50)
    Independent infrastructure / bug fixes, extracted as the base of a 6-PR stack off the domino-sysid-feature work. No behavioral coupling to the domain work above it.

Commits

  • Fix PyBullet env leak in get_gt_options - get_gt_options was spinning up (and leaking) two PyBullet worlds per call (a sim world + a robot-init world). Share them through shared_skill_simulator / shared_skill_robot caches in skill_factories/base.py. Root cause of ~12GB OOM growth over a run.
  • Agent SDK: adaptive thinking replaces budget_tokens - budget_tokens was removed on sonnet-5; switch the sandbox/session runners to adaptive thinking driven by agent_sdk_reasoning_effort.
  • Scene images: stop replans clobbering init snapshots - guard the init-state snapshot so a replan no longer overwrites it, and render explore-phase inits.

Base of the stack; targets master.

…worlds

Every get_gt_options() call leaked ~145MB of PyBullet C-heap that could
never be freed (nothing calls p.disconnect): _build_skill_config built a
fresh motion-planning simulator env per call when
skill_phase_use_motion_planning is on, and get_options additionally ran
env_cls.initialize_pybullet() per call just to obtain the SkillConfig
robot handle (leaked even with the flag off). min_block_utils'
_get_push_option calls get_gt_options once per K* probe, so domino
min-block task generation leaked 10+GB per run and OOM'd a 16GB machine.

Fix: process-wide shared_skill_simulator/shared_skill_robot caches (one
world per env class) in skill_factories/base.py, used by the five
factories that had the pattern (domino, boil, grow, coffee, fan).
Sharing is safe because _plan_with_simulator re-syncs the full state via
_set_state before every query. update_config_with_parser clears the
caches on config changes (env construction reads CFG), looked up via
sys.modules so processes that never use skills never load pybullet.

Verified: get_gt_options x10 flat (was +145MB/call); K* probe loop
byte-flat with identical K* results (was +140MB/probe); min-block task
generation 2.53GB -> 0.64GB RSS.
…t-5)

With agent_sdk_model_name now claude-sonnet-5, the old
thinking={type: enabled, budget_tokens: N} config is rejected with a 400
on every request (removed API surface, not just deprecated). Pass
thinking={type: adaptive} at all four sandbox call sites and drop the
agent_sdk_thinking_budget_tokens setting; deliberation depth is now
controlled solely via agent_sdk_reasoning_effort.
…inits

_render_initial_state_image fired on every agent query -- including
mid-episode replans rooted at the current, partially-executed state --
and wrote the same task{N}_initial_state.png, so post-hoc "init" images
showed already-toppled dominoes. A per-episode render counter (reset in
reset_for_new_episode, which CogMan never calls on replans) now names
replan renders task{N}_replan{K}_state.png, and _initial_image_section
references whichever file the current query actually saved, so replan
prompts point at the current scene instead of the stale init.

Also extract the render logic into bilevel_sketch.save_task_state_image
and use it from AgentBilevelExplorer, which now saves
train_task{N}_initial_state.png and injects the same "read this image
first" prompt section into explore queries that test solves get.
@yichao-liang yichao-liang merged commit 7961b7d into master Jul 7, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant