JMAP draft From: fall back to the session username #211
Labels
No labels
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/mail-mind-mcp#211
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A JMAP account without
from_addresscannot write drafts.mail_draft,mail_draft_editand forward drafts fail withconfig_error("the account has no from_address"). An IMAP account falls back to itsusernamewhen that is an address; a JMAP account has no fallback (JmapAccountConfig.sender). Grok hit this on mailmind-piers (starbase/iac#371 sets the address there as a workaround).What to build
username(RFC 8620 §2) when it reads the session. It already reads the session forprimaryAccounts. When the username is an address (the existing_is_addressrule), the worker records it in the existingmetatable under one key per account. No schema change. The worker updates the key when the username changes, and removes it when the username is no longer an address.from_address; for IMAP, theusernamewhen it is an address; for JMAP, the recorded session username.server.py's early refusal inmail_draftandmail_draft_editand the worker's_composeinjmap.pyboth use it. Theapiprocess reads the recorded value from the store; it never calls the mail server (ADR 0006 §3).from_addressstill answersconfig_error. The message says that the first sync pass has not run or that the session username is not an address, and namesfrom_addressas the fix.mailmind checkprints each account's sender and its origin:config,usernameorsession. Never print the address in logs: logs carry the origin only.[[accounts]]table,config.example.tomlcomment on the JMAPfrom_address, and themail_draftdocstring if it names the rule.Do not use
Identity/get. It needs the submission capability, which the JMAP token must not carry (ADR 0006 §10). Never derive From from mail content, such as Sent mail: mail content is untrusted.ADR
ADR 0006 §1 lists the JMAP keys. It needs one sentence: "A JMAP account without
from_addressuses the session username when it is an address." ADR 0004 §6 needs a pointer to it. The architect lands both in a separate PR before dispatch, because the runner refuses to merge a PR that touchesdocs/adr/.Acceptance criteria
from_addresswhose session username is an address writes a draft, a forward and an edit with that From.from_addressin config overrides the session username.mail_draftanswersconfig_errorbefore queueing.tests/test_source.py's no-source-import check still passes.make checkpasses.Out of scope
Masked Email or alias creation. Choosing among several identities. Any send path.
⏸ SVD architect gate: dev/mail-mind-mcp#211 jmap-draft-from-fall-back-to-the-session-username
Status: CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity
substrate· dispatch efforthighRun:
20261113T221200Z-89078db9Held because: CLEAN but 4 open risk(s) (2 verification · 2 decision) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
make test-stalwarton the host and state in the PR which branch ran (session origin or config_error). [verification]make check(lint, mypy strict, unit tests, pip-audit with network) was not run in Half-A. Check: runmake checkon the host at the PR head and confirm exit 0, and confirm the fast-filter failure set matches the pristine-base measurement taken before the first edit. [verification]Change: One sender rule in config.py: add draft_sender(session_username) -> (address, origin) | None on MirrorScope (config only). Override it on MirrorAccountConfig (IMAP username fallback, same behaviour as config.py:340-344) and on JmapAccountConfig (session username fallback). The .sender property delegates to the rule, so own_addresses stays config-only for JMAP. Make _is_address public as is_address, and add the NO_SENDER and NO_SESSION_SENDER messages. store.py: add session_sender(account), which works on a reader, and record_session_sender(account, address|None), which only the writer may call. Both use a meta key 'session_username:', mirroring get_state/set_state at store.py:2046-2059, the meta upsert at :1009 and the writer guard at :1020. jmap.py: add a username field to Session (parsed at :215-236). JmapSource._session_sender() records the value and logs the origin only. run_pass calls it as the first statement in the try at :439, and _compose (:976-979) uses account.draft_sender(self._session_sender()). server.py: add a _draft_sender(account) helper that reads store.session_sender and never imports jmap. It replaces the refusals at :1575-1577 and :1622-1630, before _queue. cli.py: add 'origin' to the log allowlist at :42-64. cmd_check prints a 'sender: account= origin= address=' line, never starting with 'account=' because of test_greenmail.py:123. Docs: README.md:236 and config.example.toml:127 and :134.
Files:
src/mail_mind_mcp/config.py·src/mail_mind_mcp/store.py·src/mail_mind_mcp/jmap.py·src/mail_mind_mcp/server.py·src/mail_mind_mcp/cli.py·README.md·config.example.toml·tests/test_config.py·tests/test_store.py·tests/test_jmap.py·tests/test_write_tools.py·tests/integration/test_stalwart.pyDecision: accept the 4 open risk(s) above and dispatch this spec (
svd:go), or park (svd:skip) / re-spec (svd:respec)?Your call (when this issue is held at the gate via
svd:hold):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-13-jmap-draft-from-fall-back-to-the-session-username.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-13-jmap-draft-from-fall-back-to-the-session-username.md✅ SVD architect gate: dev/mail-mind-mcp#211 jmap-draft-from-fall-back-to-the-session-username
Status: CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity
unclassified· dispatch effortunclassifiedRun:
20261113T221200Z-89078db9Files:
src/mail_mind_mcp/config.py·src/mail_mind_mcp/store.py·src/mail_mind_mcp/jmap.py·src/mail_mind_mcp/server.py·src/mail_mind_mcp/cli.py·README.md·config.example.toml·tests/test_config.py·tests/test_store.py·tests/test_jmap.py·tests/test_write_tools.py·tests/integration/test_stalwart.pyWrite-set divergence: present table wins. 0 sourceHashes vs 25-row table.
Decision: dispatch this spec (
svd:go)?Your call (when this issue is held at the gate via
svd:hold):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-13-jmap-draft-from-fall-back-to-the-session-username.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-13-jmap-draft-from-fall-back-to-the-session-username.mdspec-verify-dispatch Half B for dev/mail-mind-mcp#211 jmap-draft-from-fall-back-to-the-session-username completed integration verify.
26d4c79caedoes not match forge PR headc10c46e36f26d4c79caedoes not match forge PR headc10c46e36f26d4c79caedoes not match forge PR headc10c46e36f; no denial signature; evidence: raised by the runner before any test ran26d4c79caedoes not match forge PR headc10c46e36fspec-verify-dispatch Half B for dev/mail-mind-mcp#211 jmap-draft-from-fall-back-to-the-session-username completed integration verify.
c10c46e36fc10c46e: ci/woodpecker/pr/validation green (combined status success). Local make check green: 1624 passed, 8 skipped, lint, mypy and pip-audit clean.codex-svd ship --run-id 20261113T222723Z-ab6fd722 --confirm-merge)