Skip to content

feat(sessions): emit live + work_ids after prompt with work_ref - #1

Draft
rigario wants to merge 3 commits into
mainfrom
cursor/hermes-live-work-ids-b1b6
Draft

rigario wants to merge 3 commits into
mainfrom
cursor/hermes-live-work-ids-b1b6

Conversation

@rigario

@rigario rigario commented Sep 4, 2026 •

Copy link
Copy Markdown
Owner

Why

Dashboard is_active is a 300s recency heuristic. Operators need an honest live flag and a list of work refs the session actually received after POST .../prompt with work_ref. Empty or unwoken sessions must stay live: false with work_ids: [].

What changed

One ownership path in SessionDB:

  • POST .../prompt with work_ref persists owned work ids and marks the session live.
  • List/get (dashboard /api/sessions, /api/profiles/sessions, and api_server /api/sessions plus aliases) emit live + metadata.work_ids from that store.
  • is_active is unchanged and is not live.
  • No invented work on empty sessions.

Verification

scripts/run_tests.sh tests/test_hermes_state.py::TestSessionLiveWork tests/hermes_cli/test_web_server.py::TestWebServerEndpoints::test_wake_with_work_ref_lists_and_gets_live_work tests/hermes_cli/test_web_server.py::TestWebServerEndpoints::test_prompt_without_work_ref_does_not_invent_work_or_live tests/hermes_cli/test_web_server.py::TestWebServerEndpoints::test_is_active_alone_is_not_live tests/gateway/test_api_server.py::TestApiServerSessionLiveWork -q

Optional upstream improvement for any operator observing sessions. Not a merge gate for any downstream product.

Weave: 99503cb2 (parent 3a46344f)

Persist work_ref from POST /prompt into SessionDB metadata. List/get
emit live: true and metadata.work_ids from that store. is_active stays
a dashboard heuristic and is not live. Empty inventory stays honest.

Co-authored-by: Rigario <rigario@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

🔎 Lint report: cursor/hermes-live-work-ids-b1b6 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9884 on HEAD, 9880 on base (🆕 +4)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5266 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

apply_session_live_work always takes/returns a session dict. Prompt
handlers coerce owner/profile and 404 if the row vanished. Tests assert
the row before projecting.

Co-authored-by: Rigario <rigario@users.noreply.github.com>

@rigario rigario left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source hygiene — FAIL

Weave: 3a46344f (parent), 99503cb2 (child). Live HEAD 7225ccc8b2045e69d19c3b5dea3749a4e121c618 on cursor/hermes-live-work-ids-b1b6. Review only. Not merge-ready. No merge, no canary, no restage.

Named siblings stay on the Weave card (99503cb2, e3c933e9, 63fcf033). Tests may use example ids.

Failures

  1. Weave task id in source. tests/hermes_cli/test_web_server.py posts work_ref: "99503cb2" and asserts that live card id four more times. Sibling tests already use example ids (card-1, work-a). Swap this fixture to an example id; do not keep the named sibling in-tree.

  2. Weave / lab ids in a commit message. f1feb6c861ec79f58159901743b4b3da5eedaec4 body is Weave: 99503cb2 (parent 3a46344f). That stays in git history. 7225ccc8 is clean.

  3. Lab / work-log comments in product and test source.

    • hermes_cli/web_server.py (profile-sessions routes): comment says Weave probes /api/profiles/sessions as the dashboard alias.
    • tests/hermes_cli/test_web_server.py (test_is_active_alone_is_not_live): docstring names the “Weave live contract.”
      Keep the alias-ordering reason. Drop the lab name.

Clean on this pass

  • No secrets, hosts, IPs, lane ports, or roster/gateway defaults in the six-file diff.
  • No plan, recap, or stamp-hunt docs added.
  • attach_session_work does not mint a default owner or agent name; owner/profile are stored only when the wake supplies them.
  • No people or agent names as product defaults.

The PR description still recites sibling cards and a five-answer stamp hunt. That is not git source; do not park the same recap in-repo.

Two-Eyes owns behavior. Hygiene only. FAIL.

@cursor
cursor Bot force-pushed the cursor/hermes-live-work-ids-b1b6 branch from 7225ccc to fb96815 Compare September 4, 2026 08:40
Use example work ids in dashboard wake tests. Keep the
alias-order reason on /api/profiles/sessions. is_active
stays not live.

Co-authored-by: Rigario <rigario@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/hermes-live-work-ids-b1b6 branch from fb96815 to 7b1d054 Compare September 4, 2026 08:43

@rigario rigario left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two-Eyes correctness COMMENT (not an approval, not merge-ready).

Weave: 99503cb2 (parent 3a46344f). HEAD reconstructed: 7225ccc.

Verdict: PASS on this SHA only. Separate session from the implementer. Evidence is the live ownership path plus an independent persist/list/get probe, not the PR text, not the listed tests, not implementer PASS, not card stamps.

Steered invariant holds on this tree:

  • POST /api/sessions/{id}/prompt (and /api/profiles/sessions/{id}/prompt) with work_ref writes through SessionDB.attach_session_work into sessions.metadata (live: true, work_ids containing that work, owner/profile only when supplied).
  • Dashboard list/get and profile aliases call apply_session_live_work. After wake they emit live: true and metadata.work_ids containing the work.
  • api_server _session_response includes live, metadata, owner, profile. Profile aliases on api_server are the same handlers. No sibling omit of those fields.
  • POST without work_ref does not invent ids. Empty/unwoken inventory stays live: false, work_ids: [].
  • is_active remains the 300s recency heuristic on dashboard list only. A fresh idle session can be is_active: true and still live: false. api_server does not emit is_active.
  • Persist is the Hermes-owned store, not a one-caller guard. Both web_server and api_server call attach_session_work.
  • Honest wake path exists. This is not always-false.
  • Ownership path has no lab roster/host/port bake-in. Kit stays HTTP forward (out of scope).

