Skip to content

fix(control): keep Linear lists, teams and ticket calls within reach - #328

Merged
kalaspuff merged 5 commits into
mainfrom
fctl/460-linear-leftovers
Oct 29, 2026
Merged

kalaspuff merged 5 commits into
mainfrom
fctl/460-linear-leftovers

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Linear integration showed and let through more than people and agents should reach:

  • The workspace's Linear tab and a project's Tickets tab listed every project that takes a Linear workspace's tickets, with its name and address, to members who can't see those projects. They now list the ones the person sees, within an access token's places.
  • Any member could list a connected Linear workspace's teams, workflows and open projects, at a cost of thousands of points against an API that every fctl workspace connected to it shares. Now only the workspace's admins and its projects' maintainers, who choose teams, can; the web app asks only for them.
  • A Linear team kept while the tracker was GitHub's, and never checked, was taken unchecked when only the tracker turned to Linear (fctl_domain::tickets::linear_changed).
  • A ticket call that failed gave its place within its limit back, though it had asked Linear or GitHub all the same, so a sandbox could loop failing writes without end and use up a shared Linear API. Failed writes now count against a limit of their own, 60 an hour, which every write needs room in, and a call names at most 20 labels, since GitHub takes each label removed in a request of its own.
  • A comment's reply_to went to Linear unchecked; it now has to be one of the ticket's own comments. A delivery for a Linear agent session also moves on only a thread of its own Linear workspace.

