Zendo pull model - #1
davidabelin wants to merge 20 commits into
Conversation
…onality - Added case_id field to ChatTurnRequest and TurnRequest models - Updated API routes to support fetching Koans by title and ID - Improved memory logbook pagination and filtering capabilities - Refactored front-end scripts and styles for better case display - Cleaned up deprecated API endpoints and adjusted related tests
- Reworked the public Sanzen Room layout for better use of screen space. - Expanded the central conversation transcript area. - Tightened the chat header spacing and renamed the title to “Chat with Zen Master Mumonbot”. - Compactified chat bubbles by reducing padding, line height, and forced sender/message line breaks. - Changed Markdown rendering for chat bubbles to prefer inline output. - Made the `Speak...` textarea short by default while keeping it full-width. - Stacked `Send`, `Save`, and `Reset` vertically beside the textarea on desktop. - Added a mobile override so the input controls remain usable on narrow screens. - Narrowed the left reference panel and widened the right session setup panel. - Made the right session setup panel scroll when content exceeds available height. - Improved Sanzen Room interaction behavior. - Restored the “Mumonbot is considering your words” thinking indicator during streamed response lag. - Kept the thinking indicator visible after the stream `start` event until real reply content or an error arrives. - Delayed creation of the empty Mumonbot reply bubble until the first streamed response chunk. - Added dynamic case-context copy after a koan is selected. - Reset the case-context note when the session is reset. - Updated the entrance hall. - Added Administrative Area links to the hero actions and site map. - Added subtle bamboo, lotus, and bowl flourishes to the entrance hero. - Switched the public font stack toward `Sahitya` with Devanagari-adjacent fallbacks for a more Sanskrit/Pali-adjacent feel. - Fixed plain base-template page spacing. - Added a default content inset for simple pages such as Admin Login, avoiding flush-left content while preserving full-width custom layouts. - Updated project notes and GPT/API schema documentation. - Added April 19 usage notes and screenshot findings to the rolling to-do list. - Recorded April 20 implementation progress across UI, review workflow, API, vector-store sync defaults, and training set05 planning. - Updated `action_schemas.yaml` to version `3.4.3`. - Added koan lookup endpoints by ID and title. - Documented memory-logbook backward pagination with `end_index`. - Documented filtered/paginated archived conversation listing. - Removed deprecated full-logbook and legacy append endpoints from the action schema. - Expanded review filter enum values and clarified review/session workflow descriptions. - Verification performed. - Browser checks confirmed selected-case note updates, admin-page inset, entrance links/flourishes, restored thinking indicator behavior, and non-overlapping input controls. - `git diff --check` passed aside from existing CRLF normalization warnings.
- Reorganized `project/rolling_to_do_list.md` into a dated completed chronology plus active open work tracks. - Added the new artwork, set05, model-frequency, and Responses-tool priorities to the rolling to-do. - Recorded the reopened active model menu and added a local Use/Alter model-frequency snapshot for set05 planning. - Added `include_solution_notes` to `load_case_context`, returning the recorded case 46 project note from `solutions.md`. - Added `end_index` pagination support to the local `load_memory_summaries` Responses tool. - Added focused runtime-tool tests and regenerated `openai_response_tools.json`. Verification: - Installed pytest 9.0.3 into `zb_venv`` - Full zb_app suite passed, including new tests for `load_case_context` and `load_memory_summaries`. - `py_compile` passed for touched Python files. - Manual tool/schema sanity checks passed.
…s schema - Removed `zenbot_knowledge/openai_response_tools.json` from the knowledge set. - Updated `action_schemas.yaml` to version 3.4.4 and generated matching `action_schemas.json`. - Added GPT-facing API routes for exemplar search, memory-candidate queueing, review-request queueing, and runtime status events. - Added optional koan `include_solution_notes` support to the koan-by-ID API. - Updated docs and vector-store sync defaults to use `action_schemas.yaml` / `action_schemas.json`. - Changed the internal Responses tool export helper to write app-local diagnostics instead of knowledge files. - Changed default `student_id` to 'guest' or 'webuser' - Added tests confirming YAML/JSON schema parity and live route/schema alignment.
- Use zendo_mainhall.png as the entrance hall splash hero. - Add zenbot.png as a Mumonbot teacher-seat image in the sanzen room. - Tune hero and teacher-seat styling so the artwork is visible without crowding the chat UI.
- Remove .gitignore inclusion from zb_app/.gcloudignore - Keep App Engine deploy exclusions explicit and separate from Git/GitHub ignores - Restore zendo_mainhall.png to the GAE upload package while preserving deploy junk exclusions
- Keep .gcloudignore independent from .gitignore so Git-only ignores do not hide web assets from GAE - Add explicit deploy exclusions for local Python cache, type-check, test, build, and virtualenv artifacts - Confirm zendo_mainhall.png is included in the App Engine upload list - Restore deploy package size from thousands of cache files back to the expected small app bundle
- Shrank the public browser surface across the Entrance Hall, Gateless Gate, and Sanzen Room with tighter spacing, smaller controls, reduced panel weight, and more compact text scales. - Consolidated Sanzen Room side content by moving Working Form notes into the case/context panel and reducing the teacher portrait to a compact setup strip. - Added `(bows)`, `(smiles)`, and `(winks)` gesture buttons that insert parenthetical gestures into the chat input at the cursor. - Updated the public-page test to expect the current `zendo_mainhall.png` asset and added coverage for the new gesture controls. - Recorded the completed UI/UX pass in `project/rolling_to_do_list.md`.
- Add a public `/intro-tour` Flask route for the Brother Zenbot zendo tour. - Create `intro_tour.html`, extending `base.html`, with the Rinzai Zendo Meaning conversation reshaped into structured HTML sections. - Incorporate `static/images/zendo_tree_A.png` as the page hero image with minimal zendo-style presentation. - Add intro-tour CSS for the hero, article sections, blockquotes, and follow-up navigation. - Clean up the Entrance Hall link copy for the new tour.
- Change the intro tour hero image from cropped `object-fit: cover` behavior to responsive contained sizing so `zendo_tree_A.png` displays as full artwork instead of a blurry bottom crop. - Adjust the intro tour hero layout so image, overlay, and text use viewport-aware sizing. - Add shared CSS font-size variables for the public base-template pages. - Increase the smallest public UI text from the previous 8-10px range into a more readable scale. - Apply the larger shared typography scale across the entrance hall, intro tour, Gateless Gate pages, zendo workspace/chat panels, controls, helper text, and footer. - Update the intro tour image alt text to match the actual artwork.
- Split Flask behavior into shared HTTP support plus web, zb_api, and admin/review blueprints. - Reduced main.py to the stable application composition and deployment entry point. - Updated template endpoint references for blueprint-qualified url_for calls while retaining existing URL contracts. - Documented module ownership and extended docstring coverage checks. - Added route/template regression tests and aligned stale preset test fixtures with current configuration.
- Updated project release markers and deployment/docs messaging to v3.2.5. - Restored generic gpt-5.5 to the active live botling registry alongside fine-tuned models. - Moved the asynchronous session critic to gpt-5.6-sol with explicit medium reasoning and prompt-cache TTL options. - Documented critic configuration, opt-in behavior, submission flow, and Responses API polling. - Added regression coverage for the generic live model and GPT-5.6 critic request shape.
- Add missing space between “Zen.” and “Now” in both default preset instructions
- Comment out the End/(bows) button and its gesture-binding code - Remove the obsolete End shortcut hint - Verify the Chatter page no longer renders the gesture control
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f32de9cee3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Keep deploy exclusions explicit in this file. Do not include `.gitignore`: | ||
| # local Git/GitHub ignore rules are not necessarily App Engine deploy rules. |
There was a problem hiding this comment.
Keep dotenv secrets out of App Engine uploads
On a normal developer checkout containing a Git-ignored .env, removing #!include:.gitignore makes gcloud app deploy include that file because the new explicit exclusions never add .env. This can place OpenAI keys, Flask secrets, and action tokens in the uploaded App Engine source bundle; retain an explicit .env exclusion before deploying.
Useful? React with 👍 / 👎.
| conversation_id, messages, metadata = utipy.create_conversation( | ||
| student=payload.student, | ||
| settings=payload.settings, | ||
| ) |
There was a problem hiding this comment.
Preserve case grounding in API-created sessions
When /zb_api/chat receives the newly supported case_id with no conversation ID, this creation path drops it instead of forwarding it to create_conversation, so the startup messages and metadata are unanchored despite the accepted request field. The unknown-ID recreation path below has the same issue; pass payload.case_id in both creation paths.
Useful? React with 👍 / 👎.
| records = [ | ||
| _conversation_record_from_blob(blob) | ||
| for blob in BUCKET.list_blobs(prefix="zbchats/") | ||
| if blob.name.endswith(".jsonl") |
There was a problem hiding this comment.
Avoid downloading every transcript before pagination
For every /zb_api/conversations/list request, including limit=1, this comprehension calls _conversation_record_from_blob for every archived object, and that helper downloads and parses the full JSONL transcript. As the archive grows, a nominally paginated listing becomes O(total archive bytes) per request and can time out or incur substantial storage egress; paginate or query an index before downloading transcript bodies.
Useful? React with 👍 / 👎.
| _LOCAL_REVIEW_REQUESTS_PATH = ( | ||
| Path(__file__).resolve().parent / "config" / "review_requests.jsonl" | ||
| ) | ||
| _SOLUTION_NOTES_PATH = _REPO_ROOT / "zenbot_knowledge" / "solutions.md" |
There was a problem hiding this comment.
Package solution notes inside the deployed source
The documented deployment runs gcloud app deploy app.yaml from the zb_app source directory, so the sibling ../zenbot_knowledge/solutions.md is outside the uploaded App Engine application. In production _load_solution_notes therefore always sees a nonexistent path, making include_solution_notes=true and the corresponding function-tool option silently return no notes; package the file under the deploy root or load it from deployed storage.
Useful? React with 👍 / 👎.
| {% block content %} | ||
| <main class="intro-tour"> | ||
| <section class="intro-tour-hero" aria-labelledby="intro-tour-title"> | ||
| <img class="intro-tour-tree" src="{{ url_for('static', filename='images/zendo_tree_A.png') }}" alt="Four Zenbot trees with old terminals around a luminous stone practice floor"> |
There was a problem hiding this comment.
Add the referenced tour image to tracked assets
The new public /intro-tour page requests static/images/zendo_tree_A.png, but a repository-wide asset listing shows no tracked file with that name, and .gitignore explicitly ignores it. Consequently every deployed visit renders a broken hero image; commit the referenced asset or use one of the tracked images.
Useful? React with 👍 / 👎.
Non-fine-tuned models like gpt-5.5 were answering dokusan in a generic modern-coach register and, worse, replying to a student's closing (bows) with a bare (bows) that then kept talking instead of ending the session. The fine-tunes never had this problem because Mumon's register and the closing ritual are baked into their weights; live models needed the same thing spelled out in the prompt. - `utilities._response_instructions` now opens with a static block built from `static/mumon_exemplars.jsonl` (a 96-transcript snapshot of `training/trainset03/trainset03a.jsonl`) rendered as `Student:`/`Mumon:` lines, gated by the new `MUMON_EXEMPLARS_ENABLED`/`MUMON_EXEMPLARS_PATH` config and skipped for `ft:`-prefixed fine-tuned models via `_is_finetuned_model`; a live gpt-5.5 smoke test confirmed a standalone `(bows)` is now answered with a bare `(bows)` and the turn ends, and the second turn reported about 19k cached input tokens thanks to the block being a stable prefix. - Added `DOKUSAN_CLOSING_RULE` to the instructions block for every model (fine-tuned included), since the bows-then-keep-talking failure was possible on any model, not just generic ones. - `_startup_system_prompt` is rebuilt from the preset `description` followed by its `instruction`, matching the system prompt the fine-tunes were actually trained with, and the four default presets in `config.py` were rewritten around a single consistent Mumonbot persona description instead of divergent one-liners; the now-dead `START_CHATS` opening-prompt constant was deleted. - `scripts/inspect_botlings.py` gains `--show-instructions` (with `--case`) to print the fully resolved instructions block plus exemplar-inclusion and character/token-estimate diagnostics without making a live API call. - `tests/test_prompt_context.py` is new (8 tests, all passing, full suite 83 passed) and covers exemplar rendering, the fine-tuned/generic split, cache-ordering (exemplars before the dynamic case-focus line), graceful degradation when the exemplar file is missing or disabled, and malformed-line skipping in the loader. - Left out: no automated check pins the ~19k cached-token figure or the live model's actual tone — that evidence is a one-off manual smoke test, not a regression test, so a future prompt change could silently drift without failing CI. - Version bumped to v3.2.6 in `VERSION`/`README.md`, with `CHANGELOG.md` and `.env.example` updated to match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
No description provided.