fix: priority-aware status writes, dedup, and missing status mappings#35
Merged
Conversation
Adds *Working* and *Sending* to the known-status case block so the monitor no longer logs unknown_status debug events when the Skill tool (🔧 Working) or SendMessage (📤 Sending) fire. Updates priority comment block, README status table, and adds test assertions for both statuses.
There was a problem hiding this comment.
Pull request overview
This PR improves how ccp writes and displays pane status by preventing low-priority concurrent hook updates from overwriting higher-priority statuses, reducing redundant status-file I/O via deduplication, and expanding the monitor’s known-status set to include new statuses.
Changes:
- Add priority-aware status writes (with completion-event bypass) and status write deduplication in
lib/hook_runner.sh. - Extend monitor known-status validation / priority mapping to include
🔧 Workingand📤 Sendinginlib/monitor.sh. - Add new regression tests for priority behavior, dedup behavior, and new status mappings; update README status reference.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
lib/hook_runner.sh |
Introduces _status_priority, _is_completion_event, and _priority_write to arbitrate concurrent status writes and deduplicate unchanged writes. |
lib/monitor.sh |
Adds Working/Sending to known-status validation and documents the need to keep priority tables in sync. |
tests/test-suite.sh |
Adds/updates tests for status priority mapping, priority-aware blocking/bypass behavior, and deduplication. |
README.md |
Updates the status reference table to include Sending, Working, and Monitoring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+122
to
+124
| *Editing*|*Working*) echo 65 ;; | ||
| *"Tests passed"*|*Committed*|*Completed*|*"Subagent finished"*) echo 60 ;; | ||
| *Reading*|*Browsing*|*Running*|*Sending*) echo 55 ;; |
| *Docker*|*Thinking*|*Delegating*) echo 70 ;; | ||
| *Editing*|*Working*) echo 65 ;; | ||
| *"Tests passed"*|*Committed*|*Completed*|*"Subagent finished"*) echo 60 ;; | ||
| *Reading*|*Browsing*|*Running*|*Sending*) echo 55 ;; |
| | 🔧 | Working | Skill tool or unclassified tool | 55 | | ||
| | 📡 | Monitoring | Background agents running while Claude is idle | 20 | | ||
|
|
||
| Higher priority always wins. The one exception: completion events (✅, 💾, 🏁) override any active status immediately, regardless of priority. |
Comment on lines
+1137
to
+1141
| printf '🤖 Delegating' > "${TMP_STATUS}" | ||
| result=$(echo '{"tool_name":"Bash","tool_input":{"command":"ls"}}' \ | ||
| | CCP_STATUS_FILE="${TMP_STATUS}" CCP_CONTEXT_FILE="${TMP_CONTEXT}" \ | ||
| bash "${LIB_DIR}/hook_runner.sh" pre-tool && cat "${TMP_STATUS}" 2>/dev/null || true) | ||
| assert_equals "priority: 🖥️ Running blocked by 🤖 Delegating" "🤖 Delegating" "${result}" |
- Align Working priority to 55 (matching monitor.sh sync contract) - Add lifecycle statuses at priority 52 to _status_priority() - Update README completion events list to include ❌ and 🐛 - Add test: Working (p55) blocked by Editing (p65)
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.
Summary
hook_runner.shnow checks the current status file priority before writing. High-priority statuses like⏸️ Awaiting approval(p88) are no longer overwritten by concurrent lower-priority pre-tool hooks like🖥️ Running(p55). Completion events (✅, 💾, 🏁, ❌, 🐛) bypass the priority check and always win immediately.status_dedupdebug events for observability.🔧 Workingand📤 Sendingto the monitor's known-status validation. No moreunknown_statusdebug log noise.What changed
lib/hook_runner.sh_status_priority(),_is_completion_event(),_priority_write()functions; replaced 4 unconditionalatomic_writecalls; added dedup checkslib/monitor.shWorking,Sendingto known-status case; added sync commenttests/test-suite.shREADME.mdTest plan