Skip to content

The agent that grows with you

fix(unbroker): dnc --declined hint, single digest entry for dead parked tasks

kshitijk4poora4ed3b3493e8
diff --git a/optional-skills/security/unbroker/SKILL.md b/optional-skills/security/unbroker/SKILL.md
index 1a46b883e2e..3ecccb61433 100644
--- a/optional-skills/security/unbroker/SKILL.md
+++ b/optional-skills/security/unbroker/SKILL.md
@@ -255,8 +255,9 @@ recording `found` and before any deletion.
exists - the **rescue lane** (verified Whitepages pattern). Draft-only falls back to
`render-email` + a digest entry.
- **captcha** → soft/managed challenges clear automatically on the default cloud browser (proceed
- as normal); only a hard interactive/behavioral challenge it can't pass is recorded `blocked`
- (requeued for the stealth/operator-browser pass). Never a solver service.
+ as normal); a hard interactive/behavioral challenge it can't pass is recorded
+ `human_task_queued` with the reason (a `blocked` case re-scans, re-finds the listing and
+ re-queues the opt-out). Never a solver service.
- **phone_callback / account / gov_id / fax / mail / voice (T3)** *without a deletion email* →
never an agent action; `next` already routed these to the digest. Record them:
`$PDD record <subject> <broker> human_task_queued --reason "..."`.
diff --git a/optional-skills/security/unbroker/scripts/autopilot.py b/optional-skills/security/unbroker/scripts/autopilot.py
index 340eaf8dbd8..30c18dbfb1d 100644
--- a/optional-skills/security/unbroker/scripts/autopilot.py
+++ b/optional-skills/security/unbroker/scripts/autopilot.py
@@ -485,7 +485,7 @@ def next_actions(dossier: dict, brokers_list: list[dict], cfg: dict,
# 7) anything already parked as a human task
for bid, case in sorted(ledger.items()):
- if case.get("state") == "human_task_queued":
+ if case.get("state") == "human_task_queued" and bid not in defunct_ids: # 3b closes those
broker = by_id.get(bid) or {}
digest.append(_digest({"broker_id": bid, "broker_name": broker.get("name") or bid},
case.get("human_task_reason") or "queued manual step",
diff --git a/optional-skills/security/unbroker/scripts/pdd.py b/optional-skills/security/unbroker/scripts/pdd.py
index f1f2939eb3d..30a6a6fdabd 100644
--- a/optional-skills/security/unbroker/scripts/pdd.py
+++ b/optional-skills/security/unbroker/scripts/pdd.py
@@ -504,7 +504,7 @@ def cmd_dnc(args) -> None:
"Sales calls stop within 31 days; registration never expires (personal numbers "
"only -- business/fax lines are not covered).",
f"After submitting, run `dnc {args.subject} --filed` so the loop stops "
- "re-surfacing it (or `dnc {args.subject} --declined` if the subject opts out).",
+ f"re-surfacing it (or `dnc {args.subject} --declined` if the subject opts out).",
] if eligible else [
"The National Do Not Call Registry covers US (NANP) personal numbers only; this "
"subject has no US residency or no eligible US number on file.",
diff --git a/tests/skills/test_unbroker_skill.py b/tests/skills/test_unbroker_skill.py
index 48e4f11ab50..da4c5b37900 100644
--- a/tests/skills/test_unbroker_skill.py
+++ b/tests/skills/test_unbroker_skill.py
@@ -725,6 +725,7 @@ def test_dnc_one_shot_surfaced_once_then_filed():
assert out["eligible"] is True
assert out["dnc_url"] == "https://www.donotcall.gov/register.html"
assert "72 hours" in " ".join(out["steps"])
+ assert f"dnc {sid} --declined" in " ".join(out["steps"])
q = autopilot.next_actions(dossier.load(sid), [], _auto_cfg(), {}, env={})
act = next(a for a in q["actions"] if a["type"] == "dnc_register")
assert act["confirm_first"] is True # a new registry disclosure always asks
@@ -882,6 +883,12 @@ def test_defunct_brokers_excluded_from_all_planning():
assert ("verify_removal", "livebroker") in kinds # live brokers still recheck
close = [t for t in q["human_digest"] if "deadbroker" in _json.dumps(t)]
assert close and "not_found" in _json.dumps(close)
+ # a dead broker parked as a human task gets the close-out only, not a manual step too
+ led["deadbroker"] = {"broker_id": "deadbroker", "state": "human_task_queued",
+ "human_task_reason": "needs fax"}
+ q2 = autopilot.next_actions(d, bl, _auto_cfg(), led, env={})
+ parked = [t for t in q2["human_digest"] if "deadbroker" in _json.dumps(t)]
+ assert len(parked) == 1 and "not_found" in _json.dumps(parked)
def test_full_autonomy_note_honors_confirm_first():
diff --git a/website/docs/user-guide/skills/optional/security/security-unbroker.md b/website/docs/user-guide/skills/optional/security/security-unbroker.md
index c9b2e50d0a8..42198d5d9b9 100644
--- a/website/docs/user-guide/skills/optional/security/security-unbroker.md
+++ b/website/docs/user-guide/skills/optional/security/security-unbroker.md
@@ -269,8 +269,9 @@ recording `found` and before any deletion.
exists - the **rescue lane** (verified Whitepages pattern). Draft-only falls back to
`render-email` + a digest entry.
- **captcha** → soft/managed challenges clear automatically on the default cloud browser (proceed
- as normal); only a hard interactive/behavioral challenge it can't pass is recorded `blocked`
- (requeued for the stealth/operator-browser pass). Never a solver service.
+ as normal); a hard interactive/behavioral challenge it can't pass is recorded
+ `human_task_queued` with the reason (a `blocked` case re-scans, re-finds the listing and
+ re-queues the opt-out). Never a solver service.
- **phone_callback / account / gov_id / fax / mail / voice (T3)** *without a deletion email* →
never an agent action; `next` already routed these to the digest. Record them:
`$PDD record <subject> <broker> human_task_queued --reason "..."`.