feat(harness): re-anchor after session compaction#53
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughReplaces the cached orchestrator prompt reader with a fresh-read helper ( ChangesHarness reminder injection and orchestrator prompt refresh
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@extensions/gentle-ai.ts`:
- Around line 1923-1932: The global `compactionPending` variable causes race
conditions across concurrent sessions because multiple sessions can read and
write to it simultaneously without isolation. Replace the single global
`compactionPending` flag with a session-scoped approach: either use a Map keyed
by session identifier (e.g., `compactionPendingBySessionId`) if the `context`
event object contains a stable session/context identifier, or refactor
`buildContextReminder()` and `applyHarnessReminder()` to accept
`compactionPending` as a parameter that is threaded through from session-scoped
state rather than relying on shared global mutable state. Ensure that the
`session_start` reset logic and the `session_compact` event handler are also
updated to work with the session-scoped state instead of the global variable.
In `@tests/gentle-ai.test.ts`:
- Around line 59-64: The test for __testing.getOrchestratorPrompt with a missing
file uses a hardcoded absolute path that is environment-dependent and
unreliable. Instead of using "/nonexistent/path/orchestrator.md", create a
temporary directory dynamically and construct a path to a guaranteed-missing
child file within that temp directory. This ensures the test is deterministic
and works reliably across different environments. Use that
dynamically-constructed missing path when calling
__testing.getOrchestratorPrompt in the test.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b91eb2f9-4f22-4020-b4ad-551936660f38
📒 Files selected for processing (2)
extensions/gentle-ai.tstests/gentle-ai.test.ts
3aba486 to
2287f9e
Compare
Registers pi.on("context") handler that injects a gentle-harness-reminder message before each LLM call, ensuring the orchestrator pattern, TDD discipline, and artifact-driven decisions are reinforced at every interaction point — not just at agent start.
The handler returns a new message array with the reminder appended as the last message. It deduplicates if a reminder is already present (defensive for chained extensions). The reminder content is a single source of truth module constant and includes all el Gentleman discipline markers.
Pure logic exposed via __testing for verification. Full suite green (58/58 pass, runtime harness exit 0).
2287f9e to
9fa4557
Compare
Part of #39. Stacked on #41 (review the last commit only).
Summary
session_compact: sets a one-shot flag so the next context-event reminder carries a post-compaction block (re-check SDD/OpenSpec state on disk, restate scope and acceptance criteria before continuing).session_start, preventing leakage across sessions.Changes
extensions/gentle-ai.tscompactionPendingflag,session_compacthandler, post-compaction block inbuildContextReminder(), reset atsession_starttests/gentle-ai.test.tsapplyHarnessReminder, multi-turn integration scenarioTest plan
pnpm testgreen at this commit on currentmain: 166 pass, 0 fail. Original count on the older base was 65.Notes
Deliberately minimal v1: no
session_before_compactinterception and no customCompactionResult. Those stay open as a possible follow-up if this direction lands well.Summary by CodeRabbit
New Features
Improvements
Tests