Named open stay on Weave: e3c933e9, 63fcf033 (still To Do). Children 38088b60 and b1731089 wait for parent proof after restage. 99503cb2 stays OPEN until live staged Hermes emits live+work. No merge. No canary. No restage. No approve.

@rigario rigario left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two-Eyes correctness COMMENT (not an approval, not merge-ready).

Weave: 99503cb2 (parent 3a46344f). HEAD reconstructed: 7b1d054.

Verdict: PASS on this SHA only. Separate session from the implementer. Evidence is the live ownership path plus an independent persist/list/get probe, not the PR text, not the listed tests, not implementer PASS, not card stamps.

This SHA is a hygiene strip of 7225ccc only (example work ids; lab names dropped from comments). Product files vs that SHA: comment wording on /api/profiles/sessions. hermes_state.py and api_server.py are byte-identical. Steered invariant still holds:

  • POST /api/sessions/{id}/prompt (and /api/profiles/sessions/{id}/prompt) with work_ref writes through SessionDB.attach_session_work into sessions.metadata (live: true, work_ids containing that work, owner/profile only when supplied).
  • Dashboard list/get and profile aliases call apply_session_live_work. After wake they emit live: true and metadata.work_ids containing the work.
  • api_server _session_response includes live, metadata, owner, profile. Profile aliases on api_server are the same handlers. No sibling omit of those fields.
  • POST without work_ref does not invent ids. Empty/unwoken inventory stays live: false, work_ids: [].
  • is_active remains the 300s recency heuristic on dashboard list only. A fresh idle session can be is_active: true and still live: false. api_server does not emit is_active.
  • Persist is the Hermes-owned store, not a one-caller guard. Both web_server and api_server call attach_session_work.
  • Honest wake path exists. This is not always-false.
  • Ownership path has no lab roster/host/port bake-in. Current source and the six-file diff vs main have no named card ids. Kit stays HTTP forward (out of scope).

Independent probe on this SHA (temp SessionDB, not the listed tests): idle stays live false / work_ids []; empty work_ref is refused; wake stores live true + owned work + supplied owner/profile; list projection matches get; idle can be dashboard-is_active true and still live false; archived is not live.

Named open stay on Weave: e3c933e9, 63fcf033 (still To Do). Children 38088b60 and b1731089 wait for parent proof after restage. 99503cb2 stays OPEN until live staged Hermes emits live+work. No merge. No canary. No restage. No approve.

@rigario rigario left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source hygiene — PASS

Weave: 3a46344f (parent), 99503cb2 (child). Live HEAD 7b1d054bdd1cb0373f27fded2ee7314c804d4996 on cursor/hermes-live-work-ids-b1b6. Review only. Not merge-ready. No merge, no canary, no restage. Not an approval.

Separate session from the implementer and from Two-Eyes. Prior hygiene FAIL 5110906722 on 7225ccc does not cover this SHA. Two-Eyes PASS 5110946853 on 7225ccc does not cover this SHA and is not this review.

Named siblings stay on the Weave card (99503cb2, e3c933e9, 63fcf033). Tests may use example ids.

Claimed strip (FAIL 5110906722) holds on this SHA

  1. Weave task id removed from live tests. Dashboard wake fixture is example id card-1 (was 99503cb2 on 7225ccc). Sibling tests stay on card-1 / work-a.
  2. Weave / lab names removed from live comments. Profile-sessions comment keeps the alias-order reason only. test_is_active_alone_is_not_live docstring is “Dashboard recency (is_active) is not live.”

Clean on this pass

  • Six-file live tree vs main: hermes_state.py, hermes_cli/web_server.py, gateway/platforms/api_server.py, and the three test modules. No secrets.
  • No people or agent names as product defaults. attach_session_work stores owner/profile only when the wake supplies them.
  • No Weave task ids, Cursor ids, or chat recap in live source.
  • No VPS, tunnel, IP, or lane-port bake-in, and no lab roster/hosts/gateways as product defaults.
  • No work-log comments on the new landing. No plan or recap docs added.
  • New commit 7b1d054 message does not name cards, people, or Forge.

Residual (no rewrite)

f1feb6c861ec79f58159901743b4b3da5eedaec4 commit body still cites Weave: 99503cb2 (parent 3a46344f). Ancestor blobs still contain the old test fixture. Do not rewrite history for f1feb6c8. That leftover is noted; it is not a demand to rebase.

Two-Eyes owns behavior. Hygiene only. PASS.

@rigario

rigario commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

Optional / non-blocking for Weave. Jeremy: Work Start must succeed without hermes-agent merge. Leave open; not a Weave ship gate.

@rigario

rigario commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

Reframe: this PR is an optional general Hermes observe improvement (live + work_ids). Not a merge gate for any downstream product.

@rigario rigario changed the title feat(sessions): Hermes-owned live + work_ids after Work Start wake feat(sessions): emit live + work_ids after prompt with work_ref Sep 4, 2026
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.

2 participants