Skip to content

refactor: standardize session function naming and enhance permissions - #272

Merged
sergiofilhowz merged 1 commit into
mainfrom
feat/session-manager-improvements
Jun 16, 2026
Merged

refactor: standardize session function naming and enhance permissions#272
sergiofilhowz merged 1 commit into
mainfrom
feat/session-manager-improvements

Conversation

@sergiofilhowz

@sergiofilhowz sergiofilhowz commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
  • Updated session function names to use kebab-case format for consistency: session::set_meta to session::set-meta, session::set_status to session::set-status, session::append_many to session::append-many, and session::update_message to session::update-message.
  • Added new permission rule !session::config-status to enhance security by preventing unauthorized access to configuration status.
  • Improved documentation to reflect these changes and ensure clarity in function usage.

Summary by CodeRabbit

  • New Features

    • Configuration worker integration enables hot-reloadable session-manager settings without restarts.
    • Storage adapter framework (fs and bridge modes) replaces backend terminology.
  • Refactoring

    • Session-manager API functions standardized to kebab-case naming (e.g., set_metaset-meta).
    • Session runtime architecture redesigned to support hot-swappable configurations.
  • Documentation

    • Updated API references and guides to reflect naming changes and configuration worker patterns.
    • Added integration documentation for new storage adapter and configuration systems.

- Updated session function names to use kebab-case format for consistency: `session::set_meta` to `session::set-meta`, `session::set_status` to `session::set-status`, `session::append_many` to `session::append-many`, and `session::update_message` to `session::update-message`.
- Added new permission rule `!session::config-status` to enhance security by preventing unauthorized access to configuration status.
- Improved documentation to reflect these changes and ensure clarity in function usage.
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview, Comment Jun 16, 2026 4:27pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e579d41a-7d40-4369-843f-5713b60eb0cf

📥 Commits

Reviewing files that changed from the base of the PR and between 7eb91e8 and bece96d.

⛔ Files ignored due to path filters (1)
  • session-manager/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (73)
  • console/web/README.md
  • console/web/src/hooks/use-conversations.ts
  • console/web/src/lib/sessions/api.ts
  • console/web/src/pages/Configuration/tabs/WorkersTab/schema-form/OneOfField.tsx
  • console/web/src/pages/Configuration/tabs/WorkersTab/schema-form/SchemaForm.stories.tsx
  • console/web/src/pages/Configuration/tabs/WorkersTab/schema-form/variant-match.test.ts
  • console/web/src/pages/Configuration/tabs/WorkersTab/schema-form/variant-match.ts
  • console/web/src/stories/fixtures/worker-fixtures.ts
  • docs/sops/README.md
  • docs/sops/binary-worker.md
  • docs/sops/configuration.md
  • docs/sops/new-worker.md
  • harness/docs/architecture.md
  • harness/docs/workers/turn-orchestrator.md
  • harness/src/runtime/session.ts
  • harness/src/turn-orchestrator/assistant-streaming/ports.ts
  • harness/src/turn-orchestrator/assistant-streaming/run.ts
  • harness/tests/_helpers/fakeSessionManager.ts
  • harness/tests/turn-orchestrator/coalesce-deltas.test.ts
  • harness/tests/turn-orchestrator/run-start.test.ts
  • iii-permissions.yaml
  • session-manager/Cargo.toml
  • session-manager/README.md
  • session-manager/architecture/README.md
  • session-manager/architecture/integration.md
  • session-manager/architecture/internals.md
  • session-manager/config.yaml
  • session-manager/src/config.rs
  • session-manager/src/configuration.rs
  • session-manager/src/error.rs
  • session-manager/src/events.rs
  • session-manager/src/functions/append_many.rs
  • session-manager/src/functions/create.rs
  • session-manager/src/functions/get_message.rs
  • session-manager/src/functions/mod.rs
  • session-manager/src/functions/set_active_leaf.rs
  • session-manager/src/functions/set_meta.rs
  • session-manager/src/functions/set_status.rs
  • session-manager/src/functions/store_protocol.rs
  • session-manager/src/functions/update_message.rs
  • session-manager/src/lib.rs
  • session-manager/src/main.rs
  • session-manager/src/manifest.rs
  • session-manager/src/resync.rs
  • session-manager/src/runtime.rs
  • session-manager/src/service.rs
  • session-manager/src/store/bridge.rs
  • session-manager/tests/common/bridge.rs
  • session-manager/tests/common/workers.rs
  • session-manager/tests/common/world.rs
  • session-manager/tests/features/append.feature
  • session-manager/tests/features/append_many.feature
  • session-manager/tests/features/branching.feature
  • session-manager/tests/features/delete.feature
  • session-manager/tests/features/engine_bridge.feature
  • session-manager/tests/features/engine_reactivity.feature
  • session-manager/tests/features/engine_roundtrip.feature
  • session-manager/tests/features/errors.feature
  • session-manager/tests/features/fork.feature
  • session-manager/tests/features/list.feature
  • session-manager/tests/features/manifest.feature
  • session-manager/tests/features/meta.feature
  • session-manager/tests/features/persistence.feature
  • session-manager/tests/features/status.feature
  • session-manager/tests/features/streaming.feature
  • session-manager/tests/features/update_message.feature
  • tech-specs/2026-06-agentic/harness.md
  • tech-specs/2026-06-agentic/presentation/src/components/diagrams/EventFanOut.tsx
  • tech-specs/2026-06-agentic/presentation/src/content/workers.ts
  • tech-specs/2026-06-agentic/presentation/src/pages/ConsolePage.tsx
  • tech-specs/2026-06-agentic/presentation/src/pages/TelegramPage.tsx
  • tech-specs/2026-06-agentic/presentation/src/sections/TurnSection.tsx
  • tech-specs/2026-06-agentic/session-manager.md

