Repository navigation
fix(portal): failed background turns report a person-safe sentence, never the raw error (abilityai/trinity#4482) - #4553
Conversation
…ever the raw error (#4482) A platform-started turn that failed on a refused credential posted the execution row's error into the person's Workspace thread: the subscription walk trail ("Tried: <subscription> (auth); every candidate refused.") and operator guidance ("Check subscription token or API key configuration"). Slack/Telegram completion reports and the Workspace Work card did the same. - services/channel_completion_report.person_safe_failure maps a non-success terminal to a fixed sentence: cancelled, usage limit (the walk trail only), timeout, or generic. An agent's turn refusal (ent#926) is the one text passed through, sanitized and capped. A failed refusal check falls back to the generic sentence, never raw text. - _portal_body and _summarize use it for every non-success report; success text is unchanged. - The Work card error uses it; work_outcome still reads the raw error so a timeout stays a timeout. The now-unused clean_error is removed. - The own-turn auth_switched message no longer names the new subscription. The raw error stays on the execution row and the operator alert. Fixes #4482 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/review + /validate-pr — REQUEST CHANGES (head
|
| changed symbol | executed by | live consumer | verdict |
|---|---|---|---|
person_safe_failure (src/backend/services/channel_completion_report.py:143) |
test_4482_person_safe_failure.py (direct cases: trail ×3, own failed call ×4, timeout, cancelled, refusal, generic, check-raises) |
_summarize :186, _portal_body :649, client_portal/work/service.py:324 |
executed |
_portal_body non-success branch (:649) |
test_4482::test_portal_body_never_shows_the_trail, test_ent457::test_a_failure_says_so_rather_than_vanishing, test_ent610::test_a_resumed_turn_is_told_its_background_task_came_back[failed] |
_resolve_portal :459 |
executed (mutation M1: 6 red) |
_summarize non-success branch (:186) |
test_4482::test_slack_and_telegram_summary_never_shows_the_trail, test_265::test_telegram_failure_terminal_reports (through report_completion and the real Telegram resolver) |
_resolve_slack :242, _resolve_telegram :321 |
executed (M2: 5 red). No Slack failure goes through report_completion in a test; the function is shared |
_person_safe_error / WorkItem.error (client_portal/work/service.py:318,323) |
test_4482::test_work_card_error_is_person_safe, ::test_work_card_keeps_the_timeout_outcome, test_ent525::test_projection_fields |
_project → Work feed → src/frontend/src/components/portal/PortalWorkCard.vue:130 |
executed (M3: 3 red) |
TIMEOUT_RE (moved to channel_completion_report.py:133) |
test_4482::test_work_card_keeps_the_timeout_outcome |
client_portal/work/service.py:131 |
executed |
auth_switched wording (client_portal/service.py:3600) |
test_4482::test_the_own_turn_switch_message_never_names_the_subscription (slices the branch out of inspect.getsource and execs it) |
the branch itself | executed (M4: 1 red); the slice is anchored on two literal strings, so it is brittle |
clean_error removed |
— | no reference left under src/ (grep) |
fine |
wiring: terminal writers → report_completion → resolver |
test_265, test_3295 drive report_completion |
task_execution_service.py:1399,3619,3787, chat_execution_service.py:1296,1395, pull_coordination_service.py:903 |
executed, and test_3295 is the red one (C1) |
Fix mutation (proved). In a scratch worktree at the PR head:
- All three backend files reverted to the merge-base, tests kept, the six new/changed test files run: 25 failed, 210 passed (235 pass at head). 22 of the 23 new tests go red; the one that stays green is
test_success_text_is_still_reported, a control that is meant to hold either way. The three updated older tests (test_265,test_ent457,test_ent610[failed]) also go red. - Because a full revert also removes the helper, seven call-site mutations were run with the helper left in place (nine test files, 369 pass at head): M1
_portal_bodyback to_sanitized_detail→ 6 red; M2_summarizeback → 5 red; M3 Work card back to the row error → 3 red; M4 switch message names the subscription → 1 red; M5 the refusal-checkexceptreturns the raw text → 1 red; M6 trail regex disabled → 10 red; M7 cancelled branch disabled → 1 red. No mutation stayed green.
Pinned guards. The diff adds or removes no route, protected path or registry entry. The guards that read the touched modules were run at head and pass (test_ent279_scrub_parity, test_1804_terminal_activity_parity, test_186_enumeration_uniformity, test_models_centralized, test_4284_no_exception_text_in_5xx, test_2338_journey_catalog, test_2306_architecture_split, test_937_ent781_census). The full ~219-file guard list was not run (see Not checked).
Sinks
| sink | status | file:line |
|---|---|---|
| Workspace thread message from a completion report (schedule delivery, delegated child, approved gate run, chat report-back) | fixed by this PR | src/backend/services/channel_completion_report.py:649 |
Inbox row / sidebar preview of a completion:failed message |
fixed for new rows (it previews the stored body). Rows written before the fix keep the raw text (I3) | src/backend/client_portal/chat_previews.py:46 |
Replay of the report into the agent's next turn ([Background task report: …]) |
fixed by this PR | tests/unit/test_ent610_inbox.py:707 pins it |
| Slack and Telegram completion reports | fixed by this PR | channel_completion_report.py:186 |
Work card error (1:1 and rooms) |
fixed by this PR | src/backend/client_portal/work/service.py:318 |
Own-turn auth_switched message |
fixed by this PR | src/backend/client_portal/service.py:3600 |
| Person-started Workspace turn (sync and streaming verdict) | already safe: closed category set, fixed copy | src/backend/client_portal/service.py:3542-3660, :4550-4569 |
| Inline channel turn (Slack, Telegram, WhatsApp) | already safe: fixed lines | src/backend/adapters/message_router.py:927-930 |
| Public link, sync and status poll | already safe: fixed lines | src/backend/services/public_chat_service.py:78-97, src/backend/routers/public.py:876-883 |
| Read-aloud / direct voice | already safe: a failed turn speaks a fixed line; read-aloud speaks text the page already shows | src/backend/services/direct_voice_service.py:571 |
/ws events to a Workspace-only account |
already safe: field allowlist (type, event, agent_name, activity_state) |
src/backend/services/ws_identity_service.py:43 |
| Workspace agent page "recent work" | already safe: no error field projected | src/backend/client_portal/agent_page.py:384-392 |
already safe: only sign-in codes and invites are mailed (grep of email_service callers) |
src/backend/services/email_service.py:111,270 |
|
| Room system line when an agent's room turn fails | STILL LEAKS (S1, predates the PR) | src/backend/shared_sessions/service.py:2310-2313 |
GET /api/agents/{name}/loops payload (error, runs[].error) |
STILL LEAKS in the payload; the Workspace loops panel does not render the field (S2, predates the PR) | src/backend/routers/loops.py:93,108,270-271 |
| A2A inbound task failure to an external peer | still returns the raw error; caller-started, so outside this issue (I7) | src/backend/routers/a2a.py:1609-1613,1859 |
| Agent-mediated: caller wake and the task-terminal event | unchanged: the calling agent is handed the raw row error (I6) | src/backend/services/caller_wake_service.py:368 |
| Operator surfaces (execution row, log line, pool-exhausted alert) | unchanged, raw text kept (read: the diff touches no writer of the row) | src/backend/services/task_execution_service.py:3275,3380, src/backend/services/subscription_auto_switch.py:1524-1540 |
Critical
- An existing unit test is red at the PR head and was not updated —
tests/unit/test_3295_chat_report_back.py:402(Confidence 10/10).TestDelivery::test_a_failure_terminal_reports_tooasserts"agent crashed" in sent[0]["text"], which is exactly the raw text this PR stops posting. It is not in the PR body's "affected suites" list. Proved:Same file with the three backend files at the merge-base:cd tests && python -m pytest -p no:randomly unit/test_3295_chat_report_back.py -q E assert 'agent crashed' in "⚠️ Task ended with status <code>failed</code> — worker-b\n\nThe agent couldn't finish this." FAILED unit/test_3295_chat_report_back.py::TestDelivery::test_a_failure_terminal_reports_too[sqlite] 1 failed, 18 passed19 passed(re-run a second time before posting, on the PR head and on pre-fix code:1 failed, 18 passedand19 passed). So this is the PR's own red, and CI'sregression diffon this head reports the same single new failure. Fix: assert the person-safe sentence, as the PR did fortest_265.
Same class, outside this PR (not blocking)
S1. A room still shows the raw error, including the subscription name — src/backend/shared_sessions/service.py:2310-2313 (Confidence 8/10).
err = (getattr(result, "error", "") or "").strip()
_post_system(room_id, f"{agent_name} could not respond" + (f": {err[:200]}" if err else " (no response)."))result.error is the row error with the walk trail appended (task_execution_service.py:3380). The line is a room message every member reads; room members include external Workspace principals (src/backend/shared_sessions/router.py:110) and the page renders system lines (src/frontend/src/components/portal/PortalRoom.vue:157). A room wake is a turn the platform dispatches (triggered_by="room"), including agent-to-agent mention chains nobody typed. Proved with the test_2795_room_stop.py harness and the issue's own error text, at the PR head:
_WakeHarness(monkeypatch, rooms, _result("failed", error=<the issue's auth text + " Tried: alice-max-plan (auth); every candidate refused.">))
PROBE room system line -> ['scout could not respond: Authentication failure: Failed to authenticate. API Error: 401 OAuth access token is invalid.. Check subscription token or API key configuration. Tried: alice-max-plan (auth); every candidate refused.']
tests/unit/test_2795_room_stop.py:283 pins the pass-through today ("{AGENT} could not respond: boom"). Fix: person_safe_failure("failed", err) here too, and update that pin. This predates the PR and the issue does not name rooms, so it does not block this change; it is the same disclosure on the same class of turn and deserves its own issue, or a fold-in here if the author prefers.
S2. The loops list a Workspace account fetches carries the raw run error — src/backend/routers/loops.py:93,108 (Confidence 6/10, read, not executed). GET /api/agents/{name}/loops is marked @workspace_route (:270-271), gated only by access to the agent, and returns error=loop["error"] and runs[].error=r["error"]. The run error is the execution row's error (src/backend/services/loop_service.py:591,606), the loop error is "Iteration N: <that error>" (:1038). The Workspace loops panel calls this route (src/frontend/src/stores/loops.js:67) and does not render the field, so the text is in the response, not on screen. A loop iteration is a platform-dispatched turn. Fix: project a person-safe sentence for a Workspace-only caller, or drop the two fields for that audience. Same standing as S1, and weaker, because nothing displays it.
Informational (non-blocking)
- I1. The refusal pass-through returns the whole error, and it is checked before the trail (
channel_completion_report.py:156-158).is_turn_refusedmatches a marker phrase anywhere in the text, then_sanitized_detail(text)returns all of it. Proved: the agent server's refusal sentence followed byTried: alice-max-plan (auth); every candidate refused.comes back with the trail intact, and the Work card shows its first 200 characters. I found no reachable path (the trail is appended to any failure after a walk,task_execution_service.py:3380, but a 403 refusal after a walk attempt in the same turn is not something I could construct). Cheap hardening: test the trail regex first, or emit the refusal sentence only. Public links and inline channel turns answer a refusal with a fixed line; this path passes the agent server's sentence through, as the own-turn Workspace path already does. - I2. The sentence is chosen by an allowlist, which is right, but it is keyed on error text. Raw text is never stripped and shown; every non-refusal outcome is one of four fixed sentences. The key is two regexes over the text because the row has no error-code column (the PR says so; refactor(tasks): readers decide on execution error text, not a failure code — carry a code so wording changes can't move a status #4360). Proved side effects: an agent's own
Connection timeout talking to …reads as "ran out of time"; an auth failure with no walk trail reads as the generic sentence, where the own-turn path says "usage limit". Wording only. - I3. No clean-up of rows already written.
completion:failedmessages posted before this change keep the raw text in threads and Inbox previews, and are still replayed to the agent. Either scrub them once or state the limit in the PR. - I4. Stale text left behind.
docs/memory/feature-flows/subscription-auto-switch.md:371anddocs/memory/requirements/security.md:190still say theauth_switchedanswer names the new subscription.src/backend/client_portal/work/models.py:74still documentserroras "the sanitized 200-char summary".src/backend/services/chat_execution_service.py:1393-1394still says an error "goes through the reporter's own sanitize-then-truncate". - I5. Slack and Telegram lose the failure detail for every failure. The body says "the operator alert keeps it"; that alert exists for pool exhaustion only (
subscription_auto_switch.py:1505). For any other failure an owner's ops channel now reads "The agent couldn't finish this." and the detail is on the execution row only. In the issue's scope, but a product call worth an explicit yes. - I6. Agents still receive the raw text through the caller wake (
caller_wake_service.py:368) and the task-terminal event, and can repeat it to a person. The Workspace replay to the agent is now the person-safe sentence, so the two agent-facing paths disagree. Out of scope; worth a follow-up. - I7. A2A inbound returns
result.errorto the external peer on a failed task (routers/a2a.py:1609-1613). Caller-started, same class as the public-link fix (bug(ui): Public chat shows visitors the raw execution error, including the exit code and operator-only remediation #3461). Follow-up. - I8.
/cso --diffreport (docs/security-reports/cso-diff-2026-11-13-4482-person-safe-failure.md) counts "affected suites: 286 passed" and does not includetest_3295; its pass-through hypothesis says "the matcher is the one public links already use", but public links replace the text with a fixed line and this path does not. - I9. Person-started turns: unchanged except the
auth_switchedwording and the Work card line for the person's own failed turn (was the row error, now the fixed sentence). - I10.
tests/unit/test_4482_person_safe_failure.pyis not intests/registry.json(786 of 1469 unit files are; not a gate). The PR body has no Journey Impact line (the gate script passes: "allowed for now").
Methodology (validate-pr)
- Lane B (no auth/credential/CI path; 14 deleted test lines keep it out of Lane A). Base
dev, 13 files, one commit with a conventionalfix(portal): …message. - Issue link:
Fixes abilityai/trinity#4482present; the issue exists, open,priority-p2,type-bug,theme-security,status-in-progress. - Docs tier: a bug fix needs a commit message only; the PR also updates
channel-completion-report.mdandworkspace-work.md. Two other documents are now stale (I4). Requirements: none owed for a bug fix. - Journey Impact:
scripts/ci/check_journey_impact.pyexits 0 on the PR body and SHAs. - Security greps (keys, emails, IPs, env files, hardcoded secrets, credential files, symlinks, host paths): clean. The one hit is a test placeholder assembled at run time. No new env var, no new top-level backend directory, no gated write handler touched (audit-row script: none). Enterprise-docs guard pattern: no hit on added lines.
- Security report: present (
/cso --diff, two files); see I8. - Speech-sink parity guard (fix(voice): Workspace read-aloud scrubs staged credential values before TTS, and the parity guard pins both remaining speech sinks (#4359) #4361): the new text path adds no speech sink and no anchored writer;
test_ent279_scrub_parity,test_4359_portal_tts_scrubandtest_4228_voice_reply_scrubpass at head. - Tests run at head: 6 new/changed files 235 passed; 46 files that reference the touched modules plus guards 1720 passed, 1 skipped, 1 failed (C1); 15 further related files 415 passed.
- CI on
5e7fd9f95: 18 pass, 6 skipped, 1 failed:regression diff, which reports one new failure introduced by the head,test_3295_chat_report_back.TestDelivery::test_a_failure_terminal_reports_too[sqlite]— the test in C1. Thepytest (head, seed 12345)job passes because it only produces the results file. Skipped:journey-smoke,e2e,report,auto-merge, the two fallback pytest jobs. - Merge with
dev: clean (git merge-tree --write-tree origin/dev HEAD), merge-base6bbff0d87. - Product fit: no router, frontend, MCP tool or settings surface touched, so not applicable.
Not checked
- The full unit suite and the full pinned-guard list (about 219 files) were not run; only the files that reference the touched modules were. A test elsewhere that asserts raw failure text in a report without naming these modules would not have been seen. CI's
regression diffis the authority for those; on this head it reports only the C1 test. - No integration suite, no live stack, no browser check of the Workspace thread, Work card or room (the PR's own manual test-plan item is also unchecked).
- Frontend and MCP-server test suites were not run; the PR changes neither tree.
- The private enterprise submodule is not in the review worktree, so any sink that lives only there was not looked at.
- S2 and the A2A, caller-wake and email rows were concluded by reading; no request was made as a Workspace-only account.
- The paid chat route's failure body and the public status route's
cancelledbranch (routers/public.py:925, returns the row error for a cancelled turn) were not traced. - Feature-flow section format and validate-pr's cross-surface drift script were not run as written; the diff touches no router and nothing under
docker/base-image.
webmixgamer
left a comment
There was a problem hiding this comment.
Requesting changes on 5e7fd9f95: one blocking finding (C1, an existing test still asserts the raw failure text this PR stops sending; regression diff is red on exactly that test). The fix itself is confirmed by mutation. Two older surfaces of the same class are listed as not blocking. The /review + /validate-pr report is in the comment above.
…; stale test and docs updated (#4482) - shared_sessions _wake_agent: a room's "could not respond" line uses person_safe_failure. Room members include external Workspace clients. - person_safe_failure checks the subscription walk trail before the refusal pass-through, so a refusal never carries a trail out. - test_3295 asserts the person-safe sentence for a failed report-back. - test_2795 room pins updated; new pin for the walk trail in a room. - Stale wording fixed: auth_switched in subscription-auto-switch.md and requirements/security.md, WorkItem.error docstring, chat_execution_service comment. Feature flow states the ops-channel and pre-existing-row limits. - CSO diff report updated; test_4482 added to tests/registry.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed in
|
Re-review — APPROVE (head
|
| point | claim | verified how | result |
|---|---|---|---|
| S1 room line | uses person_safe_failure; pins updated; new walk-trail pin |
Read src/backend/shared_sessions/service.py:2305-2317: the only text after "could not respond" is person_safe_failure(status, err), or the fixed "(no response)." when there is no error. Probe with the test_2795 harness (proved): issue text + trail → scout could not respond: The agent reached its usage limit, so it couldn't finish this.; auth text without a trail → generic sentence; timeout → timeout sentence; refusal + trail → usage-limit sentence; success with an empty reply and an error set → usage-limit sentence. No subscription name, provider text or operator guidance in any of them. Mutations: line reverted to err[:200] → 5 red in test_2795 (the four updated pins and the new walk-trail pin); safe sentence plus raw text → the same 5 red. |
holds |
| S1 other room lines | — | Every _post_system / _post_system_safe call in the file was read (about 30 sites). All are fixed wording, names, an exception class name (:2239, :1828, :2349), or a skill-gate notice written for the person (:2231). :2313 is the only reader of an execution error in the package. |
safe |
| S1 imports | — | The import is inside the function. A fresh interpreter imports services.channel_completion_report then shared_sessions.service, and the reverse order, without error (proved, throwaway database path). |
no cycle |
| S2 loops payload | left for a follow-up: the route is shared with the operator panel, which renders the field; the Workspace panel does not | Read: src/frontend/src/components/LoopsPanel.vue:292-293 renders loop.error and :339 renders run.error; src/frontend/src/components/portal/PortalLoops.vue renders neither; both stores call the same route (stores/loops.js:67, stores/portalLoops.js:77). Follow-up is filed as #4556. |
reason holds; stays non-blocking |
| I1 refusal + trail | the trail is checked before the refusal pass-through; new test | Read src/backend/services/channel_completion_report.py:152-154. Probe (proved): refusal sentence + trail → usage-limit sentence, no trail; a refusal without a trail still passes through unchanged ([turn_refused] … and the agent server's own sentence). Mutation: order put back → test_a_refusal_carrying_the_walk_trail_never_shows_it red. |
holds |
| I2 | wording only, no change | — | accepted |
| I3 old rows | limit stated in the flow doc | docs/memory/feature-flows/channel-completion-report.md:409-410: "Messages posted before #4482 keep their original text." |
holds |
| I4 four stale spots | all updated | Read each against the code: docs/memory/feature-flows/subscription-auto-switch.md:371, docs/memory/requirements/security.md:190, src/backend/client_portal/work/models.py:74, src/backend/services/chat_execution_service.py:1393. |
all four now say what the code does |
| I5 ops channels | kept; doc and PR body state it | Flow doc :406-407 and the PR body now say the channel gets the fixed sentence and the detail is on the execution row. |
holds |
| I8 security report | counts and hypothesis wording updated | Read the two report files: scope and result name the room line; the hypothesis now says public links answer with a fixed line and this path passes the refusal through. | holds |
| I10 registry | added | tests/registry.json: +11/−0; every other entry and key is identical to the previous head (proved by comparing the parsed files). |
additive |
Mutations at this head (proved, scratch worktree, 13 test files, 452 pass unmutated):
| mutation | red |
|---|---|
M1 _portal_body back to the raw detail |
6 |
M2 _summarize back to the raw detail |
6 (now includes test_3295) |
M2b _summarize posts the safe sentence and the raw text |
6 |
| M3 Work card back to the row error | 3 |
| M4 switch message names the subscription | 1 |
M5 refusal-check except returns the raw text |
1 |
| M6 trail check disabled | 12 |
| M7 cancelled branch disabled | 1 |
M8 room line back to err[:200] |
5 |
| M8b room line posts the safe sentence and the raw text | 5 |
| M9 trail check moved back after the refusal pass-through | 1 |
No mutation stayed green.
New in this push
Nothing blocking. Three small notes:
- The room line lost its length bound for a passed-through refusal —
src/backend/shared_sessions/service.py:2316. The old line cut the text at 200 characters; a refusal now comes throughperson_safe_failureat up to 2800. The agent server's real refusal sentence gives a 206-character line, so this only matters for an error that merely contains a refusal marker phrase: a constructed one produced a 538-character room line carrying its own text (proved by probe). The Work card keeps a 200 cap for the same text (src/backend/client_portal/work/service.py:326); the same cap here would close it. - The flow doc names
_wake_agent; the line itself is in_wake_agent_locked(shared_sessions/service.py:2084). Cosmetic. - The PR body's "Affected suites" list still omits
test_3295andtest_2795. Cosmetic.
CI and merge state
gh pr checkson65b399116: 21 checks pass, includingpytest (head, seed 12345)andregression diff. Skipped:e2e,journey-smoke,report,auto-merge, and the two fallback pytest jobs. Nothing pending or failing.- Merge with
dev: clean. Review state on GitHub is still "changes requested" from the first review. - Local runs at this head, sequential, no parallel workers:
- the six PR test files plus
test_2795: 261 passed;test_3295: 19 passed; - 493 files (the 46 + 15 from the first review, all 247 unit files that name
shared_sessions,channel_completion_report,client_portalor_wake_agent, and all 303 files the pinned-guard pattern matches): 17861 passed, 12 skipped, 100 failed or errored; - a further 94 files that read source text (
getsource,glob,iterdir) and were not in that set: 2832 passed, 9 skipped, 0 failed.
- the six PR test files plus
- The 100 local reds are in 13 files that import the full application or drive it in a subprocess (route census, live-app and socket tests). The same 13 files give the identical 100 failing ids at the merge-base (proved by diffing the two id lists: nothing only at head, nothing only at base). They are a limitation of the local environment, not this PR; CI ran them and
regression diffis green. - Guards whose scan set names the three touched trees: 62 files, 2514 passed, 22 red, all 22 inside that identical-at-base set. Among the green ones:
test_ent279_scrub_parity(7, the speech-sink and message-writer parity guard),test_4284_no_exception_text_in_5xx(118),test_1804_terminal_activity_parity(6),test_186_enumeration_uniformity(29),test_models_centralized(4),test_2996_human_only_routes(90),test_837_workspace_only_floor(57),test_ent356_portal_is_oss_core(26),test_ent443_backend_package_copy_parity(4),test_ent719_room_post_membership_first(31),test_ent719_no_agent_only_grant_guard(52),test_ent435_settings_sink_guard(4),test_ent169_shared_sessions(38),test_ent1135_ask_room_return(27),test_ent751_gate_guards(9),test_ent751_gate_callers(42),test_937_ent781_census(23),test_2306_architecture_split(18), and the registry readertest_2338_journey_catalog(51).
Not checked
- The 13 full-application files above could not be evaluated locally at either commit, and
test_ent443_rooms_oss_core.pyskipped at collection for the same reason. CI covers them. - The rest of the unit suite (about 880 files outside the 587 run) was not run locally; CI's
regression diffis the authority and it is green. - No integration suite, no live stack, no browser check of a room, a Workspace thread or the Work card. The PR's manual test-plan item is still unticked.
- Frontend and MCP-server suites were not run; the delta touches neither tree.
- The private enterprise submodule is not in the review worktree (one test file skipped for that reason).
- Still outside this PR, unchanged from the first review: the loops payload (Workspace loops payload carries the raw run error, including subscription names #4556), the A2A failure body, and the raw error handed to a calling agent.
webmixgamer
left a comment
There was a problem hiding this comment.
Approving 65b399116: the blocking finding is fixed, the room line is now person-safe, no mutation stays green, and CI is green including regression diff. Three small non-blocking notes are in the re-review comment above.
Summary
person_safe_failure: cancelled, usage limit (the walk trail only), timeout, or generic. An agent's turn refusal (ent#926) is passed through, sanitized and capped.auth_switchedmessage no longer names the new subscription.shared_sessions/service.py).Changes
src/backend/services/channel_completion_report.py:person_safe_failure, used by_portal_bodyand_summarizefor non-success. A failed refusal check falls back to the generic sentence, never raw text.src/backend/client_portal/work/service.py: Work carderroruses the helper, capped at 200 characters.work_outcomestill reads the raw error, so a timeout stays a timeout. The unusedclean_erroris removed and the timeout regex is shared.src/backend/client_portal/service.py: the switch message reads "moved onto another subscription".tests/unit/test_4482_person_safe_failure.py. Five suites that fed failure text to test redaction, escaping and the replayed body now use success text or assert the person-safe sentence.channel-completion-report.mdandworkspace-work.mdfeature flows, plus the/cso --diffreport.Notes for review
Tried: …;) only. Provider wordings ("rate limit",403, "authentication failed") also appear in an agent's own failed tool calls, so they get the generic sentence./chat429/503 body (chat_execution_service.py) still names the new subscription. Its readers are authenticated API callers (owner, MCP).Test Plan
cd tests && pytest unit/test_4482_person_safe_failure.py -v(23)Fixes #4482
🤖 Generated with Claude Code