Files
a219fa50a0 improve(agents): stop agents refusing or arguing over requested work (#157447)
* improve(agents): stop prompt-side refusals for requested work

Drop the system prompt Safety section, the blanket credential ban, the external-content IGNORE list, and template ask-first/when-in-doubt rules. Runtime tool policy, sandboxing, and exec approvals already gate risk; the prompt now says requested actions with available tools are authorized.

* improve(agents): drop refusal prose from tools, skills, and SOUL template

Soften screen/app-UI and subagent-output notes, drop confirm-before and --yolo avoidance lines from skills, and let SOUL.md stop saying 'when in doubt, ask'. Bootstrap completion recognizes the previously shipped AGENTS.md/SOUL.md bytes so the template edit does not end a pending onboarding.

* test(agents): drop prompt wording pins

Delete tests that only asserted literal prompt/tool-description phrases; keep one discriminating assertion per input-dependent branch, cache/ordering invariants, boundary markers, and the refusal-trigger guard.

* fix(agents): keep legacy credential prompt result and align docs

Legacy string and unknown-availability callers of buildCredentialSafetyPrompt keep the documented handoff-only result; the credential-use line needs known control-tool availability. Update system-prompt and SDK migration docs for the Care section, and keep xurl auth checks on auth status.

* fix(agents): align remaining care guidance with requested work

Resolve contradictory workspace-template wording for requested representation and sharing, correct the bootstrap step count, and describe sandbox host access in terms of available tools and permissions.

Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>

* fix(agents): acknowledge supplied credentials after requested work

Complete requested credential use or storage, then give a brief factual acknowledgment without repeating the value. Preserve the action-oriented execution guidance and restore focused Workshop ownership and scoped cron lookup regression checks.

Validation: 372 targeted tests passed remotely; formatting, diff checks, and uncommitted autoreview passed.

* test(agents): align prompt snapshots and verify fetch spill recovery

Regenerate the Codex prompt fixtures for the current credential acknowledgment and cron guidance. Preserve the 800-character web-fetch budget while checking complete spill recovery and a single matching sanitized boundary pair.

Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>

* fix(agents): preserve source content in bounded fetch previews

---------

Co-authored-by: roboclaw-bot <309084314+roboclaw-bot@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Co-authored-by: joshavant <830519+joshavant@users.noreply.github.com>
2026-09-24 16:16:21 -05:00

2.5 KiB

name, description, metadata
name description metadata
python-debugpy Debug Python with pdb, breakpoint(), post-mortem inspection, and debugpy remote attach.
openclaw
requires
bins
python3

Python Debugpy

Use when Python code needs interactive debugging: hidden locals, confusing state mutation, failing tests, subprocesses, long-running services, or remote/headless attach.

Pick the smallest debugger that reaches the bad frame.

Choose

  • breakpoint(): local code, source edits ok, fastest path.
  • python3 -m pdb: no source edit, launch from the beginning.
  • python3 -m pdb -c continue: stop at an unhandled exception.
  • debugpy: remote/headless process, DAP client, already-running PID, or service startup race.

Commands

python3 -m pdb path/to/script.py arg1
python3 -m pdb -c continue path/to/script.py
python3 -c "import debugpy" || python3 -m pip install debugpy
python3 -m debugpy --listen 127.0.0.1:5678 --wait-for-client path/to/script.py
python3 -m debugpy --listen 127.0.0.1:5678 --wait-for-client -m package.module
python3 -m debugpy --listen 127.0.0.1:5678 --pid <pid>

For source-edit attach:

import debugpy

debugpy.listen(("127.0.0.1", 5678))
debugpy.wait_for_client()
debugpy.breakpoint()

For post-mortem:

import pdb, sys

try:
    run()
except Exception:
    pdb.post_mortem(sys.exc_info()[2])
    raise

pdb

  • Flow: n, s, r, c, q.
  • Stack/source: w, u, d, a, l, ll.
  • Values: p expr, pp expr, display expr.
  • Breakpoints: b file.py:42, b func, b file.py:42, condition, cl <num>.
  • Mutate/evaluate: !statement; full REPL: interact.

Rules

  • Reproduce with the smallest command/test first.
  • Disable parallel test workers for pdb; interactive stdin usually breaks inside worker pools.
  • Keep debugpy in the active env; do not add it as a project dependency unless the project already wants it.
  • Bind debug servers to 127.0.0.1; do not expose 0.0.0.0 unless isolated or tunnelled.
  • Use unique ports for parallel sessions.
  • debugpy --pid injects into a running process; confirm the target pid before attaching.
  • If PID attach fails on Linux, check ptrace/container privileges before changing the target.
  • Cleanup before commit: rg -n 'breakpoint\\(|pdb\\.set_trace|debugpy\\.' --type py.
  • Rerun the normal project test/gate without the debugger.
  • PYTHONBREAKPOINT=0 disables breakpoint().
  • If a process is stuck after debugger detach, confirm it is not still paused at a breakpoint.