📝 Walkthrough

Walkthrough

Renames all session-manager public function identifiers from underscore to hyphen convention (session::set_metasession::set-meta, etc.), replaces the backend/backend_config config model with a typed StorageAdapter enum and JSON-schema generation, introduces a configuration-worker-owned hot-reload layer (configuration.rs, runtime.rs, resync.rs), migrates SessionService to a hot-swappable ConfigCell, extracts variant-match.ts helpers for OneOfField, updates permissions, test infrastructure, and propagates all changes through harness, console, BDD feature tests, and documentation.

Changes

Session-manager typed config, hot-reload runtime, and global API rename

Layer / File(s) Summary
WorkerConfig typed adapter model, schema generation, and BootSignature
session-manager/src/config.rs, session-manager/config.yaml, session-manager/Cargo.toml, session-manager/src/manifest.rs
Replaces backend/backend_config with a typed, adjacently-tagged StorageAdapter enum; adds Serialize+JsonSchema derives, from_yaml/from_file/from_json/to_json/json_schema/boot_signature methods, expand_env for YAML seed parsing, strips runtime config from config.yaml, updates manifest default_config shape, and bumps crate to 0.2.0.
Hot-swappable SessionRuntime and post-swap resync
session-manager/src/runtime.rs, session-manager/src/resync.rs, session-manager/src/lib.rs
Adds AdapterMode, SessionRuntime, SessionBuildContext, and build_runtime() that wires fs-mode or bridge-mode storage/event plumbing. Adds resync_triggers() to replay session state as trigger events after an adapter swap. Exposes configuration, resync, runtime as public modules.
ConfigCell, AppState, hot-reload logic, and SessionService migration
session-manager/src/configuration.rs, session-manager/src/service.rs
Adds ConfigCell, AppState, ReloadOutcome/ReloadStatus, register_config, fetch_config, apply_runtime (boot-signature-gated rebuild vs. snapshot-swap), reload_serialized with last-good retention, and wires session::on-config-change/session::config-status. Migrates SessionService to a hot-swappable ConfigCell and makes clamp_limit async.
Function registration, store protocol wiring, and boot flow
session-manager/src/functions/mod.rs, session-manager/src/functions/store_protocol.rs, session-manager/src/main.rs, session-manager/src/functions/*.rs, session-manager/src/events.rs, session-manager/src/error.rs, session-manager/src/store/bridge.rs
Rewires register_all to accept AppState and build per-call Deps from the live runtime snapshot. Gates all session::store::* protocol handlers via fs_store/fs_emitter AppState helpers. Renames all registered function IDs to hyphenated forms. Refactors main.rs boot to optional seed, config registration, authoritative fetch, SessionBuildContext+AppState construction, and conditional bridge shutdown.
OneOfField variant-match helpers and adapter-oneof fixture
console/web/src/pages/Configuration/tabs/WorkersTab/schema-form/variant-match.ts, ...variant-match.test.ts, ...OneOfField.tsx, ...SchemaForm.stories.tsx, console/web/src/stories/fixtures/worker-fixtures.ts
Extracts isSingleStringEnumVariant, variantLabel, matchVariantIndex, variantDefault into variant-match.ts with discriminated-tag → structural → first-variant fallback. Updates OneOfField to use these helpers. Adds a full test suite, an adapter-oneof schema fixture, and a Storybook story.
Harness and console TypeScript API identifier renames
harness/src/runtime/session.ts, harness/src/turn-orchestrator/assistant-streaming/ports.ts, harness/src/turn-orchestrator/assistant-streaming/run.ts, harness/tests/_helpers/fakeSessionManager.ts, harness/tests/turn-orchestrator/*.test.ts, console/web/src/lib/sessions/api.ts, console/web/README.md, console/web/src/hooks/use-conversations.ts
Updates all harness and console TypeScript call sites from underscore to hyphen session function identifiers.
Permissions hardening and test infrastructure refactor
iii-permissions.yaml, session-manager/tests/common/workers.rs, session-manager/tests/common/world.rs, session-manager/tests/common/bridge.rs
Updates deny rules to hyphenated identifiers, adds session::config-status and session::on-config-change denials. Refactors test worker registration to use build_runtime+AppState instead of manual FsStore/Deps wiring.
BDD feature test step renames
session-manager/tests/features/*
Renames all session::* step invocations to hyphenated forms across all 18 affected feature files. No assertion logic changes.
Documentation updates
docs/sops/configuration.md, docs/sops/binary-worker.md, docs/sops/README.md, docs/sops/new-worker.md, session-manager/README.md, session-manager/architecture/*.md, harness/docs/*.md, tech-specs/2026-06-agentic/*.md, tech-specs/2026-06-agentic/presentation/src/...
Adds configuration.md SOP guide. Rewrites session-manager README (storage adapters, hot-reload config). Updates architecture/integration.md and internals.md. Propagates kebab-case renames through all tech-specs and presentation components.

Sequence Diagram

sequenceDiagram
  participant main as main.rs boot
  participant configuration as configuration worker
  participant apply_runtime as apply_runtime
  participant SessionRuntime
  participant resync_triggers
  participant iii as III engine
  participant on_config_change as session::on-config-change

  main->>configuration: register_config(schema, seed)
  main->>configuration: fetch_config()
  configuration-->>main: WorkerConfig
  main->>SessionRuntime: build_runtime(cfg, ctx)
  main->>iii: register store protocol + session functions + config trigger

  Note over iii,on_config_change: Runtime operation
  iii->>on_config_change: configuration:updated fired
  on_config_change->>configuration: configuration::get (re-fetch)
  configuration-->>on_config_change: WorkerConfig
  on_config_change->>apply_runtime: apply new config
  apply_runtime->>apply_runtime: compare boot_signature
  alt adapter unchanged
    apply_runtime->>SessionRuntime: swap ConfigCell snapshot only
  else adapter changed
    apply_runtime->>SessionRuntime: build new SessionRuntime
    apply_runtime->>resync_triggers: replay store state → events
    apply_runtime->>SessionRuntime: shutdown old bridge
  end
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • iii-hq/workers#251: Introduced the session-manager-based harness/console session integration including harness/src/runtime/session.ts and console session reconciliation — the exact call sites this PR renames to hyphenated identifiers.
  • iii-hq/workers#234: Authored tech-specs/2026-06-agentic/harness.md which this PR updates to rename session::set_status and session::update_message throughout.
  • iii-hq/workers#242: Modified session-manager/src/functions/store_protocol.rs constants and session function registration — the same surface this PR renames and rewires to AppState.

Poem

🐰 Hop, hop, the dashes arrive,
Where underscores once dared to thrive!
set-meta, set-status — all kebab and neat,
Hot-reload config makes the runtime fleet.
The adapter swaps, the resync replays,
This bunny cheers for hyphenated days! 🎉

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/session-manager-improvements

@github-actions

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 22 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

@sergiofilhowz
sergiofilhowz merged commit ca4cb2c into main Jun 16, 2026
21 of 22 checks passed
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