Skip to content

Improve first-turn action affordances - #535

Merged
100yenadmin merged 1 commit into
mainfrom
codex/worldos-action-affordances
Jun 1, 2026
Merged

Improve first-turn action affordances#535
100yenadmin merged 1 commit into
mainfrom
codex/worldos-action-affordances

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Jun 1, 2026

Copy link
Copy Markdown
Member

Summary

  • replace repeated Explore button detail text with distinct player-facing action affordances on the table palette
  • keep deterministic scripted-provider narration in-world instead of leaking smoke-provider/test-loop language into the chronicle
  • preserve chronicle order for first-turn replay so the player YOU row renders before the DM reply when /chat and recentEvents are merged

Verification

  • bash -n scripts/play_scripted_dm.sh
  • python3 -m py_compile viewer/server.py
  • python3 -m pytest viewer/tests/test_session_surface.py viewer/tests/test_live_narration_stream.py viewer/tests/test_openworlds_static.py qa/test_macos_app_static.py -q
  • In-app browser proof on patched worktree, port 8796: private art present, can_act=true, five enabled actions, visible action details Press onward / Speak aloud / Act in world / Roll a skill / Resist danger, one accepted /move, YOU row before DM reply, no smoke-provider leak, no double period, zero browser console errors. Evidence archived outside the repo under /Volumes/LEXAR/Codex/worldos-product-slices/action-affordances-order-port8796-ac4423b/.

Notes

  • Engine remains the sole campaign-state writer. This changes read-only action metadata, chronicle rendering order, and dev/test scripted-provider visible narration only.
  • This is browser-first product evidence, not built-app handoff evidence and not a release verdict.

Summary by CodeRabbit

Release Notes

  • New Features

    • Chronicle entries now include timestamps for accurate event ordering
    • Action palette displays enhanced action descriptions
  • Bug Fixes

    • Player actions and event history now interleave correctly by event time
  • Tests

    • Added test coverage for chronicle event interleaving by timestamp

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1aa0a58e-84ed-4b91-8216-6cd4f373d3af

📥 Commits

Reviewing files that changed from the base of the PR and between ac4423b and 395c460.

📒 Files selected for processing (7)
  • scripts/play_scripted_dm.sh
  • viewer/openworlds/app.jsx
  • viewer/openworlds/screen-table.jsx
  • viewer/server.py
  • viewer/tests/test_live_narration_stream.py
  • viewer/tests/test_openworlds_static.py
  • viewer/tests/test_session_surface.py

📝 Walkthrough

Walkthrough

This PR enriches the chronicle data flow with event timestamps and action metadata to enable deterministic interleaving of player moves and narrative events. Server-side action models now include optional detail descriptors; events gain eventAt timestamps; client ingests these and timestamps optimistic echoes; chronicle merging uses event time to interleave entries correctly; UI renders action palettes with detail fallbacks; tests validate ordering behavior.

Changes

Chronicle Enrichment with Event Time and Action Detail

Layer / File(s) Summary
Server action detail and event time enrichment
viewer/server.py
_action_item signature adds optional detail parameter; build_action_model passes descriptive detail strings for exploration (Continue/Say/Do/Check/Save) and combat (Attack/Bonus/Reaction) actions. _session_recent_events extracts numeric t field from event rows and emits as eventAt. _session_available_actions includes detail from action items in payload.
Client chronicle data ingestion with event timestamps
viewer/openworlds/app.jsx
Player action echoes in recordPlayerEcho now attach eventAt: Date.now()/1000. /chat poll player dialog rows include eventAt: it.at. /chat DM narration rows include eventAt: it.at. /events live narration stream includes eventAt: e.t from event payloads alongside existing dedup/orderSeq logic.
Chronicle event-time merging and sorting
viewer/openworlds/screen-table.jsx
buildChronicleLog defines comparator preferring eventAt (when both entries have numeric values), then stable sequence ordering (orderSeq/seq), then client ingest index at. Merged deduped recent + live tail is re-sorted using this comparator instead of prior insertion order.
Action palette detail label rendering
viewer/openworlds/screen-table.jsx
EncounterButton detail prop in exploration and in-combat action grids now uses `a.detail
Test coverage for chronicling order and action metadata
viewer/tests/test_live_narration_stream.py, viewer/tests/test_openworlds_static.py, viewer/tests/test_session_surface.py
New live narration stream test verifies player dialog from /chat interleaves between recentEvents narration rows by event time. Static test asserts a.detail || a.groupLabel expression in table. Session surface tests assert eventAt projection from input recent_events and detail strings for multiple actions (continue, say, do, check, save).
Scripted DM narrative and move resolution updates
scripts/play_scripted_dm.sh
Opening narration changed to lantern/road setting. Move-processing loop computes beat and appends player chat entry before resolution. Python reply generation conditionally punctuates player choice and uses new lantern/crowd narration text.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related issues

  • electricsheephq/WorldOS#503: Addresses the deterministic ordering of player echoes, event rows, and DM narration via event-time-based comparator and scripted DM echo reordering.

Possibly related PRs

  • electricsheephq/WorldOS#394: Extends LIVE DM narration streaming in viewer/openworlds/app.jsx/viewer/openworlds/screen-table.jsx by enriching /chat + /events chronicle entries with eventAt timestamps and event-time interleaving.

  • electricsheephq/WorldOS#201: Modifies viewer action model pipeline (viewer/server.py action metadata and viewer/openworlds/screen-table.jsx action rendering) for UI gating and labels.

  • electricsheephq/WorldOS#400: Modifies viewer/openworlds/app.jsx's player-echo logging in /chat turn flow; this PR extends those echoed log rows with eventAt timestamps.

Poem

🐰 With timestamps now on every turn,
The chronicle rows shall interleave and burn,
Player moves nestled 'tween narration's song,
Actions labeled bright—no detail wrong,
Time flows true from server to screen! 🕐✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description includes a summary of changes, verification steps, and notes, but the required CLA and licensing section is missing or incomplete with unchecked boxes. Complete the Licensing/CLA section by checking the required checkboxes to confirm CLA compliance and data handling practices.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Improve first-turn action affordances' accurately summarizes the main change of enhancing action display on the table palette with distinct detail text.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

@100yenadmin
100yenadmin merged commit f78ccc2 into main Jun 1, 2026
15 checks passed
@100yenadmin
100yenadmin deleted the codex/worldos-action-affordances branch June 1, 2026 21:20
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