Skip to content

feat(overseer): ping_session relay write-tool (Stage 1.5) - #104

Open
heavygee wants to merge 6 commits into
feat/overseer-admin-consolefrom
feat/overseer-relay-ping
Open

feat(overseer): ping_session relay write-tool (Stage 1.5)#104
heavygee wants to merge 6 commits into
feat/overseer-admin-consolefrom
feat/overseer-relay-ping

Conversation

@heavygee

@heavygee heavygee commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Stacked on #103 (admin console). Review/merge after it.

Summary

  • ping_session write tool — Overseer can relay an operator-directed message to one worker/project session (resume if inactive, then enqueue). Pass sessionId (full or unique prefix) and/or itemId (inbox item → relatedSessionId).
  • Uses SyncEngine resumeSession + sendMessage in-process (R5 — never shells hapi-ping-peer).
  • Identity: canRelay: true. Catalog: 11 tools, 2 writes. Conversational path only (allowWrites); HTTP tool dispatch still 403s writes.
  • System prompt + talk-to chrome updated for Stage 1.5 relay discipline.

Hub URL note (ops)

Live operator hub is now https://hapi-gc-oos.forest-adder.ts.net/ (svc:hapi-gc-oos). Old hapi.tail9944ee.ts.net / *.tail9944ee.ts.net MagicDNS is dead after the tailnet rename to forest-adder.ts.net. ~/.hapi/hub.env + settings.json publicUrl already updated on the box.

Test plan

  • bun run typecheck (cli + web + hub)
  • hub: ping_session resolve by itemId/prefix + write gate; routes 403 for ping_session
  • shared: catalog / identity / prompt assertions for Stage 1.5
  • Soup + dogfood: in /overseer talk-to, say "ping that expenses session to draft the Cursor Pro note" and confirm the target session receives the message

Made with Cursor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f389c889dc

ℹ️ 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".

Comment thread hub/src/sync/syncEngine.ts Outdated
Comment thread hub/src/sync/overseerEntity.ts Outdated
Comment thread hub/src/overseer/converse.ts
Comment thread hub/src/overseer/runOverseerTool.ts
heavygee added a commit that referenced this pull request Aug 1, 2026
Stage 1.5 write tool ping_session for /overseer dogfood. Union order:
open-loops -> dispositions -> admin-console -> relay-ping. Tip f389c88.

