Skip to content

feat(assistant): port sessionHistory + AssistantSessionChooser stub from TS - #180

Merged
ericleepi314 merged 1 commit into
mainfrom
worktree-missing-folder-assistant
May 20, 2026
Merged

feat(assistant): port sessionHistory + AssistantSessionChooser stub from TS#180
ericleepi314 merged 1 commit into
mainfrom
worktree-missing-folder-assistant

Conversation

@ericleepi314

Copy link
Copy Markdown
Collaborator

Summary

  • Port typescript/src/assistant/sessionHistory.ts (88 LOC) to src/assistant/session_history.py — paginated session-events client (HistoryPage, HistoryAuthCtx, create_history_auth_ctx, fetch_latest_events, fetch_older_events).
  • Mirror the upstream AssistantSessionChooser.tsx stub as src/assistant/session_chooser.py with PascalCase name so a future dialogLaunchers port can import without renaming.
  • Update src/assistant/__init__.py to re-export the new names; existing placeholder fields preserved.

Parity notes

  • Wire shape preserved: URL path /v1/sessions/{id}/events, all five pinned headers (Authorization, Content-Type, anthropic-version, anthropic-beta: ccr-byoc-2025-07-29, x-organization-uuid), 15s timeout, lowercase anchor_to_latest=true query param.
  • Four-case body-coercion contract from TS preserved: HTTP failure / non-200 / non-JSON / non-dict → None; malformed dataevents=[] with first_id and has_more pass-through.
  • has_more defaults to False when missing — mirrors TS JS-coercion of undefined to falsy.
  • Signature deviation from TS: create_history_auth_ctx takes access_token and org_uuid explicitly (no prepare_api_request global yet in Python). Matches bridge/code_session_api.py + remote/remote_session_manager.py convention.

Planning docs (in my-docs/get-parity-by-folder/, gitignored):

  • assistant-gap-analysis.md
  • assistant-refactoring-plan.md

Both were iterated through 4 rounds of critic review before implementation.

Test plan

  • pytest tests/assistant/ -q → 30 passed, 0 skipped
  • pytest tests/assistant/ --cov=src.assistant → 100% line coverage (71/71 stmts)
  • Regression smoke: pytest tests/bridge/ tests/remote/ tests/assistant/ -q → 232 passed
  • Critic agent APPROVED the implementation as merge-ready

🤖 Generated with Claude Code

…rom TS

Closes the parity gap for typescript/src/assistant/ (88 LOC + 11-line
stub). Adds:

- src/assistant/session_history.py — paginated session-events client
  mirroring TS sessionHistory.ts (HistoryPage, HistoryAuthCtx,
  create_history_auth_ctx, fetch_latest_events, fetch_older_events).
  Preserves the TS four-case body-coercion contract and per-call-site
  debug labels; bool query params serialize lowercase to match axios.
- src/assistant/session_chooser.py — PascalCase stub mirror of
  AssistantSessionChooser.tsx so a future dialogLaunchers port can
  import the real name without an alias.
- src/assistant/__init__.py — re-exports new names; existing placeholder
  fields (ARCHIVE_NAME, MODULE_COUNT, SAMPLE_FILES, PORTING_NOTE)
  preserved.

Tests: 30 cases at 100% line coverage. Wire shape (URL path, all five
pinned headers, anchor_to_latest=true vs before_id, limit default,
15 s timeout), error policy (4xx/5xx/network/timeout/non-JSON/non-dict
all return None; malformed data preserves first_id + has_more), and
has_more JS-mirror default are pinned.

Signature deviation from TS: create_history_auth_ctx takes
access_token + org_uuid explicitly (no prepare_api_request global yet
in Python). Matches bridge/code_session_api.py + remote convention.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ericleepi314
ericleepi314 merged commit f58c1c9 into main May 20, 2026
singlaamitesh pushed a commit to singlaamitesh/clawcodex that referenced this pull request Jul 7, 2026
…ing-folder-assistant

feat(assistant): port sessionHistory + AssistantSessionChooser stub from TS
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