Heads read their own workers' task records (read-only); environment.bin never readable

Merged
AF
7d ago
+1322-39

Accepted agent delivery; branch-keyed search descriptor included.


Summary by cubic

Allows a head scope to read its workers' bash task records and status read-only, including after worker revival, while keeping task control owner-only and environment.bin unreadable for every session. Head access is revoked when the head's scope ends or its registration is replaced. Bash status for a head's worker task now resolves the owner through the live task map or a covering task-id database index instead of enumerating session folders, and scoped misses never fall back to legacy discovery.

  • The access-policy floor now denies environment.bin everywhere, and recursive grep/glob and outline walks skip it.
  • Sessions can grep and glob their own task I/O folder; heads can read worker records and status but bash_write/bash_kill still return task_not_found.
  • The new idx_bash_tasks_task_owner index is installed idempotently on writable opens and keeps schema and reader floor at 18; read-only opens do not create it.
  • The per-bundle task-read cache is a 64-record LRU of pinned directories; head liveness is revalidated on every read, and stale records release their handles before cleanup or retention deletion. On Windows the pin prevents renaming a folder while a record is held.

RetriggerView in GreptileConfidence Score: 5/5

The latest changes appear safe to merge and address both earlier findings.

Summary

Heads can read their workers’ task records and status without gaining task control. Task environments remain blocked.

The latest changes address both earlier findings:

  • Heads can read their workers’ task files without opening the launch environment.
  • Heads can check the status of tasks run by their workers.

Both earlier threads were manually resolved without explanatory replies. The current code addresses both findings. Neither thread supplied a comment number, so neither has a numbered previous-finding entry.

Review was based on code inspection; tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Read task record] --> B[Find or load pinned record]
  B --> C{Own task I/O?}
  C -->|Yes| F[Check file and allow read]
  C -->|No| D[Match worker parent to caller]
  D --> E{Caller is still a live head?}
  E -->|Yes| F
  E -->|No| G[Deny read]
  H[Task cleanup] --> I[Drop cached record]
  I --> J[Delete task bundle]

Reviews (3) · Last reviewed commit: "mason: revoke ended-head task reads and ..." · Reviewed by Greptile