Also bumps tip comments: dispositions ed4f30c (#102 CI), admin-console
1cb8781 (rebased + About deep-link).

Co-authored-by: Cursor <cursoragent@cursor.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cfafd32020

ℹ️ 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".

Comment thread hub/src/overseer/runOverseerTool.ts
Comment thread hub/src/sync/overseerEntity.ts Outdated
Comment thread shared/src/overseerConverse.ts Outdated
heavygee added a commit that referenced this pull request Aug 1, 2026
Hub-owned converse context from convo_turns + GET /converse/recent + talk-to
hydrate so /overseer hard-reload keeps the thread. Tip 5097bcc on #104
(cfafd32 prefix fix included).

Co-authored-by: Cursor <cursoragent@cursor.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aafac9c6ce

ℹ️ 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".

Comment thread hub/src/sync/overseerEntity.ts Outdated
@heavygee
heavygee force-pushed the feat/overseer-admin-console branch from b6e6708 to 8d59e9f Compare August 1, 2026 20:09
@heavygee
heavygee force-pushed the feat/overseer-relay-ping branch from e62cb17 to 55ca5c5 Compare August 1, 2026 20:09
@heavygee
heavygee force-pushed the feat/overseer-admin-console branch from 8d59e9f to 8b9c5d5 Compare August 1, 2026 20:12
@heavygee
heavygee force-pushed the feat/overseer-relay-ping branch from 55ca5c5 to 284c12c Compare August 1, 2026 20:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 284c12c871

ℹ️ 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".

Comment thread shared/src/overseerWriteIntent.ts Outdated
Comment thread hub/src/overseer/converse.ts
Comment thread hub/src/sync/overseerEntity.ts Outdated
Comment thread hub/src/sync/syncEngine.ts Outdated
heavygee and others added 4 commits August 2, 2026 00:37
Gives the Overseer an operator-directed way to ping an individual project
session — the delegation brick from the action architecture (R5).

- New write tool `ping_session` (sessionId and/or itemId → related session,
  then resume-if-inactive + enqueue). Wired through SyncEngine's existing
  resumeSession/sendMessage primitives — never shells out to hapi-ping-peer.
- Identity gains `canRelay`; catalog now has 11 tools (2 writes). System
  prompt updated for Stage 1.5 relay discipline (imperative-only, tombstone).
- runOverseerTool is async; HTTP tool surface still 403s writes (converse
  allowWrites remains the only write path).

Also: operator hub URL is now https://hapi-gc-oos.forest-adder.ts.net
(svc:hapi-gc-oos; old *.tail9944ee.ts.net MagicDNS is dead).

Co-authored-by: Cursor <cursoragent@cursor.com>
get_session_state/get_worker_health/query_events only did exact UUID
match, so the brain's truncated 8-char ids returned null and Overseer
falsely called live inbox rows "ghost sessions". Shared unique-prefix
resolve (same as ping_session); lean inbox keeps full relatedSessionId
+ summary; prompt clarifies null ≠ deleted.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resume can remap the hub session id after spawn+merge; relay now sends to
that id. Failed relays mark toolTrace.ok false, and a brain failure after a
successful write returns the write audit trail instead of an empty failure.

Co-authored-by: Cursor <cursoragent@cursor.com>
…d audit

Server-side authorization for write tools from the latest operator utterance
(or explicit allowWrites). Reject sessionId/itemId mismatches. Record
idempotent dispatched events after successful relays.

Co-authored-by: Cursor <cursoragent@cursor.com>
@heavygee
heavygee force-pushed the feat/overseer-admin-console branch from 8b9c5d5 to 10e3c26 Compare August 1, 2026 23:37
Default query_inbox no longer treats sleeping snoozes as visible; write
tools bind to operator-named session/item/payload with dedupe; relay
refuses fresh-spawn and keeps ok when audit insert fails; OverseerEntity
is per-namespace (#107 kill criterion) via SyncEngine.getOverseer(ns).

Co-authored-by: Cursor <cursoragent@cursor.com>
@heavygee
heavygee force-pushed the feat/overseer-relay-ping branch from caff271 to b3465a9 Compare August 1, 2026 23:37
@heavygee

heavygee commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

Codex P1s: bind write grants to operator-named session/item/payload + dedupe; audit insert fail keeps delivery ok; no fresh-spawn via relay; namespace-scoped getOverseer (#107 kill criterion). Tip of stack: 0ef4d512b on #106.

Co-authored-by: Cursor <cursoragent@cursor.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 483c08815f

ℹ️ 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".

Comment on lines +26 to +27
const RELAY_INTENT =
/\b(ping|relay|nudge|wake)\b|\btell\b[\s\S]{0,80}\b(session|worker|peer|agent|him|her|them|it)\b|\b(message|ask|send)\b[\s\S]{0,80}\b(session|worker|peer|agent)\b/i

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject negated relay intent

When the latest utterance is do not ping session abcdef12, the bare-keyword regex still grants ping_session, extracts the target, and—because there is no quoted snippet—authorizes any relay payload to that session. A prompt-injected read result can therefore trigger the exact irreversible action the operator prohibited. Fresh evidence after the earlier intent-gate fix is that this regex does not account for negation or distinguish a relay command from discussion of relaying.

Useful? React with 👍 / 👎.

Comment on lines +139 to +140
const hasTargetGrant = auth.sessionIdPrefixes.length > 0 || auth.itemIds.length > 0
if (!hasTargetGrant) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Authorize relays resolved from named sessions

For the documented natural-language flow ping the expenses session: please continue, no UUID/item ID appears in the latest utterance, so this branch rejects the eventual ping_session call even after the brain resolves Expenses through list_active_workers. Because writeAuth is fixed before tool execution, project/session names can never become authorized targets; the advertised name-based relay flow only works when the operator supplies a literal ID or an unavailable client override.

Useful? React with 👍 / 👎.

Comment on lines +160 to +164
if (auth.itemIds.length === 0) {
return {
ok: false,
error: 'disposition requires an explicit item id in the operator message (or allowWrites)'
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve contextual disposition targets

When an operator follows an inbox explanation with the supported command mark that done, the target item exists in conversation history but not in the latest utterance, so this new gate rejects every record_disposition call. This regresses the existing referential disposition flow and contradicts the system prompt's own mark that done example; authorization needs to bind the previously resolved item or request confirmation rather than requiring the operator to repeat its numeric ID.

Useful? React with 👍 / 👎.

Comment on lines +831 to +832
// Bucket to the second so identical retries within the same second collapse.
const idempotencyKey = `overseer-dispatched:${input.sessionId}:${ts - (ts % 1000)}:${hashRelaySnippet(input.message)}`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Record every delivered relay in the audit stream

If two identical relays to the same session are delivered within one second—for example from concurrent converse requests or an immediate intentional repeat—both messages are enqueued, but this shared idempotency key causes the second dispatched insertion to return the first event. The session audit therefore records one dispatch for two actual writes; either make delivery itself idempotent under the same key or give each successful delivery a distinct audit identity.

Useful? React with 👍 / 👎.

heavygee added a commit that referenced this pull request Aug 3, 2026
Operator remat request for 0ef4d51; soup current PR tip 109fe19
(includes that commit + routes brace fix). Also #102/#103/#104 tip
rewrites: snooze CI, bound write grants, #107 per-ns OverseerEntity.

Co-authored-by: Cursor <cursoragent@cursor.com>
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