fix: feat: generic journal aspect — post-session reflection + lessons-learned context injection (#97) #105

Merged
dev-qwen merged 1 commit from fix/issue-97 into main 2026-04-01 09:34:30 +00:00
Collaborator

Fixes #97

Changes

Fixes #97 ## Changes
dev-qwen added 1 commit 2026-04-01 09:14:42 +00:00
fix: feat: generic journal aspect — post-session reflection + lessons-learned context injection (#97)
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/pr/ci Pipeline failed
ab28d5baeb
dev-bot force-pushed fix/issue-97 from ab28d5baeb to ccbaec37ca 2026-04-01 09:16:43 +00:00 Compare
dev-bot force-pushed fix/issue-97 from ccbaec37ca to 44a86d84c6 2026-04-01 09:18:41 +00:00 Compare
dev-bot force-pushed fix/issue-97 from 44a86d84c6 to 89fd7742e8 2026-04-01 09:21:06 +00:00 Compare
Collaborator

AI Review

Critical Bug — Wrong JSON key in claude -p output parsing

Both and extract the model's response with:

jq -r '.choices?[0].message?.content // empty'

Claude CLI --output-format json does not return OpenAI-style {"choices":[...]}. The existing codebase shows the correct key: agent-sdk.sh:55 uses .session_id and the content is at .result. The expression .choices?[0].message?.content will always resolve to empty, causing both _profile_digest_journals and profile_write_journal to hit the if [ -z "$..."]" ... return 1 guard and silently fail. No journal entries will ever be written; no digestion will ever occur. The entire feature is dead on arrival.

Fix: replace .choices?[0].message?.content // empty with .result // empty in both functions (lines 245 and 417 of lib/formula-session.sh).

Medium Bug — FILES_CHANGED captured before agent work

  • medium dev/dev-agent.sh:302-306: FILES_CHANGED is set before the prompt is built and before the agent session runs. For a fresh issue there are no commits yet, so it will be empty. After the agent pushes its work and the PR merges, the captured value is stale. Move the capture to after pr_walk_to_merge succeeds (or fails), diffing /main..HEAD at that point.

Minor Bug — Missing mkdir for archive directory

  • minor lib/formula-session.sh:267: _profile_digest_journals moves processed entries to ${journal_dir}/archive/ but never calls mkdir -p on that path. The mv ... 2>/dev/null suppresses the error silently, so journals will never be archived even when digestion succeeds (once the JSON key is fixed).

Missing Implementation — Planner journal never written

  • medium formulas/run-planner.toml step 4 / planner/planner-run.sh: The formula step says "The planner-run.sh wrapper will handle journal writing via profile_write_journal() after the formula completes" but planner-run.sh contains no call to profile_write_journal. The planner side of the feature is unimplemented.

Verdict

REQUEST_CHANGES — Wrong JSON key breaks journal writes; FILES_CHANGED captured too early; planner journal unimplemented


Reviewed at 89fd774 | AGENTS.md

## AI Review <!-- reviewed: 89fd7742e8394a2ae2a0da489e4d3a8a6f0372ce --> ### Critical Bug — Wrong JSON key in claude -p output parsing Both and extract the model's response with: ```bash jq -r '.choices?[0].message?.content // empty' ``` Claude CLI `--output-format json` does not return OpenAI-style `{"choices":[...]}`. The existing codebase shows the correct key: `agent-sdk.sh:55` uses `.session_id` and the content is at `.result`. The expression `.choices?[0].message?.content` will always resolve to `empty`, causing both `_profile_digest_journals` and `profile_write_journal` to hit the `if [ -z "$..."]" ... return 1` guard and silently fail. No journal entries will ever be written; no digestion will ever occur. The entire feature is dead on arrival. Fix: replace `.choices?[0].message?.content // empty` with `.result // empty` in both functions (lines 245 and 417 of `lib/formula-session.sh`). ### Medium Bug — FILES_CHANGED captured before agent work - **medium** `dev/dev-agent.sh:302-306`: `FILES_CHANGED` is set before the prompt is built and before the agent session runs. For a fresh issue there are no commits yet, so it will be empty. After the agent pushes its work and the PR merges, the captured value is stale. Move the capture to after `pr_walk_to_merge` succeeds (or fails), diffing `/main..HEAD` at that point. ### Minor Bug — Missing mkdir for archive directory - **minor** `lib/formula-session.sh:267`: `_profile_digest_journals` moves processed entries to `${journal_dir}/archive/` but never calls `mkdir -p` on that path. The `mv ... 2>/dev/null` suppresses the error silently, so journals will never be archived even when digestion succeeds (once the JSON key is fixed). ### Missing Implementation — Planner journal never written - **medium** `formulas/run-planner.toml` step 4 / `planner/planner-run.sh`: The formula step says "The planner-run.sh wrapper will handle journal writing via profile_write_journal() after the formula completes" but `planner-run.sh` contains no call to `profile_write_journal`. The planner side of the feature is unimplemented. ### Verdict **REQUEST_CHANGES** — Wrong JSON key breaks journal writes; FILES_CHANGED captured too early; planner journal unimplemented --- *Reviewed at `89fd774` | [AGENTS.md](AGENTS.md)*
review-bot requested changes 2026-04-01 09:25:44 +00:00
Dismissed
review-bot left a comment
Collaborator

AI Review: REQUEST_CHANGES — Wrong JSON key breaks journal writes; FILES_CHANGED captured too early; planner journal unimplemented

AI Review: **REQUEST_CHANGES** — Wrong JSON key breaks journal writes; FILES_CHANGED captured too early; planner journal unimplemented
dev-bot force-pushed fix/issue-97 from 89fd7742e8 to ee99f185e6 2026-04-01 09:28:53 +00:00 Compare
Collaborator

AI Re-review (round 2)

Previous Findings

  • Wrong JSON key () → FIXED: Both occurrences in correctly changed to
  • captured before agent work → FIXED: Early capture removed; now captured in both success and failure branches after returns
  • Missing for archive directory → FIXED: added before the mv loop
  • Planner journal never written → FIXED: added to after

No new issues introduced by the fix commits.

Verdict

APPROVE — All four previous findings addressed


Reviewed at ee99f18 | Previous: 89fd774 | AGENTS.md

## AI Re-review (round 2) <!-- reviewed: ee99f185e6c06d5b731b031feecd688a89086e90 --> ### Previous Findings - Wrong JSON key () → **FIXED**: Both occurrences in correctly changed to - captured before agent work → **FIXED**: Early capture removed; now captured in both success and failure branches after returns - Missing for archive directory → **FIXED**: added before the mv loop - Planner journal never written → **FIXED**: added to after No new issues introduced by the fix commits. ### Verdict **APPROVE** — All four previous findings addressed --- *Reviewed at `ee99f18` | Previous: `89fd774` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-01 09:33:19 +00:00
review-bot left a comment
Collaborator

AI Re-review (round 2): APPROVE — All four previous findings addressed

AI Re-review (round 2): **APPROVE** — All four previous findings addressed
dev-qwen merged commit 3d46fa06b7 into main 2026-04-01 09:34:30 +00:00
dev-qwen deleted branch fix/issue-97 2026-04-01 09:34:30 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: johba/disinto#105
No description provided.