Verified in cargo xtask dev with its Linear stand-in: a member without a role in a project doesn't see it in the lists, and only admins and maintainers list teams; turning only the tracker to Linear checks the team; the 61st failing update in an hour is refused while reads go on; a reply under another comment and a 25-label update are refused; and a viewer's Tickets tab shows the saved team, and names the states as what they are, without asking for the teams. New tests cover the tracker check, the label limit and what a viewer sees. With main merged in, the checks and limits hold for projects of several Linear teams (#331), whose Tickets tab already lists the teams only for those who choose them; the domain, CLI and web tests pass on the merge.

The other fixes from the same security pass:

Worth confirming

  • Decision: members who neither administer the workspace nor maintain one of its projects can no longer list a connected Linear workspace's teams; they see their projects' saved teams instead.
  • Decision: a session's agent writes nothing more to its tracker after 60 writes that failed in an hour, and a call names at most 20 labels.

fctl session

What the Linear integration showed and let through went past what people
and agents should reach:

- The workspace's Linear tab, and a project's Tickets tab, listed every
  project that takes a Linear workspace's tickets, names and addresses
  included, to members who can't see those projects. Now only the ones
  the person sees, within an access token's places.
- Any member listed a connected Linear workspace's teams, workflows and
  open projects, at a cost of thousands of points against an API every
  fctl workspace connected to it shares. Now the workspace's admins and
  its projects' maintainers, who choose teams; the web app asks only for
  them.
- A Linear team kept while the tracker was GitHub's, never checked, was
  taken unchecked when only the tracker turned to Linear
  (fctl_domain::tickets::linear_changed).
- A ticket call that failed gave its place within its limit back, though
  it had asked Linear or GitHub all the same, so a sandbox could loop
  failing writes without end and use up a shared Linear API. A failed
  write now counts as a read, and a call names at most 20 labels, since
  GitHub takes each label removed in a request of its own.
- A comment's reply_to went to Linear unchecked; it now has to be one of
  the ticket's comments.
- A delivery for a Linear agent session only moves on a thread of its own
  Linear workspace.

Verified in cargo xtask dev with its Linear stand-in: a member without a
role in a project doesn't see it in the lists, and only admins and
maintainers list teams; turning only the tracker to Linear checks the
team; failed updates count as reads; a reply under another comment and a
25-label update are refused; a viewer's Tickets tab shows the saved team
without asking for the teams.
@fctl-sh

fctl-sh Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

fctl reviewed 7d2d137 and found 2 issues.

Mostly sound: the connections query, the teams check and the prompted organization check hold up. The new accounting for failed writes does not do what its comment and the docs say.

On lines the diff doesn't show:

  • Failing writes are still not capped · Medium severity · crates/fctl-control/src/tickets.rs lines 528–540: On error, call turns the write's ticket_writes row into a read row, so the write count for comment, create or update drops back and the next write passes the write limit again. The read limit is checked only on read calls, so an agent looping on a failing write (for example fctl ticket comment ENG-1 x --reply-to bogus, which queries Linear before it fails) can still call the tracker without end. It also fills its own read budget, so its next fctl ticket view gets RateLimited. The comment and the lines added to docs/security.md and docs/architecture.md say the opposite. Calls refused before the tracker (check_body, GitHub reply_to) are charged as reads too.
  • Read-only viewers see default state names, not the team's · Low severity · web/src/components/project/tickets.tsx line 931: With the teams query now off when disabled, team is always undefined for someone who can't manage the project, so TicketMoves shows the fallbacks "In Progress", "In Review" and "Done" even when the team's real states have other names. Before this change they saw the team's states. Show no state names (or mark them as defaults) when teams.data is missing.

Reviewed by fctl · Review agent settings

A failed write became a read, which gave its place among the writes back
while write calls never looked at reads: an agent looping on a write
that fails still asked the tracker without end, and filled its own reads.
Failed writes now count against a limit of their own, 60 an hour
(fctl_domain::tickets::MAX_FAILED_PER_HOUR), which every write needs room
in; reads and the writes that worked are counted as before.

The Tickets tab also names the team's states as what they are, its first
started, review and first completed state, where it doesn't have the
team's list: for people who don't choose its team, whom the list isn't
for.

Verified in cargo xtask dev: the 61st failing update in an hour is
refused, and the session still reads; a test covers what a viewer sees.
@fctl-sh

fctl-sh Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Both fixed in 0da6f61.

  1. Right: a failed write turned into a read gave its place among the writes back, and write calls never looked at reads, so a loop of failing writes went on. Failed writes now count against a limit of their own, 60 an hour (fctl_domain::tickets::MAX_FAILED_PER_HOUR), which every write needs room in, so reads are no longer charged for them; the docs say so. Checked in cargo xtask dev: the 61st failing update in an hour is refused, and the session still reads. A write refused before it reaches the tracker, like one with an empty body, counts among the failed ones too, which keeps the limit in one place; an agent rarely sends many of those.
  2. Right: without the team's list the switches fell back to Linear's default names. They now name the states as what they are (its first started state, its review state, its first completed state) when the list isn't there, with a test for a viewer.

@fctl-sh

fctl-sh Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

fctl reviewed 0da6f61 and found 1 issue.

On lines the diff doesn't show:

  • Agent docs still list the old ticket limits · Low severity · docs/cli.md lines 477–478: This sentence, and the same one in docs/agents.md (lines 586-588), list the hourly ticket limits without the new cap of 60 failed writes an hour. Only docs/architecture.md and docs/security.md were updated, so an agent or person reading these pages doesn't learn why its writes are refused after repeated failures.

Reviewed by fctl · Review agent settings

@fctl-sh

fctl-sh Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in acb5efd: docs/cli.md and docs/agents.md name the limit of 60 failed writes an hour beside the others.

@fctl-sh

fctl-sh Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

fctl reviewed acb5efd and found 1 issue.

Rate limits, the Linear teams restriction, visibility filtering in connections, the reply_to check and the linear_changed move all read correctly; three independent reviews found no bugs. One docs gap below.

On lines the diff doesn't show:

  • CLI docs don't say who may list Linear teams · Low severity · docs/cli.md line 256: teams now answers 403 unless the caller is a workspace admin or maintains one of its projects, but this line (and docs/cli.md:408, docs/agents.md:442) still reads as if any member can run fctl workspaces linear teams. AGENTS.md asks for docs to change with behavior; only docs/architecture.md says it.

Reviewed by fctl · Review agent settings

fctl workspaces linear teams answers for the workspace's admins and its
projects' maintainers alone now; the CLI's help and docs say so, and that
the workspace's Linear list shows the person's own projects.
@fctl-sh

fctl-sh Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 7bc9222: docs/cli.md (both places), docs/agents.md and fctl workspaces linear teams --help say the teams list is for the workspace's admins and its projects' maintainers, and that the workspace's Linear list shows the person's own projects.

kalaspuff pushed a commit that referenced this pull request Oct 29, 2026
## Summary

A project whose tracker is Linear now takes tickets from one team or
several of its Linear workspace (at most 20), each of all its issues or
of one of its Linear projects. Delegating an issue of any of them to
fctl, or mentioning fctl on one, starts a session of the project.
Agents' `fctl ticket` calls list and view the tickets of all of them,
file new ones in the first team unless they name another (`fctl ticket
create --in DES`; a sub-ticket goes to its parent's team), and take each
ticket's states and labels from its own team, saying which team when one
lacks what they asked for.

- **Tickets tab:** the team and "Issues of" selects became a list of
teams, each with its own "Issues of". A team added since the last save
is marked New, one taken off stays struck through with Undo until you
save, and with several teams a line under the list chooses where agents
file new tickets (that team goes first). The ticket-state switches name
the states each team's workflow has ("In Review or Code review").
Viewers see the teams as saved, and the workspace's Linear tab shows
every team a project takes.
- **CLI:** `fctl projects set --linear-team ENG,DES`, and
`--linear-project` takes `DES:Website` (or a name that only one of the
teams has, or `DES:all`), repeatable.
- **Compatibility:** the first team stays in today's `LinearTickets`
fields and the others go in a new optional `more_teams`, so older hosts,
CLIs and control planes read a project of several teams as one of its
first team. An update that leaves `more_teams` out keeps the stored
teams, so an older CLI or a tab opened before the deploy can't drop
them; `[]` clears them. Saving asks Linear only about teams that
changed. ADR 0065
(`docs/adr/0065-projects-take-tickets-from-several-linear-teams.md`)
records the design.

I verified it with new unit tests (domain, CLI, web) and `cargo xtask
check`. I also ran it end to end in `cargo xtask dev` with the Linear
stand-in: delegating DES-1 started a Playground session and moved the
issue to In Progress; agent calls listed both teams' tickets, filed
tickets in each team (by `--in`, by parent, by default), refused a
ticket outside a team's Linear project, and named the team for a missing
label or state; settings updates sent as an older client and as a newer
one behaved as described. `cargo xtask linear check` confirms that
Linear's schema takes the new queries (`or` filters, `teams(filter: {
id: { in } })`).

This touches the same functions as #328 (`tickets.rs`, the Tickets tab,
`check_linear`), so whichever of the two merges second needs `main`
merged in. A matching sentence in fctl.sh's privacy policy changes in:

- hyperstructure/fctl-site#88

## Screenshots

At 0beb37e, from `cargo xtask dev` with the Linear stand-in's Acme
workspace, 1280 px wide unless noted.

One team, as most projects have, before and after:

| Before | After |
|---|---|
| ![Before: the Team and Issues of selects,
dark](https://app.fctl.sh/api/v1/published/g1GDt4u54hNRg3eoIKGnetckl27DZwIj744phJWIoJb/before-one-dark.png)
| ![After: a list with one team and Add a team,
dark](https://app.fctl.sh/api/v1/published/2a6xyftnsxz3i6NPFRxe1CriswKFYdG3mjxWlwRtUnZ/after-one-dark.png)
|
| ![Before: the Team and Issues of selects,
light](https://app.fctl.sh/api/v1/published/SFRSTYjGCVGOTk58VC7MvCYULcGZU9Fbrh1RGqUWSt5/before-one-light.png)
| ![After: a list with one team and Add a team,
light](https://app.fctl.sh/api/v1/published/uzDrnrrofEtqIZWtm8j10UHZs9HGlalCwciLGcbmPZF/after-one-light.png)
|

Two teams, Design narrowed to its Brand refresh project, with where
agents file new tickets:

![After: Engineering and Design in the list,
light](https://app.fctl.sh/api/v1/published/iwauXpHktEKfHLFwsEVKuOlzslqyecKFOeroBM4F42I/after-two-light.png)

Editing before a save: Platform added (New), Design taken off (Undo),
and the states Platform's workflow adds ("Code review"):

![After: an edit in progress,
dark](https://app.fctl.sh/api/v1/published/eaf7cPtuqX1thAWgSArLTGnimp1Aol7DcJRQS8yliUn/after-edit-dark.png)

The Add a team list, and a phone at 390 px:

| Adding a team | Phone |
|---|---|
| ![After: the Add a team list open,
dark](https://app.fctl.sh/api/v1/published/ne3Tv4EYS8fgjnlDrocPjumeLn1OdSdZBvAwStviNWQ/after-add-dark.png)
| ![After: two teams at 390 px,
dark](https://app.fctl.sh/api/v1/published/Mx4wpQJjIIKmg3gKOasQJAuDPMA7XNiKmKXxeFLI1rg/after-two-dark-390.png)
|

## Worth confirming

- **Decision:** the switches that move tickets (In Progress, In Review,
Done) and the explore label stay one per project, for all its teams;
each move goes to the ticket's own team's states. A team whose Linear
GitHub integration moves tickets differently would need a project of its
own.
- **Decision:** agents file new tickets in the first team unless they
pass `--in`; the Tickets tab's "Agents file new tickets in" makes the
chosen team the first.
- **Decision:** a project's teams all come from its one Linear
workspace, each team once (one Linear project per team at most), and at
most 20 teams.
- **Decision:** an older client that changes a project's team keeps its
other teams (less the one it makes first) rather than replacing them
all.

[fctl session](https://app.fctl.sh/s/ses_01M63YR66H5WGRSBA13X57VW9B)

---------

Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
…vers

# Conflicts:
#	crates/fctl-control/src/tickets.rs
#	crates/fctl/src/cmd/workspaces.rs
#	docs/agents.md
#	docs/architecture.md
#	docs/security.md
#	web/src/components/project/tickets.test.tsx
#	web/src/components/project/tickets.tsx
kalaspuff pushed a commit that referenced this pull request Oct 29, 2026
…#329)

## Summary

Hosts trust the control plane with what runs in sandboxes, but not with
the machine around them, as their update checks already show. A few
names it sends still reached the host's paths unchecked:

- Sandbox names came from the session's id, and a Claude sign-in's from
its job's, as the control plane sent them. The process driver keeps each
sandbox in a directory of that name and removes it afterwards, so an id
with slashes and dots named any directory on the machine. Names now keep
only letters, digits and dashes; real ids name the same sandboxes as
before.
- A project's Dockerfile and build directory, and the path of its dev
container configuration, which the paths that configuration names are
relative to, went to the build as they came: the control plane checks
them, but the host didn't, so a directory like `../..` would have built
from the host's own files, and a configuration path with `..` parts
named another repository's file in GitHub's API. The host now checks
every one of them as a path in the repository before anything reads it.

The standalone control plane also makes its state directory, which holds
D1 and every Durable Object's SQLite files, readable by its own user
alone, and says in its log when it can't, for a directory another user
owns. Verified with new unit tests for both names and build paths, the
host's tests and the standalone server's tests.

The other fixes from the same security pass:

- #325
- #326
- #327
- #328

[fctl session](https://app.fctl.sh/s/ses_01M62HVCXZDZV6GJJP8DDQGDFF)

---------

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
@kalaspuff
kalaspuff merged commit cddfb24 into main Oct 29, 2026
11 checks passed
@kalaspuff
kalaspuff deleted the fctl/460-linear-leftovers branch October 29, 2026 16:40
kalaspuff pushed a commit that referenced this pull request Oct 29, 2026
#326)

## Summary

Connecting a Claude token or a full Claude login makes it the person's
default at once, and a full login's Claude account sees the sessions
that run on it (Remote Control). With a stolen browser session or CLI
token, someone could connect their own Claude login to the victim's
account, with nothing to confirm and nothing said to the person, and
from then on watch and message every session the victim started, whose
agents hold the sessions' GitHub tokens and the projects' secrets, long
after the stolen token was revoked.

Connecting a Claude subscription is now a sensitive action
(`Sensitive::ConnectClaude`), whether with a token, a sign-in through a
host, or the token kept on one's runners. The web app and the CLI
already confirm such actions with a passkey or a code where the instance
asks for it. A new connection also emails the person when email is set
up, saying what was connected, as a best effort that never fails the
connection. Verified in `cargo xtask dev`: with confirmation on and an
authenticator app, an unconfirmed access token gets
`verification_required` for a token, a sign-in and a runners token, and
connects once it confirmed with a code.

The privacy policy lists the new email in:

- hyperstructure/fctl-site#87

The other fixes from the same security pass:

- #325
- #327
- #328
- #329

## Worth confirming

- **Decision:** like every sensitive action, this asks only where the
primary instance owner turned on confirming it's you, which is off by
default; elsewhere the email is what tells the person.
- **Decision:** choosing the default connection, or a workspace's, stays
unconfirmed: it only chooses among connections the person already has.

[fctl session](https://app.fctl.sh/s/ses_01M62HVCXZDZV6GJJP8DDQGDFF)

---------

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
kalaspuff pushed a commit that referenced this pull request Oct 29, 2026
…in (#325)

## Summary

A workspace admin could invite another address they hold, as an admin or
a member, and keep that invitation for its 30 days. Once the other
admins removed or demoted them, or their account was disabled, accepting
it, or signing up with that address, brought them back into the
workspace, or back as an admin: removing someone deleted only the
invitations addressed to them, and joining gave the invitation's role
whoever had sent it.

An invitation now counts only while whoever sent it is still an active
admin of the workspace (`workspaces::INVITER_STILL_ADMIN`). Joining
checks it, the lists invitees and admins see and the public invitation
preview leave the others out, and removing or demoting an admin deletes
the invitations they sent. The same check covers invitations sent before
this change. Verified in `cargo xtask dev` with three accounts: an
admin's invitation to another account stops working once they are
removed, demoted or disabled, and a current admin's invitation still
joins.

The other fixes from the same security pass:

- #326
- #327
- #328
- #329

## Worth confirming

- **Decision:** a demoted admin's member invitations go too, not only
their admin ones, since only admins invite; the remaining admins can
send them again.

[fctl session](https://app.fctl.sh/s/ses_01M62HVCXZDZV6GJJP8DDQGDFF)

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
kalaspuff pushed a commit that referenced this pull request Oct 29, 2026
…ds (#327)

## Summary

A few ways in outlived what should have ended them, or got past a second
factor:

- An address's allowlist entry kept the admin role after its account
disconnected the address, while demoting or deleting the account only
touched the addresses it still had. An admin could disconnect the
address they were invited with and, once demoted or deleted, sign up
with it again through Google, which needs no invitation, as an admin.
Disconnecting an address now turns its admin entry into a member's.
- Signing up with an admin's invitation gave the admin role even when
the allowlist now admitted the address only as a member. The role is now
the lower of the two, and an admin's invitation makes an earlier
invitation's member entry for its address an admin's, which revoking it
takes back. An admin invitation's entry also used to stay an admin's
after the invitation ran out unused, so a Google sign-up still made an
admin; the hourly job now makes it a member's.
- A password reset link kept working for its hour after the address it
went to left the account. Disconnecting an address now uses up the
account's waiting links.
- A CLI sign-in the person had approved, but that no CLI had picked up
yet, still signed a CLI in after a password change or reset revoked
their tokens. Revoking someone's tokens now refuses those codes too.
- Outside a fresh sign-in, adding a passkey took the password, even on
an account with an authenticator app, and setting up a first app took
the password on an account whose passkeys are its second factor: a
stolen session with the password, as malware that steals browsers'
cookies and saved passwords has together, could add a way in past the
second factor. Both now take what a sign-in with the password takes: the
app's code where there is an app, a fresh sign-in where passkeys are the
second factor, and the setup form says so when it asks for that sign-in.
- Turning off your own "ask for a code on Google sign-in" took a session
alone. It is now the same sensitive action as the instance's setting,
and emails the person.
- A setup that lost a concurrent race no longer leaves an admin's
allowlist entry for its address.

Verified in `cargo xtask dev`: disconnecting an address with an admin
entry leaves a member's entry and uses up a reset link; an approved
device code polls as denied after a password change; an admin invitation
signs up an admin, and one whose address is now allowed as a member
signs up a member; an account with an authenticator app is asked for a
code, not its password, to add a passkey; and an unconfirmed token can't
turn off Google codes where confirming is on. Unit tests cover setting
up a first app.

The privacy policy lists the new Google codes email in:

- hyperstructure/fctl-site#87

The other fixes from the same security pass:

- #325
- #326
- #328
- #329

## Worth confirming

- **Decision:** disconnecting an address makes its admin entry a
member's rather than deleting it, so the address can still sign up as a
member, as demoting an admin already leaves it.
- **Decision:** disconnecting an address uses up all the account's
waiting reset links, since fctl doesn't record which address each one
went to.
- **Decision:** inviting an address as an admin while an entry an admin
added by hand allows it as a member is refused until that entry is
removed, rather than changing the hand-made entry.
- **Decision:** an admin's invitation that runs out unused leaves its
address allowed as a member, not an admin: whoever signs up with Google
afterwards is a member until promoted.
- **Decision:** adding a passkey on an account with an authenticator app
takes a code from the app instead of the password, outside a fresh
sign-in.

[fctl session](https://app.fctl.sh/s/ses_01M62HVCXZDZV6GJJP8DDQGDFF)

---------

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant