Repository navigation
fix(auto-reply): port reply-content guards for confusion and uninspected photos - #64
Merged
Merged
Conversation
A draft such as "무슨 말인지 모르겠네요" was rejected only when the inbound turn was punctuation and a grounded topic existed, so "그래서?" or a bare "???" with no context could still send it. The question_unknown fallback and the lenient never-skip fallback also returned it unfiltered. The full policy now rejects every generic confusion draft, the no-eligible fallbacks skip them, and when every draft was one of them the worker asks which topic was meant. The clarification is not phrased as a question, so the unchanged pre-send policy recheck accepts it for non-question turns. Ports the intent of 0003e92 from the codex/alden-* lineage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When no draft was eligible, or the model stayed unavailable, or the media fetch failed, the photo fallback picked a stock visual remark such as "화질이 별로네" about a photo nobody looked at. It now says the photo was not checked and asks for the needed part in text, in the current recipient's register. The wording is not a question, so the unchanged pre-send policy recheck accepts it for a bare photo turn. When every image failed to load, the runner still sent a text-only model request and relied on prompt wording to stop a made-up answer. It now sends nothing. generate_reply releases that call's lease without opening a cooldown or clearing earlier failures, and returns image_unavailable. Ports the worker part of 8ceeea8 from the codex/alden-* lineage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rops out
Two red tests for the review of the reply-content guards.
A confusion draft that the full policy now rejects must not hand the turn
to a second draft that the full policy also rejected. The test feeds the
reviewer's cases ("아 그렇군요" from 현준 with "그치 뭐함?", "아 그렇구나"
with "너는 뭐 먹었어?" or "ㅋㅋㅋㅋ", a bare photo with "이거 어디야?") and
expects the clarification or the honest photo reply, which the pre-send
policy recheck accepts. The old assertion that "ㅋㅋㅋㅋ" goes out through
the lenient fallback is dropped.
A photo turn whose images cannot be read at generation time must still get
an honest reply, with no model request sent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The full policy now rejects every generic confusion line, but the clarification fired only when no other draft existed. With a second draft the turn fell through to the question_unknown, photo and lenient fallbacks, which sent that draft even though the full policy had refused it, for example "그치 뭐함?" to 현준 after "아 그렇군요". For a photo turn the refused draft also failed the pre-send recheck, so nothing was sent. When any draft was a confusion line, the worker now sends the clarification, or the honest photo reply on an image turn, before any fallback can reuse a refused draft. Both pass the unchanged pre-send policy recheck. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When every image of a photo turn failed to load, generate_reply now sends
no model request and returns image_unavailable. analyze_event treated that
as a model no-reply and skipped the turn for good, which broke the rule
that an authorized sender is never skipped.
analyze_event now answers that turn with the photo fallback in the
recipient's register ("사진 내용을 확인하지 못했어. 필요한 부분은 글로
알려줘"), records model_invoked as false, and uses the media-unavailable
clarification reason, so the reply stays out of behavior memory like the
existing no-pixel clarification. Still no model request is sent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three rare paths the PR left worse than main or incomplete: - A cooldown fallback whose images will not load sends nothing, yet the chain charged it a runner_failed cooldown and deferred the turn. - A text turn that carries the author's recent photos got the photo apology when those files could not be read, instead of an answer. - "이해가 안 돼" and the other 돼 or 되요 spellings passed as a valid draft. The analyze_event photo tests share one gateway harness, which also stubs the local media download and the screen capture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The matcher took only 되, so "이해가 안 돼", "이해가 안 돼요" and the common misspellings "안 되요" and "안 돼네" went out as valid drafts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A text turn carrying more context photos than the image cap gets image_unavailable from generate_reply before any request. analyze_event answered it with the photo apology, which is only for a photo turn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
For a text message, analyze_event attaches the same author's recent photos. When those files could not be read, the runner refused to send and the turn got "사진 내용을 확인하지 못했어" instead of an answer. The runner now refuses only when the turn itself is the photo. For a text turn it sends main's text request with the note that the photos could not be read, and analyze_event keeps the photo apology for photo turns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the image model in cooldown, the fallback chain ran a vision candidate whose images would not load. It sent nothing and returned image_input_unavailable, which the chain classified as runner_failed. A healthy model went into cooldown and the turn was deferred. That candidate now ends the chain with its lease open. generate_reply checks for an unsent request once, after every fallback branch, and releases whichever lease is current without a failure, so the turn gets the honest photo reply. The primary's own unsent request still skips the chain, now pinned by asserting no fallback model is charged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…date The retrieval-command test replaces _run_generation_candidate with a fake that mirrors its signature. 8f56f1a added images_required there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Decision: merge. Evidence:
|
This was referenced Nov 23, 2026
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every open PR in twoimo/alden should be resolved on its merits. The 22 stale
codex/alden-*draft PRs come from a forked lineage that cannot merge as-is, and they will be closed. Before they close, their unique fixes that are still useful get ported to main. This PR ports two reply-content safety fixes for the KakaoTalk auto-reply worker. Without them the worker can send a reply that claims something it does not know.Ported from
origin/codex/alden-explicit-references-20261025:0003e92"Ground Kakao confusion replies and preserve pre-send checks"8ceeea8"preserve Alden turns and reject uninspected image replies". Only thescripts/auto-reply-worker.pyandtests/test_auto_reply_cli_runtime.pyparts are ported. The Alden desktop and voice parts are left out.Both fixes were rewritten against main's current code. The lineage hunks were not pasted in.
What changes
A generic confusion reply is never sent. On main,
_policy_valid_draftrejected "무슨 말인지 모르겠네요" only when the inbound turn was punctuation and a grounded topic existed. So "그래서?", a bare "???", or "아 그렇구나" with no context sent it. Now the full policy rejects every generic confusion draft, and the fallbacks skip it. The matcher covers both 되 and 돼 spellings, including the common misspellings "안 되요" and "안 돼네(요)".When no draft passes the full policy and at least one draft was a confusion line, the worker sends a clarification. It does not fall back to another draft that the full policy also refused. The clarification is the grounded "아까 “…” 얘기야?" when a topic exists. Otherwise it is "어떤 얘기인지 조금만 더 말해줘" ("말씀해 주세요" for honorific recipients), or the honest photo reply below on an image turn. The
question_unknown,photo_passthroughandlenient_policyfallbacks are reached only when no confusion draft was involved. That keeps main's behavior there. The clarification wording is deliberately not a question, so it passes the unchanged pre-send_policy_valid_draftrecheck (question_unansweredrejects a question reply to a non-question turn). No pre-send safeguard is bypassed.No invented remarks about a photo nobody inspected.
_photo_fallback_replypicked a stock visual remark ("화질이 별로네", "색감이 별로네"). It now returns "사진 내용을 확인하지 못했어. 필요한 부분은 글로 알려줘", or the honorific form when the current recipient needs it. Main decided the register from whoever spoke earlier in the room._run_opencodex_generation_unleasedstill sent a text-only request. It now sends nothing and returnsimage_input_unavailable.generate_replyreleases that call's lease without opening a cooldown or clearing earlier failures (_release_unsent_model_call), and returnsimage_unavailable.generate_replyreleases it once, after every fallback branch, without a failure. No fallback model is charged for a request it never received, and the primary's own unsent request never consults the chain.analyze_eventanswers that photo turn with the honest photo reply in the recipient's register instead of skipping it. An authorized sender is never skipped. The decision recordsmodel_invoked: falseand reasonmedia_unavailable_clarification, so the reply stays out of behavior memory like main's existing no-pixel clarification.analyze_eventattaches the same author's recent photos to a text message. If those files cannot be read, the text request still goes out with main's note that the photos could not be read (images_requiredis true only whenattachment == "image"). A text turn never gets the photo apology.Evidence
Each fix was shown red before it landed.
Second review round.
84432faand1708696add the tests.0d43585,8f56f1aandb702efaturn them green.42bded1updates a test fake that mirrors_run_generation_candidate's signature.Red on
84432fa, except the cap test, which was run on the fixed tree withanalyze_event's pre-fiximage_paths andgate restored:The cooldown test seeds a real model circuit with the image model in cooldown and a 27B-family fallback whose images become unreadable after validation. It asserts no gateway or process request, zero failures on the fallback, the primary's one failure unchanged, and the honest photo reply passing the pre-send check. Planted mutations each fail a test: reverting the chain guard, removing the post-fallback release, and letting the primary's unsent request reach the chain (which charged Flash Next a failure).
First review round:
3a02d27adds the tests on top of the first two port commits.25d32f8and1bac3c3turn them green.Red on
3a02d27, before the review fixes:Each confusion case first asserts that the full policy rejects the second draft. The photo test runs the real
generate_replythroughanalyze_eventand makes the images unreadable after the bundle is validated. It asserts that no gateway or process request is made, that the reply is the honest photo line, and that the pre-send policy accepts it.The earlier port commits were shown red the same way. Commit 1's tests failed on
origin/main('무슨 말인지 모르겠네요' != '어떤 얘기인지 조금만 더 말씀해 주세요'). Commit 2's tests failed on commit 1 ('이거 잘 안 보이네' != '사진 내용을 확인하지 못했어. ...', and(0, b'') != (1, b'image_input_unavailable')).test_generate_reply_sends_no_request_when_no_image_loadsuses the real model circuit seeded with one earlier failure. Three planted variants of the lease handling each fail it.Reviewer's cases, from
select_ranked_replyplus the pre-send check:Every "now" reply passes the pre-send recheck.
Green, with Python 3.11, a scratch
HOME, andnice -n 10, one at a time:python3 -m unittest tests.test_auto_reply_cli_runtime: 356 tests, OK.desktopjob'spython3 -m unittestmodule list (41 modules): 1383 tests, OK (skipped=9).sh scripts/test-auto-reply-launchd-artifacts.sh: "launchd artifact harness passed", exit 0. It drives a fakelaunchctlviaOPENKAKAO_AUTO_REPLY_LAUNCHCTL.Not ported
0003e92. The guard enforces the rule whatever the model drafts.8ceeea8also refused a request where only some of the images loaded. This PR refuses only when every image of a photo turn failed to load, which is the defect reported on main.🤖 Generated with Claude Code