Skip to content

Persist CEO console /clear by clearing EA chat history in backend storage (and fix CI version gate)#392

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/investigate-clear-command-issue
Draft

Persist CEO console /clear by clearing EA chat history in backend storage (and fix CI version gate)#392
Copilot wants to merge 3 commits into
mainfrom
copilot/investigate-clear-command-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 13, 2026

Background

  • Issue/Motivation: User-reported behavior: running /clear in CEO console appeared to wipe EA chat, but refresh restored prior conversation history. During PR review, CI was also reported failing.
  • Root Cause (if bug fix): /clear only reset frontend state/localStorage and rendered empty UI; persisted conversation messages remained on disk and were reused on reload. Separately, CI failed the version gate because PR version matched main (0.7.77).

What Changed

  • Behavioral change: /clear now performs a backend clear for the active EA conversation instead of only client-side reset.
  • API scope update: POST /api/conversation/{conv_id}/clear now supports both oneonone and ea_chat, and clears only conversations matching (employee_id, conversation type).
  • Coverage update: Added integration coverage for EA chat clear persistence across close/reopen.
  • CI fix: Bumped project/package version to 0.7.78 to satisfy CI version bump check against main.

Key Design Decisions

  • Keep conversation identity, clear history: preserve the active EA conversation ID and wipe its persisted history, avoiding frontend-only “new thread” semantics that left old data recoverable.
  • Type-scoped clearing: prevent cross-type deletion by requiring same employee + same conversation type.
  • Reuse existing clear endpoint: minimal surface-area change; no new API route.
  • Minimal CI remediation: fixed CI gate by version bump only, without changing runtime behavior.

Files Changed (annotated)

File Change
frontend/app.js Reworked /clear slash action to call backend clear endpoint for EA chat; only clears terminal view after successful response; reports failure in console.
src/onemancompany/api/routes.py Expanded clear endpoint from one-on-one only to oneonone + ea_chat; changed clear loop filter to same employee_id and same conv.type.
tests/integration/test_conversation_api.py Added test_clear_ea_chat_history_persists_across_reopen to verify disk history is wiped and not restored by reuse/reopen flow.
pyproject.toml Bumped version from 0.7.77 to 0.7.78 to pass CI version gate.
package.json Synced version from 0.7.77 to 0.7.78 for consistency with project version.

Type

  • Bug fix
  • New feature
  • Refactor
  • Visualization / Theme
  • Talent package
  • Documentation
  • Other

Review Checklist

Phase 1 — Bug Hunt

  • No off-by-one, null-ref, or race conditions introduced
  • Error paths tested (what happens when it fails?)
  • Edge cases covered (empty input, duplicates, concurrent access)

Phase 2 — Design Principles (docs/design-principles.md)

  • Single Source of Truth — No duplicated state; data has one owner, one write function
  • Systematic Design — Structural fix, not a patch (would a second similar request need the same code touched?)
  • Modular & General-Purpose — New capability addable without modifying existing code
  • Complete Data Package — New state is serializable, recoverable, registered, terminable
  • No Silent Exceptions — No except: pass; errors logged, CancelledError re-raised
  • Registry/Dispatch — No if-elif chains for type dispatch
  • Status via transition() — No direct node.status = ... assignment
  • Minimal Complexity — No premature abstractions; minimum code for current requirements

Phase 3 — Side Effects

  • No unintended behavioral changes to existing features
  • Serialization/persistence formats are backward-compatible (or migration provided)
  • No new circular imports introduced

Test Plan

  • Unit tests pass (.venv/bin/python -m pytest tests/unit/ -x)
  • Compilation check (.venv/bin/python -c "from onemancompany.api.routes import router; print('OK')")
  • Frontend syntax check (node -c frontend/app.js)
  • New tests written for new/changed behavior
  • Manual testing (describe below)

Manual Test Steps

  1. Open CEO console with existing EA chat history.
  2. Run /clear in EA chat.
  3. Refresh page and reopen EA chat.
  4. Confirm previous history does not reappear.
  5. Confirm CI version check passes with PR version greater than main.

Screenshots

N/A (no visual UI layout change; command behavior change only).

Copilot AI changed the title [WIP] Investigate persistence issue with CEO console clear command Persist CEO console /clear by clearing EA chat history in backend storage May 13, 2026
Copilot AI requested a review from zhengxuyu May 13, 2026 09:36
@zhengxuyu
Copy link
Copy Markdown
Collaborator

@copilot ci/cd没过

@zhengxuyu
Copy link
Copy Markdown
Collaborator

@copilot ci/cd没过

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 13, 2026

@copilot ci/cd没过

已定位并修复这次 CI 失败:失败点是版本检查(PR 版本与 main 同为 0.7.77)。我已在提交 78f0b45 中将版本提升到 0.7.78(同步了 pyproject.toml 与 package.json),并本地复跑了导入检查、unit tests、frontend syntax check,均通过。

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • console.anthropic.com
    • Triggering command: /usr/bin/curl curl -s -X POST REDACTED -H Content-Type: application/x-www-form-urlencoded -d grant_type=authorization_code&code=code&client_id=9d1c250a-e61b-44d9-88ed-5944d1962f5e&code_verifier=v&redirect_uri=http%3A%2F%2Flocalhost -L (dns block)
  • openrouter.ai
    • Triggering command: /usr/bin/python python -m pytest tests/unit/ -x -q (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Persist CEO console /clear by clearing EA chat history in backend storage Persist CEO console /clear by clearing EA chat history in backend storage (and fix CI version gate) May 13, 2026
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 13, 2026

@copilot ci/cd没过

我复查了最新这轮并确认不是代码再次失败:当前 CI(25803329115) 和 Unit Tests(25803329190) 的结论是 action_required,且 job 数为 0,表示工作流未实际执行(通常是需要在 GitHub 页面手动批准/重新运行),不是测试报错。代码侧修复仍在 78f0b45。请先点该 run 的 Approve and run(或 Re-run all jobs)后我再继续跟进结果。

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.

[User feedback] CEO console /clear not persisted — refresh restores old conversation — needs investigation

2 participants