Skip to content

context-usage: post-compact-mark.sh writes the main session's .compacted marker on a subagent compaction (2.1.323 agent_id) #17899

Closed

Description

@kyle-sexton

Refs: #15693

Split from the changelog release issue(s) above under the owner's decision of 2026-11-21 (melodic-software/architecture#148): one issue per handoff row, rows that edit the same file grouped.

Route: lane work. Basis: correctness bug: a subagent compaction marks the main session.

Problem

Row 13 of #15693 (key changelog:2.1.323..2.1.323:adopt:plugins/context-guard/hooks/post-compact-mark.sh; the plugin is now context-usage, renamed in #15633). Required sentence: a subagent compaction can write the main session's .compacted marker because the hook cannot tell the two apart. PostCompact payloads now carry agent_id/agent_type for a subagent compaction, so the hook could skip it as the context-usage module already does.

On main: plugins/context-usage/hooks/post-compact-mark.sh:54-64 reads only session_id and trigger. plugins/context-usage/hooks/hook-utils.sh:197-204 already extracts agent_id. When the row was filed, the hooks page did not list agent fields for compaction events (docs-lag), so the row says to defer pending a probe.

Done when

  • A probe (or the hooks page) confirms PostCompact carries agent_id for a subagent compaction; if it does, post-compact-mark.sh skips the main-session marker for a subagent compaction, with a test.
  • If adopted: post-compact-mark.sh exits without writing the marker when agent_id is present, and post-compact-mark.test.sh covers both payloads.

Activity

  1. added
    needs-triage
    on Nov 21, 2026
  2. github-actions commented on Nov 21, 2026

    @github-actions
    Contributor

    Size: Small
    Complexity: Low
    Uncertainty: Knowable
    Flags: none
    Blocked by: none
    Blast radius: the context-usage plugin's post-compact-mark.sh hook and its test; read by users running that plugin's PostCompact hook.
    Reversible: yes; revert the small hook and test edit.
    Open questions: none
    I understood this as a correctness bug. A subagent compaction can write the main session's .compacted marker because the hook cannot tell the two apart. The fix is to skip the marker when agent_id is present, and to add a test with both payloads. The one thing to settle first is whether PostCompact really carries agent_id for subagent compactions. That needs a probe or the hooks docs page, and the issue already lists it as a done-when item. I found no likely duplicate or merged fix in the provided lists. The related tracking issue is #15693.

    Automated triage. A maintainer reviews it.

  3. removed
    needs-triage
    on Nov 21, 2026
  4. melodic-automation-lanes commented on Nov 21, 2026

    @melodic-automation-lanes
    Contributor

    {"v":1,"actor_id":337595936,"title_sha256":"3cbfeef2fbb1407567dd92dd1c18f99c96363eaeb0810b0b7f0bda18b952c1ff","body_sha256":"0e73595fea1fcc080cb0300473fa01418cabc1e0c4156a78ece72573acf1b4eb"}

  5. melodic-automation-lanes commented on Nov 21, 2026

    @melodic-automation-lanes
    Contributor

    This records a re-fire of an earlier stop, not a new one. The start gate stopped run 44892441689, the work-resolve-issue run that agent-ready started, before any model turn, because the GITHUB_TOKEN budget was under its start-gate share, or the window was projected to have under its start-project share of the header's limit left by the run's expected end (github-token start-gate, start-project and start-run-minutes in rate-limits.json; the run's start-gate notice names which); that run ended at 2026-11-21T10:04:59Z. work-unblock has now removed and added agent-ready back to start a fresh run. A budget stop is the lanes' load, not a fault in this issue: it never counts toward limits.limit-stops-per-issue or the kill-switch wait.

  6. github-actions commented on Nov 21, 2026

    @github-actions
    Contributor
    No description provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Work status

    needs-triage

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions