Skip to content

fix(session): export AO_RUN_FILE to spawned sessions so hook delivery finds the spawning daemon#2399

Open
rep-de wants to merge 1 commit into
AgentWrapper:mainfrom
rep-de:fix/spawn-env-ao-run-file
Open

fix(session): export AO_RUN_FILE to spawned sessions so hook delivery finds the spawning daemon#2399
rep-de wants to merge 1 commit into
AgentWrapper:mainfrom
rep-de:fix/spawn-env-ao-run-file

Conversation

@rep-de

@rep-de rep-de commented Jul 4, 2026

Copy link
Copy Markdown

Root cause

Spawned sessions inherit AO_DATA_DIR but not AO_RUN_FILE. When the daemon runs with a non-default run file (workspace-local state), every ao hooks callback inside a spawned session resolves the default ~/.ao/running.json, which is stale or absent — hook delivery fails silently: sessions show no_signal, and permission dialogs never surface as blocked activity.

Repro sketch

  1. Run AO with workspace-local state using a non-default AO_RUN_FILE.
  2. Spawn a session that installs AO hooks.
  3. Trigger an ao hooks callback inside the spawned session.
  4. Observe the callback resolving the default ~/.ao/running.json instead of the spawning daemon's run file; activity stays no_signal, and permission dialogs do not surface as blocked activity.

Fix

Export AO_RUN_FILE into the spawn environment alongside AO_DATA_DIR, with AO-internal environment variables applied after project env so projects cannot override the run file. If the daemon has no resolved run-file path, omit AO_RUN_FILE rather than exporting an empty value.

Tests

Added/updated session manager provision tests to assert project env cannot override AO_RUN_FILE and empty run-file values are omitted.

Validated with:

  • cd backend && go build ./...
  • cd backend && go test ./...

Interim workaround

Hit in production orchestration on 2026-07-04 with v0.10.2. Until this lands, a ~/.ao/running.json symlink to the workspace run file keeps hook delivery pointed at the live daemon.

🤖 Generated with Claude Code

… finds the spawning daemon

Sessions inherited AO_DATA_DIR but not AO_RUN_FILE; with a non-default
state location, every 'ao hooks' callback fell back to ~/.ao/running.json
and failed (all sessions no_signal, permission dialogs undetected,
observed 2026-07-04). Mirrors SIGNAL_REPORT fix proposal AgentWrapper#2.
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