fix: align AI-recent notes with WebUI prefill hook - #3037
7 commits merged into
Conversation
…ll-status # Conflicts: # CHANGELOG.md
|
Refreshed this branch against current Verification on head
|
SummaryRead the diff at PR head 571bb10 (28 added lines in Code referenceThe browser chat recall path on def _load_prefill_messages_script(config_data: dict) -> dict:
script_raw = os.getenv("HERMES_WEBUI_PREFILL_MESSAGES_SCRIPT", "") or config_data.get("webui_prefill_messages_script")The Joplin "AI-recent" helper on master at def _joplin_prefill_script_path() -> Path | None:
cfg = get_config()
path_value = cfg.get("prefill_messages_script") if isinstance(cfg, dict) else NoneSo the notes drawer was reading The new precedence at return _script_path_from_config_value(
cfg.get("webui_prefill_messages_script") or cfg.get("prefill_messages_script")
)mirrors the contract exactly. Argv handlingThe new One small note: the helper does not execute anything — it only does a Test coverage
The existing legacy-only test ( Diagnosis / RecommendationLGTM. The change is small, the contract alignment is correct, and the test exercises the precedence directly. Nothing in the diff requires running the worktree to verify, just reading. The merge resolves the One nit-worthy follow-up (not blocking): there are two trailing blank lines added before |
|
Follow-up after reviewing this PR against the WebUI prefill loader contract:
Verification on head
|
|
Added a follow-up after a provider-neutrality pass:
Verification: |
|
Code-review follow-up: fixed the path parsing edge case found during review. Plain configured script paths that already exist are now treated as literal paths before falling back to Verification: |
|
CI follow-up: the Python 3.13 matrix exposed an existing git fixture assumption that temporary repos start on Verification: |
6267716
|
Shipped in v0.51.154 / Release DZ (stage-batch36, commit 6267716). Thanks for the contribution! |
# Conflicts: # CHANGELOG.md
9-PR medium-risk cleanup: - nesquena#3037 routes.py: argv-style prefill hook + env-var override for notes drawer - nesquena#3046 models.py: compression parent not repaired as stale interrupted turn - nesquena#3048 session_discoverability.py: --repair-safe CLI with default dry-run - nesquena#3053 ui.js: streaming KaTeX guard for parser-owned equations - nesquena#3059 models.py: empty partial activity rows excluded from sidebar recency - nesquena#3060 profiles.py: API key writes to .env (chmod 600), not config.yaml - nesquena#3064 routes.py: MEDIA: image tokens allow exact session-referenced paths - nesquena#3069 models.py: cron sessions with project_id surface via Cron Jobs chip - nesquena#3077 gateway_chat.py: HTTP 401 maps to gateway_auth_error event
# Conflicts: # CHANGELOG.md
9-PR medium-risk cleanup: - nesquena#3037 routes.py: argv-style prefill hook + env-var override for notes drawer - nesquena#3046 models.py: compression parent not repaired as stale interrupted turn - nesquena#3048 session_discoverability.py: --repair-safe CLI with default dry-run - nesquena#3053 ui.js: streaming KaTeX guard for parser-owned equations - nesquena#3059 models.py: empty partial activity rows excluded from sidebar recency - nesquena#3060 profiles.py: API key writes to .env (chmod 600), not config.yaml - nesquena#3064 routes.py: MEDIA: image tokens allow exact session-referenced paths - nesquena#3069 models.py: cron sessions with project_id surface via Cron Jobs chip - nesquena#3077 gateway_chat.py: HTTP 401 maps to gateway_auth_error event
# Conflicts: # CHANGELOG.md
9-PR medium-risk cleanup: - nesquena#3037 routes.py: argv-style prefill hook + env-var override for notes drawer - nesquena#3046 models.py: compression parent not repaired as stale interrupted turn - nesquena#3048 session_discoverability.py: --repair-safe CLI with default dry-run - nesquena#3053 ui.js: streaming KaTeX guard for parser-owned equations - nesquena#3059 models.py: empty partial activity rows excluded from sidebar recency - nesquena#3060 profiles.py: API key writes to .env (chmod 600), not config.yaml - nesquena#3064 routes.py: MEDIA: image tokens allow exact session-referenced paths - nesquena#3069 models.py: cron sessions with project_id surface via Cron Jobs chip - nesquena#3077 gateway_chat.py: HTTP 401 maps to gateway_auth_error event
Thinking Path
The WebUI-specific prefill hook is now the explicit browser-chat context path, but the third-party notes drawer's AI-recent Joplin helper still inspected only the legacy generic
prefill_messages_script. That can make the drawer point at stale or no recall notes even when browser chat is correctly usingwebui_prefill_messages_script.What Changed
webui_prefill_messages_scriptwhen deriving Joplin notes that are recently used by AI recall.prefill_messages_scriptfor deployments that have not opted into the WebUI hook.["python3", "/path/to/recall.py"]by selecting the script argument instead of the interpreter.Why It Matters
This keeps the notes drawer aligned with the same recall path browser-originated WebUI turns use, which makes WebUI context/notes behavior closer to the Telegram/CLI runtime expectation without hard-coding any note provider or local path.
Contract Routing
Task type: context / notes metadata parity.
Touched areas:
api/routes.pyJoplin AI-recent note discoverytests/test_webui_notes_sources.pyCHANGELOG.mdRelevant public docs:
AGENTS.mdCONTRIBUTING.mddocs/CONTRACTS.mdScope boundaries:
Evidence needed before claiming done:
Verification
python3.11 -m py_compile api/routes.pypython3.11 -m pytest tests/test_webui_notes_sources.py tests/test_webui_prefill_context.py -q -o addopts=(24 passed)git diff --checkRisks / Follow-ups