Skip to content

refactor: unify session status tracking into single pi--status variable#21

Merged
dnouri merged 1 commit intomasterfrom
refactor/unify-status-tracking
Jan 6, 2026
Merged

refactor: unify session status tracking into single pi--status variable#21
dnouri merged 1 commit intomasterfrom
refactor/unify-status-tracking

Conversation

@dnouri
Copy link
Owner

@dnouri dnouri commented Jan 6, 2026

Summary

Previously, session activity state was tracked in two places:

  • pi--status (buffer-local symbol: idle/sending/streaming/compacting)
  • :is-streaming in pi--state plist (boolean)

This duplication was error-prone and confusing.

Changes

  • pi--status is now the single source of truth, defined in pi-core.el
  • pi--update-state-from-event sets status on agent_start/agent_end events
  • pi--extract-state-from-response returns :status for initialization from server
  • :is-streaming and :is-compacting removed from pi--state plist

Benefits

  • Clearer code: one variable to check, not two
  • Status set atomically in event handler, not scattered in display functions
  • Tests are simpler and more focused

Testing

  • All 235 unit tests pass
  • All 8 GUI tests pass

Previously, session activity state was tracked in two places:
- pi--status (buffer-local symbol: idle/sending/streaming/compacting)
- :is-streaming in pi--state plist (boolean)

This duplication was error-prone and confusing. Now:
- pi--status is the single source of truth, defined in pi-core.el
- pi--update-state-from-event sets status on agent_start/agent_end
- pi--extract-state-from-response returns :status for initialization
- :is-streaming and :is-compacting removed from pi--state plist

Benefits:
- Clearer code: one variable to check, not two
- Status set atomically in event handler, not scattered in display functions
- Tests are simpler and more focused
@dnouri dnouri force-pushed the refactor/unify-status-tracking branch from 1f6f52d to 35cd0a5 Compare January 6, 2026 19:31
@dnouri dnouri merged commit acc7fb0 into master Jan 6, 2026
11 of 13 checks passed
@dnouri dnouri deleted the refactor/unify-status-tracking branch January 6, 2026 19:43
dnouri added a commit that referenced this pull request Feb 25, 2026
…le (#21)

Previously, session activity state was tracked in two places:
- pi--status (buffer-local symbol: idle/sending/streaming/compacting)
- :is-streaming in pi--state plist (boolean)

This duplication was error-prone and confusing. Now:
- pi--status is the single source of truth, defined in pi-core.el
- pi--update-state-from-event sets status on agent_start/agent_end
- pi--extract-state-from-response returns :status for initialization
- :is-streaming and :is-compacting removed from pi--state plist

Benefits:
- Clearer code: one variable to check, not two
- Status set atomically in event handler, not scattered in display functions
- Tests are simpler and more focused
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant